@visactor/react-vchart 2.0.20 → 2.0.22-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/index.js +50 -31
- package/build/index.min.js +3 -3
- 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 +12 -7
package/build/index.js
CHANGED
|
@@ -14565,6 +14565,7 @@
|
|
|
14565
14565
|
const tempConstantXYKey = ["x", "y"],
|
|
14566
14566
|
tempConstantScaleXYKey = ["scaleX", "scaleY"],
|
|
14567
14567
|
tempConstantAngleKey = ["angle"],
|
|
14568
|
+
builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
|
|
14568
14569
|
point = new Point();
|
|
14569
14570
|
const NOWORK_ANIMATE_ATTR = {
|
|
14570
14571
|
strokeSeg: 1,
|
|
@@ -14621,7 +14622,7 @@
|
|
|
14621
14622
|
}
|
|
14622
14623
|
constructor(params = {}) {
|
|
14623
14624
|
var _a;
|
|
14624
|
-
super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background
|
|
14625
|
+
super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background && this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0), isExternalTexture(params.texture) ? this.loadImage(params.texture, !1) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
|
|
14625
14626
|
}
|
|
14626
14627
|
getGraphicService() {
|
|
14627
14628
|
var _a, _b;
|
|
@@ -14810,7 +14811,7 @@
|
|
|
14810
14811
|
});
|
|
14811
14812
|
}
|
|
14812
14813
|
setAttributes(params, forceUpdateTag = !1, context) {
|
|
14813
|
-
params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background
|
|
14814
|
+
params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background && this.loadImage(params.background, !0), isExternalTexture(params.texture) ? this.loadImage(params.texture, !1) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
|
|
14814
14815
|
}
|
|
14815
14816
|
_setAttributes(params, forceUpdateTag = !1, context) {
|
|
14816
14817
|
const keys = Object.keys(params);
|
|
@@ -14825,7 +14826,7 @@
|
|
|
14825
14826
|
const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
|
|
14826
14827
|
[key]: value
|
|
14827
14828
|
}, this.attribute, key, context);
|
|
14828
|
-
params ? this._setAttributes(params, forceUpdateTag, context) : isNil$1(null === (_a = this.normalAttrs) || void 0 === _a ? void 0 : _a[key]) ? (this.attribute[key] = value, this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag(), this.onAttributeUpdate(context)) : this.normalAttrs[key] = value, "background" === key ? this.loadImage(value, !0) : "shadowGraphic" === key && this.setShadowGraphic(value);
|
|
14829
|
+
params ? this._setAttributes(params, forceUpdateTag, context) : isNil$1(null === (_a = this.normalAttrs) || void 0 === _a ? void 0 : _a[key]) ? (this.attribute[key] = value, this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag(), this.onAttributeUpdate(context)) : this.normalAttrs[key] = value, "background" === key ? this.loadImage(value, !0) : "texture" === key && isExternalTexture(value) ? this.loadImage(value, !1) : "shadowGraphic" === key && this.setShadowGraphic(value);
|
|
14829
14830
|
}
|
|
14830
14831
|
needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
|
|
14831
14832
|
for (let i = 0; i < k.length; i++) {
|
|
@@ -14844,7 +14845,7 @@
|
|
|
14844
14845
|
const context = {
|
|
14845
14846
|
type: AttributeUpdateType.INIT
|
|
14846
14847
|
};
|
|
14847
|
-
params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background
|
|
14848
|
+
params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background && this.loadImage(params.background, !0), isExternalTexture(params.texture) ? this.loadImage(params.texture, !1) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._updateTag = UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
|
|
14848
14849
|
}
|
|
14849
14850
|
translate(x, y) {
|
|
14850
14851
|
var _a, _b;
|
|
@@ -15234,6 +15235,9 @@
|
|
|
15234
15235
|
function backgroundNotImage(image) {
|
|
15235
15236
|
return !(!image.fill && !image.stroke);
|
|
15236
15237
|
}
|
|
15238
|
+
function isExternalTexture(texture) {
|
|
15239
|
+
return !!texture && ("string" == typeof texture ? !builtinTextureTypes.has(texture) && (texture.startsWith("<svg") || isValidUrl$1(texture) || texture.includes("/") || isBase64$1(texture)) : isObject$2(texture));
|
|
15240
|
+
}
|
|
15237
15241
|
Graphic.userSymbolMap = {}, Graphic.mixin(EventTarget);
|
|
15238
15242
|
|
|
15239
15243
|
var GroupUpdateAABBBoundsMode;
|
|
@@ -18900,33 +18904,37 @@
|
|
|
18900
18904
|
textureRatio = graphicAttribute.textureRatio,
|
|
18901
18905
|
textureOptions = null
|
|
18902
18906
|
} = graphic.attribute;
|
|
18903
|
-
let pattern =
|
|
18904
|
-
|
|
18905
|
-
|
|
18906
|
-
|
|
18907
|
-
|
|
18908
|
-
|
|
18909
|
-
|
|
18910
|
-
|
|
18911
|
-
|
|
18912
|
-
|
|
18913
|
-
|
|
18914
|
-
|
|
18915
|
-
|
|
18916
|
-
|
|
18917
|
-
|
|
18918
|
-
|
|
18919
|
-
|
|
18920
|
-
|
|
18921
|
-
|
|
18922
|
-
|
|
18923
|
-
|
|
18924
|
-
|
|
18925
|
-
|
|
18926
|
-
|
|
18927
|
-
|
|
18907
|
+
let pattern = null;
|
|
18908
|
+
const patternKey = this.getPatternCacheKey(texture, textureSize, texturePadding, textureColor, context.dpr);
|
|
18909
|
+
if (null !== patternKey && (pattern = this.textureMap.get(patternKey)), !pattern) {
|
|
18910
|
+
if ("string" == typeof texture) switch (texture) {
|
|
18911
|
+
case "circle":
|
|
18912
|
+
pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
|
|
18913
|
+
break;
|
|
18914
|
+
case "diamond":
|
|
18915
|
+
pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
|
|
18916
|
+
break;
|
|
18917
|
+
case "rect":
|
|
18918
|
+
pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
|
|
18919
|
+
break;
|
|
18920
|
+
case "vertical-line":
|
|
18921
|
+
pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
|
|
18922
|
+
break;
|
|
18923
|
+
case "horizontal-line":
|
|
18924
|
+
pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
|
|
18925
|
+
break;
|
|
18926
|
+
case "bias-lr":
|
|
18927
|
+
pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
|
|
18928
|
+
break;
|
|
18929
|
+
case "bias-rl":
|
|
18930
|
+
pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
|
|
18931
|
+
break;
|
|
18932
|
+
case "grid":
|
|
18933
|
+
pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
|
|
18934
|
+
}
|
|
18935
|
+
pattern || (pattern = this.createResourcePattern(texture, graphic, context)), pattern && null !== patternKey && this.textureMap.set(patternKey, pattern);
|
|
18928
18936
|
}
|
|
18929
|
-
if (textureOptions && textureOptions.dynamicTexture) {
|
|
18937
|
+
if ("string" == typeof texture && textureOptions && textureOptions.dynamicTexture) {
|
|
18930
18938
|
const {
|
|
18931
18939
|
gridConfig = {},
|
|
18932
18940
|
useNewCanvas: useNewCanvas
|
|
@@ -18982,6 +18990,17 @@
|
|
|
18982
18990
|
}), x + b.x1 - x, y + b.y1 - y), context.restore();
|
|
18983
18991
|
}
|
|
18984
18992
|
}
|
|
18993
|
+
getPatternCacheKey(texture, textureSize, texturePadding, textureColor, dpr) {
|
|
18994
|
+
return "string" != typeof texture ? texture : "wave" === texture ? null : `${texture}-${textureSize}-${texturePadding}-${textureColor}-${dpr}`;
|
|
18995
|
+
}
|
|
18996
|
+
createResourcePattern(texture, graphic, context) {
|
|
18997
|
+
var _a;
|
|
18998
|
+
const resource = null === (_a = graphic.resources) || void 0 === _a ? void 0 : _a.get(texture),
|
|
18999
|
+
data = "success" === (null == resource ? void 0 : resource.state) ? resource.data : "object" == typeof texture ? texture : null;
|
|
19000
|
+
if (!data) return null;
|
|
19001
|
+
const pattern = context.createPattern(data, "repeat");
|
|
19002
|
+
return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), pattern;
|
|
19003
|
+
}
|
|
18985
19004
|
}
|
|
18986
19005
|
const defaultBaseTextureRenderContribution = new DefaultBaseTextureRenderContribution();
|
|
18987
19006
|
|
|
@@ -88973,7 +88992,7 @@
|
|
|
88973
88992
|
|
|
88974
88993
|
const VChartSimple = createChart('VChartSimple');
|
|
88975
88994
|
|
|
88976
|
-
const version = "2.0.
|
|
88995
|
+
const version = "2.0.21";
|
|
88977
88996
|
|
|
88978
88997
|
exports.Area = Area;
|
|
88979
88998
|
exports.AreaChart = AreaChart;
|