@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.
- package/build/es5/index.js +1 -1
- package/build/index.js +108 -73
- package/build/index.min.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/animation/config.js +4 -1
- package/cjs/animation/config.js.map +1 -1
- package/cjs/chart/base/base-chart.js +6 -4
- package/cjs/chart/base/base-chart.js.map +1 -1
- package/cjs/chart/stack.js +1 -2
- package/cjs/compile/grammar-item.js +2 -1
- package/cjs/component/tooltip/interface/theme.d.ts +2 -2
- package/cjs/component/tooltip/interface/theme.js.map +1 -1
- package/cjs/core/index.d.ts +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/index.js.map +1 -1
- package/cjs/core/interface.d.ts +3 -2
- package/cjs/core/interface.js.map +1 -1
- package/cjs/core/vchart.d.ts +2 -2
- package/cjs/core/vchart.js +25 -18
- package/cjs/core/vchart.js.map +1 -1
- package/cjs/layout/layout-item.d.ts +1 -1
- package/cjs/model/interface.d.ts +1 -0
- package/cjs/model/interface.js.map +1 -1
- package/cjs/series/base/base-series.js +6 -6
- package/cjs/series/base/base-series.js.map +1 -1
- package/cjs/series/base/constant.d.ts +6 -0
- package/cjs/series/base/constant.js +12 -2
- package/cjs/series/base/constant.js.map +1 -1
- package/cjs/series/line/animation.js +7 -4
- package/cjs/series/line/animation.js.map +1 -1
- package/cjs/series/polar/animation.js +12 -3
- package/cjs/series/polar/animation.js.map +1 -1
- package/cjs/series/rose/animation.js +8 -2
- package/cjs/series/rose/animation.js.map +1 -1
- package/cjs/theme/interface.d.ts +2 -2
- package/cjs/theme/interface.js.map +1 -1
- package/cjs/typings/spec/common.d.ts +2 -2
- package/cjs/typings/spec/common.js.map +1 -1
- package/cjs/typings/visual.d.ts +2 -2
- package/cjs/typings/visual.js.map +1 -1
- package/cjs/util/spec/index.d.ts +0 -1
- package/cjs/util/spec/index.js +1 -1
- package/cjs/util/spec/index.js.map +1 -1
- package/esm/animation/config.js +4 -1
- package/esm/animation/config.js.map +1 -1
- package/esm/chart/base/base-chart.js +8 -6
- package/esm/chart/base/base-chart.js.map +1 -1
- package/esm/chart/stack.js +1 -2
- package/esm/compile/grammar-item.js +2 -1
- package/esm/component/tooltip/interface/theme.d.ts +2 -2
- package/esm/component/tooltip/interface/theme.js.map +1 -1
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/index.js.map +1 -1
- package/esm/core/interface.d.ts +3 -2
- package/esm/core/interface.js.map +1 -1
- package/esm/core/vchart.d.ts +2 -2
- package/esm/core/vchart.js +26 -19
- package/esm/core/vchart.js.map +1 -1
- package/esm/layout/layout-item.d.ts +1 -1
- package/esm/model/interface.d.ts +1 -0
- package/esm/model/interface.js.map +1 -1
- package/esm/series/base/base-series.js +7 -6
- package/esm/series/base/base-series.js.map +1 -1
- package/esm/series/base/constant.d.ts +6 -0
- package/esm/series/base/constant.js +13 -0
- package/esm/series/base/constant.js.map +1 -1
- package/esm/series/line/animation.js +7 -4
- package/esm/series/line/animation.js.map +1 -1
- package/esm/series/polar/animation.js +10 -4
- package/esm/series/polar/animation.js.map +1 -1
- package/esm/series/rose/animation.js +8 -2
- package/esm/series/rose/animation.js.map +1 -1
- package/esm/theme/interface.d.ts +2 -2
- package/esm/theme/interface.js.map +1 -1
- package/esm/typings/spec/common.d.ts +2 -2
- package/esm/typings/spec/common.js.map +1 -1
- package/esm/typings/visual.d.ts +2 -2
- package/esm/typings/visual.js.map +1 -1
- package/esm/util/spec/index.d.ts +0 -1
- package/esm/util/spec/index.js +0 -2
- package/esm/util/spec/index.js.map +1 -1
- package/package.json +13 -13
- package/cjs/util/spec/background.d.ts +0 -4
- package/cjs/util/spec/background.js +0 -21
- package/cjs/util/spec/background.js.map +0 -1
- package/esm/util/spec/background.d.ts +0 -4
- package/esm/util/spec/background.js +0 -13
- package/esm/util/spec/background.js.map +0 -1
package/esm/core/vchart.js
CHANGED
|
@@ -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
|
|
394
|
-
|
|
395
|
-
null === (_a =
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
null === (
|
|
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
|
-
|
|
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
|
-
}
|
|
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);
|