@visactor/vchart 1.11.7-alpha.0 → 1.11.7-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 (89) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.js +108 -73
  3. package/build/index.min.js +1 -1
  4. package/build/tsconfig.tsbuildinfo +1 -1
  5. package/cjs/animation/config.js +4 -1
  6. package/cjs/animation/config.js.map +1 -1
  7. package/cjs/chart/base/base-chart.js +6 -4
  8. package/cjs/chart/base/base-chart.js.map +1 -1
  9. package/cjs/chart/stack.js +1 -2
  10. package/cjs/compile/grammar-item.js +2 -1
  11. package/cjs/component/tooltip/interface/theme.d.ts +2 -2
  12. package/cjs/component/tooltip/interface/theme.js.map +1 -1
  13. package/cjs/core/index.d.ts +1 -1
  14. package/cjs/core/index.js +1 -1
  15. package/cjs/core/index.js.map +1 -1
  16. package/cjs/core/interface.d.ts +3 -2
  17. package/cjs/core/interface.js.map +1 -1
  18. package/cjs/core/vchart.d.ts +2 -2
  19. package/cjs/core/vchart.js +25 -18
  20. package/cjs/core/vchart.js.map +1 -1
  21. package/cjs/layout/layout-item.d.ts +1 -1
  22. package/cjs/model/interface.d.ts +1 -0
  23. package/cjs/model/interface.js.map +1 -1
  24. package/cjs/series/base/base-series.js +6 -6
  25. package/cjs/series/base/base-series.js.map +1 -1
  26. package/cjs/series/base/constant.d.ts +6 -0
  27. package/cjs/series/base/constant.js +12 -2
  28. package/cjs/series/base/constant.js.map +1 -1
  29. package/cjs/series/line/animation.js +7 -4
  30. package/cjs/series/line/animation.js.map +1 -1
  31. package/cjs/series/polar/animation.js +12 -3
  32. package/cjs/series/polar/animation.js.map +1 -1
  33. package/cjs/series/rose/animation.js +8 -2
  34. package/cjs/series/rose/animation.js.map +1 -1
  35. package/cjs/theme/interface.d.ts +2 -2
  36. package/cjs/theme/interface.js.map +1 -1
  37. package/cjs/typings/spec/common.d.ts +2 -2
  38. package/cjs/typings/spec/common.js.map +1 -1
  39. package/cjs/typings/visual.d.ts +2 -2
  40. package/cjs/typings/visual.js.map +1 -1
  41. package/cjs/util/spec/index.d.ts +0 -1
  42. package/cjs/util/spec/index.js +1 -1
  43. package/cjs/util/spec/index.js.map +1 -1
  44. package/esm/animation/config.js +4 -1
  45. package/esm/animation/config.js.map +1 -1
  46. package/esm/chart/base/base-chart.js +8 -6
  47. package/esm/chart/base/base-chart.js.map +1 -1
  48. package/esm/chart/stack.js +1 -2
  49. package/esm/compile/grammar-item.js +2 -1
  50. package/esm/component/tooltip/interface/theme.d.ts +2 -2
  51. package/esm/component/tooltip/interface/theme.js.map +1 -1
  52. package/esm/core/index.d.ts +1 -1
  53. package/esm/core/index.js +1 -1
  54. package/esm/core/index.js.map +1 -1
  55. package/esm/core/interface.d.ts +3 -2
  56. package/esm/core/interface.js.map +1 -1
  57. package/esm/core/vchart.d.ts +2 -2
  58. package/esm/core/vchart.js +26 -19
  59. package/esm/core/vchart.js.map +1 -1
  60. package/esm/layout/layout-item.d.ts +1 -1
  61. package/esm/model/interface.d.ts +1 -0
  62. package/esm/model/interface.js.map +1 -1
  63. package/esm/series/base/base-series.js +7 -6
  64. package/esm/series/base/base-series.js.map +1 -1
  65. package/esm/series/base/constant.d.ts +6 -0
  66. package/esm/series/base/constant.js +13 -0
  67. package/esm/series/base/constant.js.map +1 -1
  68. package/esm/series/line/animation.js +7 -4
  69. package/esm/series/line/animation.js.map +1 -1
  70. package/esm/series/polar/animation.js +10 -4
  71. package/esm/series/polar/animation.js.map +1 -1
  72. package/esm/series/rose/animation.js +8 -2
  73. package/esm/series/rose/animation.js.map +1 -1
  74. package/esm/theme/interface.d.ts +2 -2
  75. package/esm/theme/interface.js.map +1 -1
  76. package/esm/typings/spec/common.d.ts +2 -2
  77. package/esm/typings/spec/common.js.map +1 -1
  78. package/esm/typings/visual.d.ts +2 -2
  79. package/esm/typings/visual.js.map +1 -1
  80. package/esm/util/spec/index.d.ts +0 -1
  81. package/esm/util/spec/index.js +0 -2
  82. package/esm/util/spec/index.js.map +1 -1
  83. package/package.json +13 -13
  84. package/cjs/util/spec/background.d.ts +0 -4
  85. package/cjs/util/spec/background.js +0 -21
  86. package/cjs/util/spec/background.js.map +0 -1
  87. package/esm/util/spec/background.d.ts +0 -4
  88. package/esm/util/spec/background.js +0 -13
  89. package/esm/util/spec/background.js.map +0 -1
@@ -82,7 +82,7 @@ import { getCanvasDataURL, URLToImage } from "../util/image";
82
82
 
83
83
  import { ChartEvent, DEFAULT_CHART_HEIGHT, DEFAULT_CHART_WIDTH, VGRAMMAR_HOOK_EVENT } from "../constant";
84
84
 
85
- import { isArray, isEmpty, Logger, merge as mergeOrigin, isFunction, LoggerLevel, isEqual, get, cloneDeep } from "@visactor/vutils";
85
+ import { isArray, isEmpty, Logger, merge as mergeOrigin, isFunction, LoggerLevel, isEqual, get, cloneDeep, isObject } from "@visactor/vutils";
86
86
 
87
87
  import { InstanceManager } from "./instance-manager";
88
88
 
@@ -314,6 +314,7 @@ export class VChart {
314
314
  }
315
315
  updateCustomConfigAndRerender(updateSpecResult, sync, option = {}) {
316
316
  if (!this._isReleased && updateSpecResult) return isFunction(updateSpecResult) && (updateSpecResult = updateSpecResult()),
317
+ updateSpecResult.reAnimate && (this.stopAnimation(), this._updateAnimateState(!0)),
317
318
  this._reCompile(updateSpecResult), sync ? this._renderSync(option) : this._renderAsync(option);
318
319
  }
319
320
  _updateCustomConfigAndRecompile(updateSpecResult, option = {}) {
@@ -388,15 +389,18 @@ export class VChart {
388
389
  return this._renderSync(option);
389
390
  }));
390
391
  }
391
- _updateAnimateState() {
392
+ _updateAnimateState(initial) {
392
393
  var _a, _b;
393
- this._option.animation && (null === (_a = this._chart) || void 0 === _a || _a.getAllRegions().forEach((region => {
394
- var _a;
395
- null === (_a = region.animate) || void 0 === _a || _a.updateAnimateState(AnimationStateEnum.update, !0);
396
- })), null === (_b = this._chart) || void 0 === _b || _b.getAllComponents().forEach((component => {
397
- var _a;
398
- null === (_a = component.animate) || void 0 === _a || _a.updateAnimateState(AnimationStateEnum.update, !0);
399
- })));
394
+ if (this._option.animation) {
395
+ const animationState = initial ? AnimationStateEnum.appear : AnimationStateEnum.update;
396
+ null === (_a = this._chart) || void 0 === _a || _a.getAllRegions().forEach((region => {
397
+ var _a;
398
+ null === (_a = region.animate) || void 0 === _a || _a.updateAnimateState(animationState, !0);
399
+ })), null === (_b = this._chart) || void 0 === _b || _b.getAllComponents().forEach((component => {
400
+ var _a;
401
+ null === (_a = component.animate) || void 0 === _a || _a.updateAnimateState(animationState, !0);
402
+ }));
403
+ }
400
404
  }
401
405
  release() {
402
406
  var _a, _b, _c, _d;
@@ -459,9 +463,9 @@ export class VChart {
459
463
  return this.updateFullDataSync(data, reRender);
460
464
  }));
461
465
  }
462
- updateSpec(spec, forceMerge = !1, morphConfig) {
466
+ updateSpec(spec, forceMerge = !1, morphConfig, userUpdateOptions) {
463
467
  return __awaiter(this, void 0, void 0, (function*() {
464
- const result = this._updateSpec(spec, forceMerge);
468
+ const result = this._updateSpec(spec, forceMerge, userUpdateOptions);
465
469
  return result ? (yield this.updateCustomConfigAndRerender(result, !1, {
466
470
  morphConfig: morphConfig,
467
471
  transformSpec: result.reTransformSpec,
@@ -469,8 +473,8 @@ export class VChart {
469
473
  }), this) : this;
470
474
  }));
471
475
  }
472
- updateSpecSync(spec, forceMerge = !1, morphConfig) {
473
- const result = this._updateSpec(spec, forceMerge);
476
+ updateSpecSync(spec, forceMerge = !1, morphConfig, userUpdateOptions) {
477
+ const result = this._updateSpec(spec, forceMerge, userUpdateOptions);
474
478
  return result ? (this.updateCustomConfigAndRerender(result, !0, {
475
479
  morphConfig: morphConfig,
476
480
  transformSpec: result.reTransformSpec,
@@ -483,26 +487,29 @@ export class VChart {
483
487
  actionSource: "updateSpecAndRecompile"
484
488
  }, option));
485
489
  }
486
- _updateSpec(spec, forceMerge = !1) {
490
+ _updateSpec(spec, forceMerge = !1, userUpdateOptions) {
487
491
  var _a, _b;
488
492
  const lastSpec = this._spec;
489
493
  if (!this._setNewSpec(spec, forceMerge)) return;
490
494
  isEqual(lastSpec.theme, this._spec.theme) || this._setCurrentTheme();
491
495
  const reSize = this._shouldChartResize(lastSpec);
492
- return null === (_b = null === (_a = this._compiler) || void 0 === _a ? void 0 : _a.getVGrammarView()) || void 0 === _b || _b.updateLayoutTag(),
493
- this._spec.type !== lastSpec.type ? {
496
+ if (null === (_b = null === (_a = this._compiler) || void 0 === _a ? void 0 : _a.getVGrammarView()) || void 0 === _b || _b.updateLayoutTag(),
497
+ this._spec.type !== lastSpec.type) return {
494
498
  reTransformSpec: !0,
495
499
  change: !0,
496
500
  reMake: !0,
497
501
  reCompile: !1,
498
502
  reSize: reSize
499
- } : (this._initChartSpec(this._spec, "render"), mergeUpdateResult(this._chart.updateSpec(this._spec), {
503
+ };
504
+ this._initChartSpec(this._spec, "render");
505
+ const res = mergeUpdateResult(this._chart.updateSpec(this._spec), {
500
506
  reTransformSpec: !1,
501
507
  change: reSize,
502
508
  reMake: !1,
503
509
  reCompile: !1,
504
510
  reSize: reSize
505
- }));
511
+ });
512
+ return userUpdateOptions ? Object.assign(Object.assign({}, res), userUpdateOptions) : res;
506
513
  }
507
514
  updateModelSpec(filter, spec, forceMerge = !1, morphConfig) {
508
515
  return __awaiter(this, void 0, void 0, (function*() {
@@ -621,7 +628,7 @@ export class VChart {
621
628
  this._autoSize !== lasAutoSize && (resize = !0), resize;
622
629
  }
623
630
  _getBackground() {
624
- return ("string" == typeof this._spec.background ? this._spec.background : null) || this._currentTheme.background || this._option.background;
631
+ return ("string" == typeof this._spec.background || isObject(this._spec.background) && this._spec.background.gradient ? this._spec.background : null) || this._currentTheme.background || this._option.background;
625
632
  }
626
633
  getCurrentTheme() {
627
634
  return getThemeObject(this._currentThemeName);