@visactor/react-vchart 2.0.22-alpha.1 → 2.0.22-alpha.3
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 +40 -75
- package/build/index.min.js +3 -3
- package/package.json +7 -7
package/build/index.js
CHANGED
|
@@ -9936,9 +9936,7 @@
|
|
|
9936
9936
|
background: null,
|
|
9937
9937
|
autoAnimateTexture: !1,
|
|
9938
9938
|
textureRatio: 1,
|
|
9939
|
-
textureOptions:
|
|
9940
|
-
alignToGraphic: !0
|
|
9941
|
-
},
|
|
9939
|
+
textureOptions: null,
|
|
9942
9940
|
backgroundOpacity: 1,
|
|
9943
9941
|
backgroundCornerRadius: 0,
|
|
9944
9942
|
texture: null,
|
|
@@ -14573,7 +14571,6 @@
|
|
|
14573
14571
|
const tempConstantXYKey = ["x", "y"],
|
|
14574
14572
|
tempConstantScaleXYKey = ["scaleX", "scaleY"],
|
|
14575
14573
|
tempConstantAngleKey = ["angle"],
|
|
14576
|
-
builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
|
|
14577
14574
|
point = new Point();
|
|
14578
14575
|
const NOWORK_ANIMATE_ATTR = {
|
|
14579
14576
|
strokeSeg: 1,
|
|
@@ -14630,7 +14627,7 @@
|
|
|
14630
14627
|
}
|
|
14631
14628
|
constructor(params = {}) {
|
|
14632
14629
|
var _a;
|
|
14633
|
-
super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background
|
|
14630
|
+
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) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
|
|
14634
14631
|
}
|
|
14635
14632
|
getGraphicService() {
|
|
14636
14633
|
var _a, _b;
|
|
@@ -14819,7 +14816,7 @@
|
|
|
14819
14816
|
});
|
|
14820
14817
|
}
|
|
14821
14818
|
setAttributes(params, forceUpdateTag = !1, context) {
|
|
14822
|
-
params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background
|
|
14819
|
+
params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
|
|
14823
14820
|
}
|
|
14824
14821
|
_setAttributes(params, forceUpdateTag = !1, context) {
|
|
14825
14822
|
const keys = Object.keys(params);
|
|
@@ -14834,7 +14831,7 @@
|
|
|
14834
14831
|
const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
|
|
14835
14832
|
[key]: value
|
|
14836
14833
|
}, this.attribute, key, context);
|
|
14837
|
-
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) : "
|
|
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);
|
|
14838
14835
|
}
|
|
14839
14836
|
needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
|
|
14840
14837
|
for (let i = 0; i < k.length; i++) {
|
|
@@ -14853,7 +14850,7 @@
|
|
|
14853
14850
|
const context = {
|
|
14854
14851
|
type: AttributeUpdateType.INIT
|
|
14855
14852
|
};
|
|
14856
|
-
params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background
|
|
14853
|
+
params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._updateTag = UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
|
|
14857
14854
|
}
|
|
14858
14855
|
translate(x, y) {
|
|
14859
14856
|
var _a, _b;
|
|
@@ -15244,9 +15241,6 @@
|
|
|
15244
15241
|
function backgroundNotImage(image) {
|
|
15245
15242
|
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));
|
|
15246
15243
|
}
|
|
15247
|
-
function isExternalTexture(texture) {
|
|
15248
|
-
return !!texture && ("string" == typeof texture ? !builtinTextureTypes.has(texture) && (texture.startsWith("<svg") || isValidUrl$1(texture) || texture.includes("/") || isBase64$1(texture)) : isObject$2(texture));
|
|
15249
|
-
}
|
|
15250
15244
|
Graphic.userSymbolMap = {}, Graphic.mixin(EventTarget);
|
|
15251
15245
|
|
|
15252
15246
|
var GroupUpdateAABBBoundsMode;
|
|
@@ -19011,42 +19005,38 @@
|
|
|
19011
19005
|
texture && this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);
|
|
19012
19006
|
}
|
|
19013
19007
|
drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding) {
|
|
19014
|
-
var _a
|
|
19008
|
+
var _a;
|
|
19015
19009
|
const {
|
|
19016
19010
|
textureRatio = graphicAttribute.textureRatio,
|
|
19017
19011
|
textureOptions = null
|
|
19018
19012
|
} = graphic.attribute;
|
|
19019
|
-
let pattern =
|
|
19020
|
-
|
|
19021
|
-
|
|
19022
|
-
|
|
19023
|
-
|
|
19024
|
-
|
|
19025
|
-
|
|
19026
|
-
|
|
19027
|
-
|
|
19028
|
-
|
|
19029
|
-
|
|
19030
|
-
|
|
19031
|
-
|
|
19032
|
-
|
|
19033
|
-
|
|
19034
|
-
|
|
19035
|
-
|
|
19036
|
-
|
|
19037
|
-
|
|
19038
|
-
|
|
19039
|
-
|
|
19040
|
-
|
|
19041
|
-
|
|
19042
|
-
|
|
19043
|
-
|
|
19044
|
-
case "grid":
|
|
19045
|
-
pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
|
|
19046
|
-
}
|
|
19047
|
-
pattern || (pattern = this.createResourcePattern(texture, graphic, context)), pattern && null !== patternKey && this.textureMap.set(patternKey, pattern);
|
|
19013
|
+
let pattern = this.textureMap.get(texture);
|
|
19014
|
+
if (!pattern) switch (texture) {
|
|
19015
|
+
case "circle":
|
|
19016
|
+
pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
|
|
19017
|
+
break;
|
|
19018
|
+
case "diamond":
|
|
19019
|
+
pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
|
|
19020
|
+
break;
|
|
19021
|
+
case "rect":
|
|
19022
|
+
pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
|
|
19023
|
+
break;
|
|
19024
|
+
case "vertical-line":
|
|
19025
|
+
pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
|
|
19026
|
+
break;
|
|
19027
|
+
case "horizontal-line":
|
|
19028
|
+
pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
|
|
19029
|
+
break;
|
|
19030
|
+
case "bias-lr":
|
|
19031
|
+
pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
|
|
19032
|
+
break;
|
|
19033
|
+
case "bias-rl":
|
|
19034
|
+
pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
|
|
19035
|
+
break;
|
|
19036
|
+
case "grid":
|
|
19037
|
+
pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
|
|
19048
19038
|
}
|
|
19049
|
-
if (
|
|
19039
|
+
if (textureOptions && textureOptions.dynamicTexture) {
|
|
19050
19040
|
const {
|
|
19051
19041
|
gridConfig = {},
|
|
19052
19042
|
useNewCanvas: useNewCanvas
|
|
@@ -19094,21 +19084,7 @@
|
|
|
19094
19084
|
null === (_a = textureOptions.beforeDynamicTexture) || void 0 === _a || _a.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());
|
|
19095
19085
|
}
|
|
19096
19086
|
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();
|
|
19097
|
-
} else if (pattern) {
|
|
19098
|
-
if (pattern.setTransform) {
|
|
19099
|
-
const alignToGraphic = !!(null == textureOptions ? void 0 : textureOptions.alignToGraphic),
|
|
19100
|
-
alignOffsetX = null !== (_b = null == textureOptions ? void 0 : textureOptions.alignOffsetX) && void 0 !== _b ? _b : 0,
|
|
19101
|
-
alignOffsetY = null !== (_c = null == textureOptions ? void 0 : textureOptions.alignOffsetY) && void 0 !== _c ? _c : 0;
|
|
19102
|
-
let translateX = 0,
|
|
19103
|
-
translateY = 0;
|
|
19104
|
-
if (alignToGraphic) {
|
|
19105
|
-
const m = context.currentMatrix;
|
|
19106
|
-
translateX = (null !== (_d = null == m ? void 0 : m.e) && void 0 !== _d ? _d : 0) + x + alignOffsetX, translateY = (null !== (_e = null == m ? void 0 : m.f) && void 0 !== _e ? _e : 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) {
|
|
19087
|
+
} else if (pattern) context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = pattern, context.fill(), context.highPerformanceRestore();else if ("wave" === texture) {
|
|
19112
19088
|
context.save(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.clip();
|
|
19113
19089
|
const b = graphic.AABBBounds;
|
|
19114
19090
|
drawWave(context, textureRatio, b.width(), b.height(), Object.assign(Object.assign({}, textureOptions || {}), {
|
|
@@ -19116,17 +19092,6 @@
|
|
|
19116
19092
|
}), x + b.x1 - x, y + b.y1 - y), context.restore();
|
|
19117
19093
|
}
|
|
19118
19094
|
}
|
|
19119
|
-
getPatternCacheKey(texture, textureSize, texturePadding, textureColor, dpr) {
|
|
19120
|
-
return "string" != typeof texture ? texture : "wave" === texture ? null : `${texture}-${textureSize}-${texturePadding}-${textureColor}-${dpr}`;
|
|
19121
|
-
}
|
|
19122
|
-
createResourcePattern(texture, graphic, context) {
|
|
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
|
-
const pattern = context.createPattern(data, "repeat");
|
|
19128
|
-
return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), pattern;
|
|
19129
|
-
}
|
|
19130
19095
|
}
|
|
19131
19096
|
const defaultBaseTextureRenderContribution = new DefaultBaseTextureRenderContribution();
|
|
19132
19097
|
|
|
@@ -63355,21 +63320,21 @@
|
|
|
63355
63320
|
super.init(option), this.initBoxPlotMarkStyle();
|
|
63356
63321
|
}
|
|
63357
63322
|
_getMarkWidth() {
|
|
63358
|
-
var _a;
|
|
63323
|
+
var _a, _b;
|
|
63359
63324
|
if (this._autoBoxWidth) return this._autoBoxWidth;
|
|
63360
63325
|
const bandAxisHelper = "horizontal" === this._direction ? this._yAxisHelper : this._xAxisHelper,
|
|
63361
63326
|
depthFromSpec = this._groups ? this._groups.fields.length : 1,
|
|
63362
|
-
bandWidth = null === (_a = bandAxisHelper.getBandwidth) || void 0 === _a ? void 0 : _a.call(bandAxisHelper, depthFromSpec - 1);
|
|
63327
|
+
bandWidth = null !== (_b = null === (_a = bandAxisHelper.getBandwidth) || void 0 === _a ? void 0 : _a.call(bandAxisHelper, depthFromSpec - 1)) && void 0 !== _b ? _b : Math.max(this._boxWidth, this._shaftWidth);
|
|
63363
63328
|
let width = bandWidth;
|
|
63364
63329
|
return isValid$1(this._spec.boxWidth) && (width = getActualNumValue(this._spec.boxWidth, bandWidth)), isValid$1(this._spec.boxMinWidth) && (width = Math.max(width, getActualNumValue(this._spec.boxMinWidth, bandWidth))), isValid$1(this._spec.boxMaxWidth) && (width = Math.min(width, getActualNumValue(this._spec.boxMaxWidth, bandWidth))), this._autoBoxWidth = width, this._autoBoxWidth;
|
|
63365
63330
|
}
|
|
63366
63331
|
_getPosition(direction, datum) {
|
|
63367
|
-
var _a, _b, _c, _d;
|
|
63332
|
+
var _a, _b, _c, _d, _e, _f;
|
|
63368
63333
|
let axisHelper, sizeAttribute, dataToPosition;
|
|
63369
63334
|
"horizontal" === direction ? (axisHelper = this.getYAxisHelper(), sizeAttribute = "boxHeight", dataToPosition = this.dataToPositionY.bind(this)) : (axisHelper = this.getXAxisHelper(), sizeAttribute = "boxWidth", dataToPosition = this.dataToPositionX.bind(this));
|
|
63370
63335
|
const scale = axisHelper.getScale(0),
|
|
63371
63336
|
depth = this._groups ? this._groups.fields.length : 1,
|
|
63372
|
-
bandWidth = null === (_a = axisHelper.getBandwidth) || void 0 === _a ? void 0 : _a.call(axisHelper, depth - 1),
|
|
63337
|
+
bandWidth = null !== (_b = null === (_a = axisHelper.getBandwidth) || void 0 === _a ? void 0 : _a.call(axisHelper, depth - 1)) && void 0 !== _b ? _b : Math.max(this._boxWidth, this._shaftWidth),
|
|
63373
63338
|
size = this._boxPlotMark.getAttribute(sizeAttribute, datum);
|
|
63374
63339
|
if (depth > 1 && isValid$1(this._spec.boxGapInGroup)) {
|
|
63375
63340
|
const groupFields = this._groups.fields,
|
|
@@ -63378,13 +63343,13 @@
|
|
|
63378
63343
|
offSet = 0;
|
|
63379
63344
|
for (let index = groupFields.length - 1; index >= 1; index--) {
|
|
63380
63345
|
const groupField = groupFields[index],
|
|
63381
|
-
groupValues = null !== (
|
|
63346
|
+
groupValues = null !== (_d = null === (_c = axisHelper.getScale(index)) || void 0 === _c ? void 0 : _c.domain()) && void 0 !== _d ? _d : [],
|
|
63382
63347
|
groupCount = groupValues.length,
|
|
63383
|
-
gap = getActualNumValue(null !== (
|
|
63348
|
+
gap = getActualNumValue(null !== (_e = boxGapInGroup[index - 1]) && void 0 !== _e ? _e : last(boxGapInGroup), bandWidth),
|
|
63384
63349
|
i = groupValues.indexOf(datum[groupField]);
|
|
63385
63350
|
index === groupFields.length - 1 ? (totalWidth += groupCount * size + (groupCount - 1) * gap, offSet += i * (size + gap)) : (offSet += i * (totalWidth + gap), totalWidth += totalWidth + (groupCount - 1) * gap);
|
|
63386
63351
|
}
|
|
63387
|
-
return scale.scale(datum[groupFields[0]]) + axisHelper.getBandwidth(0) / 2 - totalWidth / 2 + offSet + size / 2;
|
|
63352
|
+
return scale.scale(datum[groupFields[0]]) + (null !== (_f = axisHelper.getBandwidth(0)) && void 0 !== _f ? _f : Math.max(this._boxWidth, this._shaftWidth)) / 2 - totalWidth / 2 + offSet + size / 2;
|
|
63388
63353
|
}
|
|
63389
63354
|
const continuous = isContinuous(scale.type || "band");
|
|
63390
63355
|
return dataToPosition(datum) + .5 * bandWidth + (continuous ? -bandWidth / 2 : 0);
|