@visactor/vchart 2.1.2-alpha.9 → 2.1.3-alpha.0
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.es.js +67 -237
- package/build/index.js +92 -40
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/animation/callback-disappear.d.ts +1 -1
- package/cjs/animation/callback-disappear.js.map +1 -1
- package/cjs/core/factory-registry.d.ts +69 -0
- package/cjs/core/factory-registry.js +39 -0
- package/cjs/core/factory-registry.js.map +1 -0
- package/cjs/core/factory.js +20 -19
- package/cjs/core/factory.js.map +1 -1
- package/cjs/mark/base/base-mark.d.ts +1 -0
- package/cjs/mark/base/base-mark.js +9 -1
- package/cjs/mark/base/base-mark.js.map +1 -1
- package/cjs/mark/group.js +2 -1
- package/cjs/mark/group.js.map +1 -1
- package/esm/animation/callback-disappear.d.ts +1 -1
- package/esm/animation/callback-disappear.js.map +1 -1
- package/esm/core/factory-registry.d.ts +69 -0
- package/esm/core/factory-registry.js +33 -0
- package/esm/core/factory-registry.js.map +1 -0
- package/esm/core/factory.js +16 -19
- package/esm/core/factory.js.map +1 -1
- package/esm/mark/base/base-mark.d.ts +1 -0
- package/esm/mark/base/base-mark.js +9 -1
- package/esm/mark/base/base-mark.js.map +1 -1
- package/esm/mark/group.js +2 -1
- package/esm/mark/group.js.map +1 -1
- package/package.json +9 -9
package/build/index.js
CHANGED
|
@@ -19958,14 +19958,14 @@
|
|
|
19958
19958
|
get dpr() {
|
|
19959
19959
|
return this._handler.getDpr();
|
|
19960
19960
|
}
|
|
19961
|
-
constructor(
|
|
19961
|
+
constructor(vRenderGlobal = application.global, handlerFactory = defaultWindowHandlerFactory) {
|
|
19962
19962
|
super(), this.handlerFactory = handlerFactory, this.hooks = {
|
|
19963
19963
|
onChange: new SyncHook(["x", "y", "width", "height"])
|
|
19964
19964
|
}, this.active = () => {
|
|
19965
|
-
const
|
|
19966
|
-
if (!
|
|
19967
|
-
this.handlerFactory(
|
|
19968
|
-
}, this._uid = Generator.GenAutoIncrementId(), this.global =
|
|
19965
|
+
const vRenderGlobal = this.global;
|
|
19966
|
+
if (!vRenderGlobal.env || this.actived) return;
|
|
19967
|
+
this.handlerFactory(vRenderGlobal.env).configure(this, vRenderGlobal), this.actived = !0;
|
|
19968
|
+
}, this._uid = Generator.GenAutoIncrementId(), this.global = vRenderGlobal, this.postInit();
|
|
19969
19969
|
}
|
|
19970
19970
|
_nativeAddEventListener(type, listener, options) {
|
|
19971
19971
|
return this._handler.addEventListener(type, listener, options);
|
|
@@ -30717,6 +30717,37 @@
|
|
|
30717
30717
|
});
|
|
30718
30718
|
}
|
|
30719
30719
|
|
|
30720
|
+
const factoryRegistry = {
|
|
30721
|
+
charts: {},
|
|
30722
|
+
series: {},
|
|
30723
|
+
components: {},
|
|
30724
|
+
graphicComponents: {},
|
|
30725
|
+
marks: {},
|
|
30726
|
+
regions: {},
|
|
30727
|
+
animations: {},
|
|
30728
|
+
implements: {},
|
|
30729
|
+
chartPlugin: {},
|
|
30730
|
+
vChartPlugin: {},
|
|
30731
|
+
componentPlugin: {},
|
|
30732
|
+
transforms: {
|
|
30733
|
+
fields,
|
|
30734
|
+
filter,
|
|
30735
|
+
fold
|
|
30736
|
+
},
|
|
30737
|
+
dataParser: {
|
|
30738
|
+
csv: csvParser,
|
|
30739
|
+
dsv: dsvParser,
|
|
30740
|
+
tsv: tsvParser
|
|
30741
|
+
},
|
|
30742
|
+
layout: {},
|
|
30743
|
+
grammarTransforms: {},
|
|
30744
|
+
stageEventPlugins: {},
|
|
30745
|
+
interactionTriggers: {},
|
|
30746
|
+
composedEventMap: {},
|
|
30747
|
+
tooltipProcessors: {},
|
|
30748
|
+
formatter: undefined
|
|
30749
|
+
};
|
|
30750
|
+
|
|
30720
30751
|
class Factory {
|
|
30721
30752
|
static registerChart(key, chart) {
|
|
30722
30753
|
Factory._charts[key] = chart;
|
|
@@ -30894,9 +30925,11 @@
|
|
|
30894
30925
|
}
|
|
30895
30926
|
static registerFormatter(func) {
|
|
30896
30927
|
this._formatter = func;
|
|
30928
|
+
factoryRegistry.formatter = func;
|
|
30897
30929
|
}
|
|
30898
30930
|
static getFormatter() {
|
|
30899
|
-
|
|
30931
|
+
var _a;
|
|
30932
|
+
return (_a = factoryRegistry.formatter) !== null && _a !== void 0 ? _a : this._formatter;
|
|
30900
30933
|
}
|
|
30901
30934
|
static createInteractionTrigger(interactionType, options) {
|
|
30902
30935
|
const Ctor = Factory._interactionTriggers[interactionType];
|
|
@@ -30912,45 +30945,37 @@
|
|
|
30912
30945
|
return Factory._composedEventMap[eType];
|
|
30913
30946
|
}
|
|
30914
30947
|
}
|
|
30915
|
-
Factory._charts =
|
|
30916
|
-
Factory._series =
|
|
30917
|
-
Factory._components =
|
|
30918
|
-
Factory._graphicComponents =
|
|
30919
|
-
Factory._marks =
|
|
30920
|
-
Factory._regions =
|
|
30921
|
-
Factory._animations =
|
|
30922
|
-
Factory._implements =
|
|
30923
|
-
Factory._chartPlugin =
|
|
30924
|
-
Factory._vChartPlugin =
|
|
30925
|
-
Factory._componentPlugin =
|
|
30926
|
-
Factory.transforms =
|
|
30927
|
-
|
|
30928
|
-
|
|
30929
|
-
|
|
30930
|
-
|
|
30931
|
-
Factory.dataParser = {
|
|
30932
|
-
csv: csvParser,
|
|
30933
|
-
dsv: dsvParser,
|
|
30934
|
-
tsv: tsvParser
|
|
30935
|
-
};
|
|
30936
|
-
Factory._layout = {};
|
|
30937
|
-
Factory._grammarTransforms = {};
|
|
30938
|
-
Factory._stageEventPlugins = {};
|
|
30948
|
+
Factory._charts = factoryRegistry.charts;
|
|
30949
|
+
Factory._series = factoryRegistry.series;
|
|
30950
|
+
Factory._components = factoryRegistry.components;
|
|
30951
|
+
Factory._graphicComponents = factoryRegistry.graphicComponents;
|
|
30952
|
+
Factory._marks = factoryRegistry.marks;
|
|
30953
|
+
Factory._regions = factoryRegistry.regions;
|
|
30954
|
+
Factory._animations = factoryRegistry.animations;
|
|
30955
|
+
Factory._implements = factoryRegistry.implements;
|
|
30956
|
+
Factory._chartPlugin = factoryRegistry.chartPlugin;
|
|
30957
|
+
Factory._vChartPlugin = factoryRegistry.vChartPlugin;
|
|
30958
|
+
Factory._componentPlugin = factoryRegistry.componentPlugin;
|
|
30959
|
+
Factory.transforms = factoryRegistry.transforms;
|
|
30960
|
+
Factory.dataParser = factoryRegistry.dataParser;
|
|
30961
|
+
Factory._layout = factoryRegistry.layout;
|
|
30962
|
+
Factory._grammarTransforms = factoryRegistry.grammarTransforms;
|
|
30963
|
+
Factory._stageEventPlugins = factoryRegistry.stageEventPlugins;
|
|
30939
30964
|
Factory.registerStageEventPlugin = (type, Plugin) => {
|
|
30940
30965
|
Factory._stageEventPlugins[type] = Plugin;
|
|
30941
30966
|
};
|
|
30942
30967
|
Factory.getStageEventPlugin = (type) => {
|
|
30943
30968
|
return Factory._stageEventPlugins[type];
|
|
30944
30969
|
};
|
|
30945
|
-
Factory._interactionTriggers =
|
|
30970
|
+
Factory._interactionTriggers = factoryRegistry.interactionTriggers;
|
|
30946
30971
|
Factory.registerInteractionTrigger = (interactionType, interaction) => {
|
|
30947
30972
|
Factory._interactionTriggers[interactionType] = interaction;
|
|
30948
30973
|
};
|
|
30949
|
-
Factory._composedEventMap =
|
|
30974
|
+
Factory._composedEventMap = factoryRegistry.composedEventMap;
|
|
30950
30975
|
Factory.registerComposedEvent = (eType, composedEvent) => {
|
|
30951
30976
|
Factory._composedEventMap[eType] = composedEvent;
|
|
30952
30977
|
};
|
|
30953
|
-
Factory._tooltipProcessors =
|
|
30978
|
+
Factory._tooltipProcessors = factoryRegistry.tooltipProcessors;
|
|
30954
30979
|
Factory.registerTooltipProcessor = (type, processor) => {
|
|
30955
30980
|
Factory._tooltipProcessors[type] = processor;
|
|
30956
30981
|
};
|
|
@@ -34250,7 +34275,8 @@
|
|
|
34250
34275
|
params.canvas ? this.createWindowByCanvas(params) : this.createWindowByConfig(params), this.postInit();
|
|
34251
34276
|
}
|
|
34252
34277
|
postInit() {
|
|
34253
|
-
|
|
34278
|
+
var _a;
|
|
34279
|
+
if (null === (_a = this.global) || void 0 === _a ? void 0 : _a.optimizeVisible) try {
|
|
34254
34280
|
this.observerCanvas();
|
|
34255
34281
|
} catch (err) {
|
|
34256
34282
|
console.error("发生错误,该环境不存在IntersectionObserver");
|
|
@@ -34291,10 +34317,10 @@
|
|
|
34291
34317
|
this.canvas = new BrowserCanvas(options);
|
|
34292
34318
|
}
|
|
34293
34319
|
createWindowByCanvas(params) {
|
|
34294
|
-
var _a, _b;
|
|
34320
|
+
var _a, _b, _c;
|
|
34295
34321
|
let canvas;
|
|
34296
34322
|
if ("string" == typeof params.canvas) {
|
|
34297
|
-
if (canvas = this.global.getElementById(params.canvas), canvas || "undefined" == typeof document || (canvas = document.getElementById(params.canvas)), !canvas) throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom");
|
|
34323
|
+
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");
|
|
34298
34324
|
} else canvas = params.canvas;
|
|
34299
34325
|
if (!canvas) throw new Error("发生错误,传入的canvas不正确");
|
|
34300
34326
|
let width = params.width,
|
|
@@ -34305,14 +34331,14 @@
|
|
|
34305
34331
|
}
|
|
34306
34332
|
let dpr = params.dpr;
|
|
34307
34333
|
if (null == dpr) {
|
|
34308
|
-
dpr = null !== (
|
|
34334
|
+
dpr = null !== (_b = canvas.getContext("2d").pixelRatio) && void 0 !== _b ? _b : canvas.width / width;
|
|
34309
34335
|
}
|
|
34310
34336
|
this.canvas = new BrowserCanvas({
|
|
34311
34337
|
width: width,
|
|
34312
34338
|
height: height,
|
|
34313
34339
|
dpr: dpr,
|
|
34314
34340
|
nativeCanvas: canvas,
|
|
34315
|
-
canvasControled: null !== (
|
|
34341
|
+
canvasControled: null !== (_c = params.canvasControled) && void 0 !== _c && _c
|
|
34316
34342
|
});
|
|
34317
34343
|
}
|
|
34318
34344
|
releaseWindow() {
|
|
@@ -41634,6 +41660,20 @@
|
|
|
41634
41660
|
_hasDiffAttrs(g) {
|
|
41635
41661
|
return !!g.context.diffAttrs && Object.keys(g.context.diffAttrs).length > 0;
|
|
41636
41662
|
}
|
|
41663
|
+
_commitPreventedAnimationStaticAttrs(g, attrs) {
|
|
41664
|
+
var _a, _b;
|
|
41665
|
+
if (!attrs || !Object.keys(attrs).length) {
|
|
41666
|
+
return;
|
|
41667
|
+
}
|
|
41668
|
+
const graphic = g;
|
|
41669
|
+
(_a = graphic.setFinalAttributes) === null || _a === void 0 ? void 0 : _a.call(graphic, attrs);
|
|
41670
|
+
if (graphic._commitAnimationStaticAttributes) {
|
|
41671
|
+
graphic._commitAnimationStaticAttributes(attrs);
|
|
41672
|
+
}
|
|
41673
|
+
else {
|
|
41674
|
+
(_b = graphic.commitInternalBaseAttributes) === null || _b === void 0 ? void 0 : _b.call(graphic, attrs);
|
|
41675
|
+
}
|
|
41676
|
+
}
|
|
41637
41677
|
_runApplyGraphic(graphics) {
|
|
41638
41678
|
const hasAnimation = this.hasAnimation();
|
|
41639
41679
|
graphics.forEach((g, index) => {
|
|
@@ -41671,7 +41711,13 @@
|
|
|
41671
41711
|
g.context.reusing = false;
|
|
41672
41712
|
}
|
|
41673
41713
|
else if (!hasStateAnimation) {
|
|
41674
|
-
|
|
41714
|
+
if (hasAnimation) {
|
|
41715
|
+
g.setAttributesAndPreventAnimate(diffAttrs);
|
|
41716
|
+
this._commitPreventedAnimationStaticAttrs(g, diffAttrs);
|
|
41717
|
+
}
|
|
41718
|
+
else {
|
|
41719
|
+
g.setAttributes(diffAttrs);
|
|
41720
|
+
}
|
|
41675
41721
|
}
|
|
41676
41722
|
if (!((_b = this.renderContext) === null || _b === void 0 ? void 0 : _b.progressive) && this._product && g.parent !== this._product) {
|
|
41677
41723
|
this._product.appendChild(g);
|
|
@@ -42147,7 +42193,13 @@
|
|
|
42147
42193
|
const diffAttrs = getDiffAttributesOfGraphic(this._product, newAttrs);
|
|
42148
42194
|
this._product.context.diffAttrs = diffAttrs;
|
|
42149
42195
|
if (!this.hasAnimationByState(this._product.context.animationState)) {
|
|
42150
|
-
|
|
42196
|
+
if (hasAnimation) {
|
|
42197
|
+
this._product.setAttributesAndPreventAnimate(diffAttrs);
|
|
42198
|
+
this._commitPreventedAnimationStaticAttrs(this._product, diffAttrs);
|
|
42199
|
+
}
|
|
42200
|
+
else {
|
|
42201
|
+
this._product.setAttributes(diffAttrs);
|
|
42202
|
+
}
|
|
42151
42203
|
}
|
|
42152
42204
|
}
|
|
42153
42205
|
else {
|