@visactor/react-vchart 2.0.22 → 2.0.23-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 +97 -34
- package/build/index.min.js +3 -3
- package/cjs/components/MarkArea.js +1 -2
- package/cjs/components/ScrollBar.js +2 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/esm/components/MarkArea.js +1 -2
- package/esm/components/ScrollBar.js +2 -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
|
@@ -14571,6 +14571,7 @@
|
|
|
14571
14571
|
const tempConstantXYKey = ["x", "y"],
|
|
14572
14572
|
tempConstantScaleXYKey = ["scaleX", "scaleY"],
|
|
14573
14573
|
tempConstantAngleKey = ["angle"],
|
|
14574
|
+
builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
|
|
14574
14575
|
point = new Point();
|
|
14575
14576
|
const NOWORK_ANIMATE_ATTR = {
|
|
14576
14577
|
strokeSeg: 1,
|
|
@@ -14627,7 +14628,7 @@
|
|
|
14627
14628
|
}
|
|
14628
14629
|
constructor(params = {}) {
|
|
14629
14630
|
var _a;
|
|
14630
|
-
super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background
|
|
14631
|
+
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);
|
|
14631
14632
|
}
|
|
14632
14633
|
getGraphicService() {
|
|
14633
14634
|
var _a, _b;
|
|
@@ -14816,7 +14817,7 @@
|
|
|
14816
14817
|
});
|
|
14817
14818
|
}
|
|
14818
14819
|
setAttributes(params, forceUpdateTag = !1, context) {
|
|
14819
|
-
params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background
|
|
14820
|
+
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));
|
|
14820
14821
|
}
|
|
14821
14822
|
_setAttributes(params, forceUpdateTag = !1, context) {
|
|
14822
14823
|
const keys = Object.keys(params);
|
|
@@ -14831,7 +14832,7 @@
|
|
|
14831
14832
|
const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
|
|
14832
14833
|
[key]: value
|
|
14833
14834
|
}, this.attribute, key, context);
|
|
14834
|
-
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);
|
|
14835
|
+
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);
|
|
14835
14836
|
}
|
|
14836
14837
|
needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
|
|
14837
14838
|
for (let i = 0; i < k.length; i++) {
|
|
@@ -14850,7 +14851,7 @@
|
|
|
14850
14851
|
const context = {
|
|
14851
14852
|
type: AttributeUpdateType.INIT
|
|
14852
14853
|
};
|
|
14853
|
-
params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background
|
|
14854
|
+
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);
|
|
14854
14855
|
}
|
|
14855
14856
|
translate(x, y) {
|
|
14856
14857
|
var _a, _b;
|
|
@@ -15241,6 +15242,9 @@
|
|
|
15241
15242
|
function backgroundNotImage(image) {
|
|
15242
15243
|
return "string" == typeof image ? !(image.startsWith("<svg") || isValidUrl$1(image) || image.includes("/") || isBase64$1(image)) : !(!image.fill && !image.stroke) || !("string" != typeof image.gradient || !Array.isArray(image.stops));
|
|
15243
15244
|
}
|
|
15245
|
+
function isExternalTexture(texture) {
|
|
15246
|
+
return !!texture && ("string" == typeof texture ? !builtinTextureTypes.has(texture) && (texture.startsWith("<svg") || isValidUrl$1(texture) || texture.includes("/") || isBase64$1(texture)) : isObject$2(texture));
|
|
15247
|
+
}
|
|
15244
15248
|
Graphic.userSymbolMap = {}, Graphic.mixin(EventTarget);
|
|
15245
15249
|
|
|
15246
15250
|
var GroupUpdateAABBBoundsMode;
|
|
@@ -18892,6 +18896,7 @@
|
|
|
18892
18896
|
}
|
|
18893
18897
|
const defaultBaseClipRenderAfterContribution = new DefaultBaseClipRenderAfterContribution();
|
|
18894
18898
|
|
|
18899
|
+
const builtinProceduralTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid"]);
|
|
18895
18900
|
function formatRatio(ratio) {
|
|
18896
18901
|
return ratio <= .5 ? 4 * ratio - 1 : -4 * ratio + 3;
|
|
18897
18902
|
}
|
|
@@ -19005,38 +19010,43 @@
|
|
|
19005
19010
|
texture && this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);
|
|
19006
19011
|
}
|
|
19007
19012
|
drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding) {
|
|
19008
|
-
var _a;
|
|
19013
|
+
var _a, _b, _c, _d, _e, _f;
|
|
19009
19014
|
const {
|
|
19010
19015
|
textureRatio = graphicAttribute.textureRatio,
|
|
19011
19016
|
textureOptions = null
|
|
19012
19017
|
} = graphic.attribute;
|
|
19013
|
-
let pattern =
|
|
19014
|
-
|
|
19015
|
-
|
|
19016
|
-
|
|
19017
|
-
|
|
19018
|
-
|
|
19019
|
-
|
|
19020
|
-
|
|
19021
|
-
|
|
19022
|
-
|
|
19023
|
-
|
|
19024
|
-
|
|
19025
|
-
|
|
19026
|
-
|
|
19027
|
-
|
|
19028
|
-
|
|
19029
|
-
|
|
19030
|
-
|
|
19031
|
-
|
|
19032
|
-
|
|
19033
|
-
|
|
19034
|
-
|
|
19035
|
-
|
|
19036
|
-
|
|
19037
|
-
|
|
19018
|
+
let pattern = null;
|
|
19019
|
+
const textureRadius = null !== (_a = null == textureOptions ? void 0 : textureOptions.radius) && void 0 !== _a ? _a : 0,
|
|
19020
|
+
patternKey = this.getPatternCacheKey(texture, textureSize, texturePadding, textureColor, context.dpr, textureRadius);
|
|
19021
|
+
if (null !== patternKey && (pattern = this.textureMap.get(patternKey)), !pattern) {
|
|
19022
|
+
if ("string" == typeof texture) switch (texture) {
|
|
19023
|
+
case "circle":
|
|
19024
|
+
pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
|
|
19025
|
+
break;
|
|
19026
|
+
case "diamond":
|
|
19027
|
+
pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
|
|
19028
|
+
break;
|
|
19029
|
+
case "rect":
|
|
19030
|
+
pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
|
|
19031
|
+
break;
|
|
19032
|
+
case "vertical-line":
|
|
19033
|
+
pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
|
|
19034
|
+
break;
|
|
19035
|
+
case "horizontal-line":
|
|
19036
|
+
pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
|
|
19037
|
+
break;
|
|
19038
|
+
case "bias-lr":
|
|
19039
|
+
pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
|
|
19040
|
+
break;
|
|
19041
|
+
case "bias-rl":
|
|
19042
|
+
pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
|
|
19043
|
+
break;
|
|
19044
|
+
case "grid":
|
|
19045
|
+
pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
|
|
19046
|
+
}
|
|
19047
|
+
pattern || (pattern = this.createResourcePattern(texture, graphic, context, texturePadding, textureRadius)), pattern && null !== patternKey && this.textureMap.set(patternKey, pattern);
|
|
19038
19048
|
}
|
|
19039
|
-
if (textureOptions && textureOptions.dynamicTexture) {
|
|
19049
|
+
if ("string" == typeof texture && textureOptions && textureOptions.dynamicTexture) {
|
|
19040
19050
|
const {
|
|
19041
19051
|
gridConfig = {},
|
|
19042
19052
|
useNewCanvas: useNewCanvas
|
|
@@ -19081,10 +19091,24 @@
|
|
|
19081
19091
|
for (let i = 0; i < gridRows; i++) for (let j = 0; j < gridColumns; j++) {
|
|
19082
19092
|
const _x = x + cellSize / 2 + j * cellSize,
|
|
19083
19093
|
_y = y + cellSize / 2 + i * cellSize;
|
|
19084
|
-
null === (
|
|
19094
|
+
null === (_b = textureOptions.beforeDynamicTexture) || void 0 === _b || _b.call(textureOptions, context, i, j, gridRows, gridColumns, textureRatio, graphic, b.width(), b.height()), context.beginPath(), !1 === parsedPath.draw(context, Math.min(sizeW - gutterColumn, sizeH - gutterRow), _x, _y, 0) && context.closePath(), context.fillStyle = textureColor, textureOptions.dynamicTexture(context, i, j, gridRows, gridColumns, textureRatio, graphic, b.width(), b.height());
|
|
19085
19095
|
}
|
|
19086
19096
|
useNewCanvas && (originalContext.globalAlpha = 1, originalContext.drawImage(newCanvas.nativeCanvas, 0, 0, newCanvas.nativeCanvas.width, newCanvas.nativeCanvas.height, b.x1, b.y1, b.width() * originalContext.dpr, b.height() * originalContext.dpr)), originalContext.restore();
|
|
19087
|
-
} else if (pattern)
|
|
19097
|
+
} else if (pattern) {
|
|
19098
|
+
if (pattern.setTransform) {
|
|
19099
|
+
const alignToGraphic = !!(null == textureOptions ? void 0 : textureOptions.alignToGraphic),
|
|
19100
|
+
alignOffsetX = null !== (_c = null == textureOptions ? void 0 : textureOptions.alignOffsetX) && void 0 !== _c ? _c : 0,
|
|
19101
|
+
alignOffsetY = null !== (_d = null == textureOptions ? void 0 : textureOptions.alignOffsetY) && void 0 !== _d ? _d : 0;
|
|
19102
|
+
let translateX = 0,
|
|
19103
|
+
translateY = 0;
|
|
19104
|
+
if (alignToGraphic) {
|
|
19105
|
+
const m = context.currentMatrix;
|
|
19106
|
+
translateX = (null !== (_e = null == m ? void 0 : m.e) && void 0 !== _e ? _e : 0) + x + alignOffsetX, translateY = (null !== (_f = null == m ? void 0 : m.f) && void 0 !== _f ? _f : 0) + y + alignOffsetY;
|
|
19107
|
+
} else (alignOffsetX || alignOffsetY) && (translateX = alignOffsetX, translateY = alignOffsetY);
|
|
19108
|
+
pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, translateX, translateY]));
|
|
19109
|
+
}
|
|
19110
|
+
context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = pattern, context.fill(), context.highPerformanceRestore();
|
|
19111
|
+
} else if ("wave" === texture) {
|
|
19088
19112
|
context.save(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.clip();
|
|
19089
19113
|
const b = graphic.AABBBounds;
|
|
19090
19114
|
drawWave(context, textureRatio, b.width(), b.height(), Object.assign(Object.assign({}, textureOptions || {}), {
|
|
@@ -19092,6 +19116,45 @@
|
|
|
19092
19116
|
}), x + b.x1 - x, y + b.y1 - y), context.restore();
|
|
19093
19117
|
}
|
|
19094
19118
|
}
|
|
19119
|
+
getPatternCacheKey(texture, textureSize, texturePadding, textureColor, dpr, textureRadius) {
|
|
19120
|
+
return "string" != typeof texture ? texturePadding > 0 || textureRadius > 0 ? null : texture : "wave" === texture ? null : builtinProceduralTextureTypes.has(texture) ? `builtin:${texture}|size:${textureSize}|padding:${texturePadding}|color:${textureColor}|dpr:${dpr}` : `resource:${texture}|padding:${texturePadding}|radius:${textureRadius}|dpr:${dpr}`;
|
|
19121
|
+
}
|
|
19122
|
+
createResourcePattern(texture, graphic, context, texturePadding, textureRadius) {
|
|
19123
|
+
var _a;
|
|
19124
|
+
const resource = null === (_a = graphic.resources) || void 0 === _a ? void 0 : _a.get(texture),
|
|
19125
|
+
data = "success" === (null == resource ? void 0 : resource.state) ? resource.data : "object" == typeof texture ? texture : null;
|
|
19126
|
+
if (!data) return null;
|
|
19127
|
+
if (texturePadding > 0 || textureRadius > 0) {
|
|
19128
|
+
const w = data.naturalWidth || data.width,
|
|
19129
|
+
h = data.naturalHeight || data.height;
|
|
19130
|
+
if (w > 0 && h > 0) {
|
|
19131
|
+
const tileW = w + 2 * texturePadding,
|
|
19132
|
+
tileH = h + 2 * texturePadding,
|
|
19133
|
+
canvas = canvasAllocate.allocate({
|
|
19134
|
+
width: tileW,
|
|
19135
|
+
height: tileH,
|
|
19136
|
+
dpr: context.dpr
|
|
19137
|
+
}),
|
|
19138
|
+
ctx = canvas.getContext("2d");
|
|
19139
|
+
if (ctx) {
|
|
19140
|
+
if (ctx.inuse = !0, ctx.clearMatrix(), ctx.setTransformForCurrent(!0), ctx.clearRect(0, 0, tileW, tileH), textureRadius > 0) {
|
|
19141
|
+
const r = Math.max(0, Math.min(textureRadius, Math.min(w, h) / 2)),
|
|
19142
|
+
x0 = texturePadding,
|
|
19143
|
+
y0 = texturePadding,
|
|
19144
|
+
x1 = x0 + w,
|
|
19145
|
+
y1 = y0 + h;
|
|
19146
|
+
ctx.beginPath(), ctx.moveTo(x0 + r, y0), ctx.lineTo(x1 - r, y0), ctx.quadraticCurveTo(x1, y0, x1, y0 + r), ctx.lineTo(x1, y1 - r), ctx.quadraticCurveTo(x1, y1, x1 - r, y1), ctx.lineTo(x0 + r, y1), ctx.quadraticCurveTo(x0, y1, x0, y1 - r), ctx.lineTo(x0, y0 + r), ctx.quadraticCurveTo(x0, y0, x0 + r, y0), ctx.closePath(), ctx.clip();
|
|
19147
|
+
}
|
|
19148
|
+
ctx.drawImage(data, texturePadding, texturePadding, w, h);
|
|
19149
|
+
const pattern = context.createPattern(canvas.nativeCanvas, "repeat");
|
|
19150
|
+
return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), canvasAllocate.free(canvas), pattern;
|
|
19151
|
+
}
|
|
19152
|
+
canvasAllocate.free(canvas);
|
|
19153
|
+
}
|
|
19154
|
+
}
|
|
19155
|
+
const pattern = context.createPattern(data, "repeat");
|
|
19156
|
+
return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), pattern;
|
|
19157
|
+
}
|
|
19095
19158
|
}
|
|
19096
19159
|
const defaultBaseTextureRenderContribution = new DefaultBaseTextureRenderContribution();
|
|
19097
19160
|
|
|
@@ -89255,7 +89318,7 @@
|
|
|
89255
89318
|
|
|
89256
89319
|
const VChartSimple = createChart('VChartSimple');
|
|
89257
89320
|
|
|
89258
|
-
const version = "2.0.
|
|
89321
|
+
const version = "2.0.21";
|
|
89259
89322
|
|
|
89260
89323
|
exports.Area = Area;
|
|
89261
89324
|
exports.AreaChart = AreaChart;
|