@visactor/react-vchart 2.1.2-alpha.8 → 2.1.2
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/index.js +20 -13
- package/build/index.min.js +2 -2
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- 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(
|
|
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
|
|
18654
|
-
if (!
|
|
18655
|
-
this.handlerFactory(
|
|
18656
|
-
}, this._uid = Generator.GenAutoIncrementId(), this.global =
|
|
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);
|
|
@@ -33731,7 +33731,8 @@
|
|
|
33731
33731
|
params.canvas ? this.createWindowByCanvas(params) : this.createWindowByConfig(params), this.postInit();
|
|
33732
33732
|
}
|
|
33733
33733
|
postInit() {
|
|
33734
|
-
|
|
33734
|
+
var _a;
|
|
33735
|
+
if (null === (_a = this.global) || void 0 === _a ? void 0 : _a.optimizeVisible) try {
|
|
33735
33736
|
this.observerCanvas();
|
|
33736
33737
|
} catch (err) {
|
|
33737
33738
|
console.error("发生错误,该环境不存在IntersectionObserver");
|
|
@@ -33772,10 +33773,10 @@
|
|
|
33772
33773
|
this.canvas = new BrowserCanvas(options);
|
|
33773
33774
|
}
|
|
33774
33775
|
createWindowByCanvas(params) {
|
|
33775
|
-
var _a, _b;
|
|
33776
|
+
var _a, _b, _c;
|
|
33776
33777
|
let canvas;
|
|
33777
33778
|
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");
|
|
33779
|
+
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
33780
|
} else canvas = params.canvas;
|
|
33780
33781
|
if (!canvas) throw new Error("发生错误,传入的canvas不正确");
|
|
33781
33782
|
let width = params.width,
|
|
@@ -33786,14 +33787,14 @@
|
|
|
33786
33787
|
}
|
|
33787
33788
|
let dpr = params.dpr;
|
|
33788
33789
|
if (null == dpr) {
|
|
33789
|
-
dpr = null !== (
|
|
33790
|
+
dpr = null !== (_b = canvas.getContext("2d").pixelRatio) && void 0 !== _b ? _b : canvas.width / width;
|
|
33790
33791
|
}
|
|
33791
33792
|
this.canvas = new BrowserCanvas({
|
|
33792
33793
|
width: width,
|
|
33793
33794
|
height: height,
|
|
33794
33795
|
dpr: dpr,
|
|
33795
33796
|
nativeCanvas: canvas,
|
|
33796
|
-
canvasControled: null !== (
|
|
33797
|
+
canvasControled: null !== (_c = params.canvasControled) && void 0 !== _c && _c
|
|
33797
33798
|
});
|
|
33798
33799
|
}
|
|
33799
33800
|
releaseWindow() {
|
|
@@ -47244,6 +47245,12 @@
|
|
|
47244
47245
|
_hasDiffAttrs(g) {
|
|
47245
47246
|
return !!g.context.diffAttrs && Object.keys(g.context.diffAttrs).length > 0;
|
|
47246
47247
|
}
|
|
47248
|
+
_commitPreventedAnimationStaticAttrs(g, attrs) {
|
|
47249
|
+
var _a, _b;
|
|
47250
|
+
if (!attrs || !Object.keys(attrs).length) return;
|
|
47251
|
+
const graphic = g;
|
|
47252
|
+
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);
|
|
47253
|
+
}
|
|
47247
47254
|
_runApplyGraphic(graphics) {
|
|
47248
47255
|
const hasAnimation = this.hasAnimation();
|
|
47249
47256
|
graphics.forEach((g, index) => {
|
|
@@ -47252,7 +47259,7 @@
|
|
|
47252
47259
|
hasStateAnimation = this.hasAnimationByState(g.context.animationState);
|
|
47253
47260
|
if (g.setAttributes) {
|
|
47254
47261
|
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);
|
|
47262
|
+
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
47263
|
} else {
|
|
47257
47264
|
const mockGraphic = g;
|
|
47258
47265
|
(g = this._createGraphic(finalAttrs)).context = mockGraphic.context, g.context.diffAttrs = finalAttrs, g.stateSort = this._stateSort;
|
|
@@ -47555,7 +47562,7 @@
|
|
|
47555
47562
|
if (this._product.context.finalAttrs = newAttrs, this._product.context.diffState === DiffState.update) {
|
|
47556
47563
|
const hasAnimation = this.hasAnimation(),
|
|
47557
47564
|
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));
|
|
47565
|
+
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
47566
|
} else this._product.setAttributes(newAttrs);
|
|
47560
47567
|
this.needClear = !0;
|
|
47561
47568
|
}
|
|
@@ -100913,7 +100920,7 @@
|
|
|
100913
100920
|
|
|
100914
100921
|
const VChartSimple = createChart('VChartSimple');
|
|
100915
100922
|
|
|
100916
|
-
const version = "2.1.
|
|
100923
|
+
const version = "2.1.2";
|
|
100917
100924
|
|
|
100918
100925
|
exports.Area = Area;
|
|
100919
100926
|
exports.AreaChart = AreaChart;
|