@visactor/react-vchart 2.0.23-alpha.7 → 2.0.23-alpha.9
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 +67 -61
- 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 +5 -5
package/build/index.js
CHANGED
|
@@ -46492,20 +46492,16 @@
|
|
|
46492
46492
|
}
|
|
46493
46493
|
return isArray$1(spec) ? spec.map(s => specTransform(s, special)) : spec;
|
|
46494
46494
|
}
|
|
46495
|
-
function functionTransform(
|
|
46496
|
-
|
|
46497
|
-
if (
|
|
46495
|
+
function functionTransform(value, registry) {
|
|
46496
|
+
var _a;
|
|
46497
|
+
if (!value) return value;
|
|
46498
|
+
if (isString$1(value)) return null !== (_a = registry.getFunction(value)) && void 0 !== _a ? _a : value;
|
|
46499
|
+
if (isPlainObject$1(value)) {
|
|
46498
46500
|
const result = {};
|
|
46499
|
-
for (const key in
|
|
46500
|
-
if (isString$1(spec[key]) && VChart.getFunction(spec[key])) {
|
|
46501
|
-
result[key] = VChart.getFunction(spec[key]);
|
|
46502
|
-
continue;
|
|
46503
|
-
}
|
|
46504
|
-
result[key] = functionTransform(spec[key], VChart);
|
|
46505
|
-
}
|
|
46501
|
+
for (const key in value) Object.prototype.hasOwnProperty.call(value, key) && (result[key] = functionTransform(value[key], registry));
|
|
46506
46502
|
return result;
|
|
46507
46503
|
}
|
|
46508
|
-
return isArray$1(
|
|
46504
|
+
return isArray$1(value) ? value.map(item => functionTransform(item, registry)) : value;
|
|
46509
46505
|
}
|
|
46510
46506
|
function transformFunctionAttribute(att, ...args) {
|
|
46511
46507
|
return isFunction$1(att) ? att(...args) : att;
|
|
@@ -47559,11 +47555,24 @@
|
|
|
47559
47555
|
updateLayoutTag() {
|
|
47560
47556
|
this._layoutState = LayoutState.before;
|
|
47561
47557
|
}
|
|
47558
|
+
_isGeoRegionRoamDragEnabled() {
|
|
47559
|
+
var _a, _b;
|
|
47560
|
+
const chartSpec = null === (_b = null === (_a = this._compileChart) || void 0 === _a ? void 0 : _a.getSpec) || void 0 === _b ? void 0 : _b.call(_a),
|
|
47561
|
+
regions = null == chartSpec ? void 0 : chartSpec.region;
|
|
47562
|
+
return !!isArray$1(regions) && regions.some(region => {
|
|
47563
|
+
var _a;
|
|
47564
|
+
return !("geo" !== (null == region ? void 0 : region.coordinate) || !region.roam) && (!0 === region.roam || null === (_a = region.roam.drag) || void 0 === _a || _a);
|
|
47565
|
+
});
|
|
47566
|
+
}
|
|
47567
|
+
_shouldDisableCanvasTouchAction() {
|
|
47568
|
+
if (!isTrueBrowser(this._option.mode)) return !1;
|
|
47569
|
+
return !1 === (isValid$1(this._option.supportsTouchEvents) ? this._option.supportsTouchEvents : vglobal.supportsTouchEvents) && this._isGeoRegionRoamDragEnabled();
|
|
47570
|
+
}
|
|
47562
47571
|
_setCanvasStyle() {
|
|
47563
47572
|
if (this._stage && this._container.dom && !isString$1(this._container.dom)) {
|
|
47564
47573
|
this._container.dom.style.display = "block", this._container.dom.style.position = "relative";
|
|
47565
47574
|
const canvas = this.getCanvas();
|
|
47566
|
-
canvas && (canvas.style.display = "block");
|
|
47575
|
+
canvas && (canvas.style.display = "block", canvas.style.touchAction = this._shouldDisableCanvasTouchAction() ? "none" : "");
|
|
47567
47576
|
}
|
|
47568
47577
|
}
|
|
47569
47578
|
compile(ctx, option) {
|
|
@@ -47571,7 +47580,7 @@
|
|
|
47571
47580
|
const {
|
|
47572
47581
|
chart: chart
|
|
47573
47582
|
} = ctx;
|
|
47574
|
-
this._compileChart = chart, this.initView(), this._stage && ("render" !== (null == option ? void 0 : option.actionSource) && this._cachedMarks && (this.reuseOrMorphing(option.morphConfig), this._cachedMarks = null), chart.compile(), chart.afterCompile());
|
|
47583
|
+
this._compileChart = chart, this.initView(), this._stage && ("render" !== (null == option ? void 0 : option.actionSource) && this._cachedMarks && (this.reuseOrMorphing(option.morphConfig), this._cachedMarks = null), chart.compile(), this._setCanvasStyle(), chart.afterCompile());
|
|
47575
47584
|
}
|
|
47576
47585
|
clearNextRender() {
|
|
47577
47586
|
return !!this._nextRafId && (vglobal.getSpecifiedCancelAnimationFrame(10)(this._nextRafId), this._nextRafId = null, !0);
|
|
@@ -51431,13 +51440,14 @@
|
|
|
51431
51440
|
if (this._cachedProcessedTheme[cacheKey]) return this._cachedProcessedTheme[cacheKey];
|
|
51432
51441
|
let theme = this._currentTheme;
|
|
51433
51442
|
return keys.forEach((key, index) => {
|
|
51443
|
+
var _a;
|
|
51434
51444
|
if (1 !== index || "series" !== keys[0] && "component" !== keys[0]) theme = null == theme ? void 0 : theme[key];else {
|
|
51435
51445
|
const buildInTheme = "series" === keys[0] ? Factory.getSeriesBuiltInTheme(key) : Factory.getComponentBuiltInTheme(key);
|
|
51436
51446
|
theme = theme ? mergeSpec({}, buildInTheme, theme[key]) : buildInTheme;
|
|
51437
51447
|
}
|
|
51438
51448
|
index === keys.length - 1 && isValid$1(theme) && (theme = preprocessTheme({
|
|
51439
51449
|
[key]: theme
|
|
51440
|
-
}, this._currentTheme.colorScheme, this._currentTheme.token)[key]);
|
|
51450
|
+
}, this._currentTheme.colorScheme, this._currentTheme.token)[key], (null === (_a = this.getFunctionList()) || void 0 === _a ? void 0 : _a.length) && (theme = functionTransform(theme, this)));
|
|
51441
51451
|
}), this._cachedProcessedTheme[cacheKey] = theme, theme;
|
|
51442
51452
|
}, removeUndefined(options), this._option = Object.assign(Object.assign({}, this._option), options), (null == options ? void 0 : options.optimize) && (this._option.optimize = Object.assign(Object.assign({}, this._option.optimize), options.optimize)), this._onError = null === (_a = this._option) || void 0 === _a ? void 0 : _a.onError;
|
|
51443
51453
|
const _k = this._option,
|
|
@@ -54397,7 +54407,7 @@
|
|
|
54397
54407
|
}), res), []) : null;
|
|
54398
54408
|
}
|
|
54399
54409
|
_runPointsEncoder(newStyles, g, attrs = {}) {
|
|
54400
|
-
var _a, _b
|
|
54410
|
+
var _a, _b;
|
|
54401
54411
|
const data = g.context.data,
|
|
54402
54412
|
lineAttrs = [],
|
|
54403
54413
|
points = [],
|
|
@@ -54410,7 +54420,7 @@
|
|
|
54410
54420
|
this._isValidPointChannel(attrName) ? points[index][attrName] = newStyles[attrName](datum) : this._segmentStyleKeys.includes(attrName) && !progressive ? lineAttrs[index][attrName] = newStyles[attrName](datum) : 0 !== index || progressive && !isFirstFrame || (commonAttrs[attrName] = newStyles[attrName](datum));
|
|
54411
54421
|
}), points[index].context = null !== (_a = this._keyGetter(datum)) && void 0 !== _a ? _a : index;
|
|
54412
54422
|
}), progressive) {
|
|
54413
|
-
const segments =
|
|
54423
|
+
const segments = (null === (_b = g.attribute) || void 0 === _b ? void 0 : _b.segments) ? [...g.attribute.segments] : [];
|
|
54414
54424
|
return segments.push({
|
|
54415
54425
|
points: points
|
|
54416
54426
|
}), isFirstFrame ? Object.assign(Object.assign({}, commonAttrs), {
|
|
@@ -57833,7 +57843,7 @@
|
|
|
57833
57843
|
this._interaction = new Interaction();
|
|
57834
57844
|
const series = this.getAllSeries(),
|
|
57835
57845
|
mergedTriggers = [],
|
|
57836
|
-
|
|
57846
|
+
groupedTriggers = [];
|
|
57837
57847
|
series.forEach(s => {
|
|
57838
57848
|
const triggers = s.getInteractionTriggers();
|
|
57839
57849
|
if (triggers && triggers.length) {
|
|
@@ -57842,12 +57852,17 @@
|
|
|
57842
57852
|
trigger: trigger,
|
|
57843
57853
|
marks: marks
|
|
57844
57854
|
}) => {
|
|
57845
|
-
const
|
|
57846
|
-
|
|
57847
|
-
|
|
57848
|
-
|
|
57849
|
-
|
|
57850
|
-
|
|
57855
|
+
const sameTrigger = groupedTriggers.find(item => item.regionId === regionId && isEqual(item.config, trigger));
|
|
57856
|
+
if (sameTrigger) sameTrigger.trigger.marks.push(...marks);else {
|
|
57857
|
+
const mergedTrigger = Object.assign(Object.assign({}, trigger), {
|
|
57858
|
+
marks: [...marks]
|
|
57859
|
+
});
|
|
57860
|
+
groupedTriggers.push({
|
|
57861
|
+
regionId: regionId,
|
|
57862
|
+
config: Object.assign({}, trigger),
|
|
57863
|
+
trigger: mergedTrigger
|
|
57864
|
+
}), mergedTriggers.push(mergedTrigger);
|
|
57865
|
+
}
|
|
57851
57866
|
});
|
|
57852
57867
|
}
|
|
57853
57868
|
}), mergedTriggers.forEach(trigger => {
|
|
@@ -60322,7 +60337,7 @@
|
|
|
60322
60337
|
fieldsY = this._fieldY,
|
|
60323
60338
|
fieldsX = this._fieldX;
|
|
60324
60339
|
this._data.setTransform([{
|
|
60325
|
-
type: "
|
|
60340
|
+
type: "sampling",
|
|
60326
60341
|
size: "horizontal" === this._direction ? height : width,
|
|
60327
60342
|
factor: this._spec.samplingFactor,
|
|
60328
60343
|
yfield: "horizontal" === this._direction ? fieldsX[0] : fieldsY[0],
|
|
@@ -60567,7 +60582,7 @@
|
|
|
60567
60582
|
visible: !0
|
|
60568
60583
|
}, "normal", AttributeLevel.Series) : this.setMarkStyle(this._symbolMark, {
|
|
60569
60584
|
visible: this._getInvalidDefined.bind(this)
|
|
60570
|
-
}, "normal", AttributeLevel.Series), this._symbolMark.getProduct() && this._symbolMark.compileEncode()
|
|
60585
|
+
}, "normal", AttributeLevel.Series), this._symbolMark.getProduct() && this._symbolMark.compileEncode();
|
|
60571
60586
|
}
|
|
60572
60587
|
initLabelMarkStyle(labelMark) {
|
|
60573
60588
|
labelMark && (this._labelMark = labelMark, this.setMarkStyle(labelMark, {
|
|
@@ -60598,22 +60613,6 @@
|
|
|
60598
60613
|
postMatrix: new Matrix()
|
|
60599
60614
|
}), labelGraphic;
|
|
60600
60615
|
}
|
|
60601
|
-
_isGeoCoordinateSeries() {
|
|
60602
|
-
var _a, _b;
|
|
60603
|
-
return (null === (_b = null === (_a = this.getXAxisHelper()) || void 0 === _a ? void 0 : _a.getAxisType) || void 0 === _b ? void 0 : _b.call(_a)) === ComponentTypeEnum.geoCoordinate;
|
|
60604
|
-
}
|
|
60605
|
-
_refreshLabelComponent(resetPostMatrix = !1, disableAnimation = !1) {
|
|
60606
|
-
var _a, _b;
|
|
60607
|
-
const vgrammarLabel = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent(),
|
|
60608
|
-
labelGraphic = null === (_b = null == vgrammarLabel ? void 0 : vgrammarLabel.getComponent) || void 0 === _b ? void 0 : _b.call(vgrammarLabel);
|
|
60609
|
-
resetPostMatrix && (null == labelGraphic ? void 0 : labelGraphic.attribute.postMatrix) && labelGraphic.setAttributes({
|
|
60610
|
-
postMatrix: new Matrix()
|
|
60611
|
-
}), disableAnimation && (null == labelGraphic ? void 0 : labelGraphic.disableAnimation) && (labelGraphic.disableAnimation(), this._enableLabelAnimationHook || (this._enableLabelAnimationHook = () => {
|
|
60612
|
-
var _a, _b, _c, _d;
|
|
60613
|
-
const currentLabelGraphic = null === (_c = null === (_b = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent()) || void 0 === _b ? void 0 : _b.getComponent) || void 0 === _c ? void 0 : _c.call(_b);
|
|
60614
|
-
null === (_d = null == currentLabelGraphic ? void 0 : currentLabelGraphic.enableAnimation) || void 0 === _d || _d.call(currentLabelGraphic), this.event.off(HOOK_EVENT.AFTER_MARK_RENDER_END, this._enableLabelAnimationHook), this._enableLabelAnimationHook = void 0;
|
|
60615
|
-
}, this.event.on(HOOK_EVENT.AFTER_MARK_RENDER_END, this._enableLabelAnimationHook))), (null == vgrammarLabel ? void 0 : vgrammarLabel.getProduct()) && vgrammarLabel.renderInner();
|
|
60616
|
-
}
|
|
60617
60616
|
handleZoom(e) {
|
|
60618
60617
|
const {
|
|
60619
60618
|
scale: scale,
|
|
@@ -60634,12 +60633,14 @@
|
|
|
60634
60633
|
labelGraphic && labelGraphic.translate(delta[0], delta[1]);
|
|
60635
60634
|
}
|
|
60636
60635
|
onLayoutEnd() {
|
|
60637
|
-
var _a, _b;
|
|
60636
|
+
var _a, _b, _c;
|
|
60638
60637
|
super.onLayoutEnd(), this._updateSymbolGraphicPosition();
|
|
60639
60638
|
const labelGraphic = null === (_b = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent()) || void 0 === _b ? void 0 : _b.getComponent();
|
|
60640
60639
|
(null == labelGraphic ? void 0 : labelGraphic.attribute.postMatrix) && labelGraphic.setAttributes({
|
|
60641
60640
|
postMatrix: new Matrix()
|
|
60642
|
-
})
|
|
60641
|
+
});
|
|
60642
|
+
const vgrammarLabel = null === (_c = this._labelMark) || void 0 === _c ? void 0 : _c.getComponent();
|
|
60643
|
+
vgrammarLabel && vgrammarLabel.renderInner();
|
|
60643
60644
|
}
|
|
60644
60645
|
getDefaultShapeType() {
|
|
60645
60646
|
return "circle";
|
|
@@ -62513,6 +62514,14 @@
|
|
|
62513
62514
|
bandPosition: this._bandPosition
|
|
62514
62515
|
}));
|
|
62515
62516
|
}
|
|
62517
|
+
_isCategoryAxisInverse() {
|
|
62518
|
+
var _a, _b, _c, _e;
|
|
62519
|
+
return "horizontal" === this._direction ? null === (_b = null === (_a = this._yAxisHelper) || void 0 === _a ? void 0 : _a.isInverse) || void 0 === _b ? void 0 : _b.call(_a) : null === (_e = null === (_c = this._xAxisHelper) || void 0 === _c ? void 0 : _c.isInverse) || void 0 === _e ? void 0 : _e.call(_c);
|
|
62520
|
+
}
|
|
62521
|
+
_getLeaderLineCategoryPos(isStart, isDecrease) {
|
|
62522
|
+
const normalPos = isStart ? isDecrease ? 0 : 1 : isDecrease ? 1 : 0;
|
|
62523
|
+
return !!this._isCategoryAxisInverse() ? 1 - normalPos : normalPos;
|
|
62524
|
+
}
|
|
62516
62525
|
initMarkStyle() {
|
|
62517
62526
|
super.initMarkStyle();
|
|
62518
62527
|
const isDecrease = "decrease" === this._spec.calculationMode;
|
|
@@ -62520,12 +62529,12 @@
|
|
|
62520
62529
|
visible: datum => this.isVisibleLeaderLine(datum),
|
|
62521
62530
|
x: datum => this.totalPositionX(datum, "lastEnd", 0),
|
|
62522
62531
|
x1: datum => this.totalPositionX(datum, datum.isTotal ? "end" : "start", 0),
|
|
62523
|
-
y: datum => datum.lastIndex ? this.totalPositionY(datum, "lastIndex",
|
|
62524
|
-
y1: datum => this.totalPositionY(datum, "index",
|
|
62532
|
+
y: datum => datum.lastIndex ? this.totalPositionY(datum, "lastIndex", this._getLeaderLineCategoryPos(!0, isDecrease)) : 0,
|
|
62533
|
+
y1: datum => this.totalPositionY(datum, "index", this._getLeaderLineCategoryPos(!1, isDecrease))
|
|
62525
62534
|
}, "normal", AttributeLevel.Series) : this.setMarkStyle(this._leaderLineMark, {
|
|
62526
62535
|
visible: datum => this.isVisibleLeaderLine(datum),
|
|
62527
|
-
x: datum => datum.lastIndex ? this.totalPositionX(datum, "lastIndex",
|
|
62528
|
-
x1: datum => this.totalPositionX(datum, "index",
|
|
62536
|
+
x: datum => datum.lastIndex ? this.totalPositionX(datum, "lastIndex", this._getLeaderLineCategoryPos(!0, isDecrease)) : 0,
|
|
62537
|
+
x1: datum => this.totalPositionX(datum, "index", this._getLeaderLineCategoryPos(!1, isDecrease)),
|
|
62529
62538
|
y: datum => this.totalPositionY(datum, "lastEnd", 0),
|
|
62530
62539
|
y1: datum => this.totalPositionY(datum, datum.isTotal ? "end" : "start", 0)
|
|
62531
62540
|
}, "normal", AttributeLevel.Series));
|
|
@@ -65090,10 +65099,9 @@
|
|
|
65090
65099
|
fill: this.getColorAttribute(),
|
|
65091
65100
|
outerRadius: datum => valueInScaleRange(this.radiusAxisHelper.dataToPosition([datum[this._radiusField[0]]]), this.radiusAxisHelper.getScale(0)),
|
|
65092
65101
|
innerRadius: datum => {
|
|
65093
|
-
|
|
65094
|
-
if (!this.getStack()) return 0;
|
|
65102
|
+
if (!this.getStack()) return this._computeLayoutRadius() * this._innerRadius;
|
|
65095
65103
|
const stackStart = valueInScaleRange(this.radiusAxisHelper.dataToPosition([datum[this._innerRadiusField[0]]]), this.radiusAxisHelper.getScale(0));
|
|
65096
|
-
return stackStart <= Number.MIN_VALUE ? this._computeLayoutRadius() *
|
|
65104
|
+
return stackStart <= Number.MIN_VALUE ? this._computeLayoutRadius() * this._innerRadius : stackStart;
|
|
65097
65105
|
}
|
|
65098
65106
|
});
|
|
65099
65107
|
}
|
|
@@ -65112,10 +65120,7 @@
|
|
|
65112
65120
|
const appearPreset = null === (_b = null === (_a = this._spec) || void 0 === _a ? void 0 : _a.animationAppear) || void 0 === _b ? void 0 : _b.preset;
|
|
65113
65121
|
if (this._roseMark) {
|
|
65114
65122
|
const animationParams = {
|
|
65115
|
-
innerRadius: () =>
|
|
65116
|
-
var _a;
|
|
65117
|
-
return this._computeLayoutRadius() * (null !== (_a = this._spec.innerRadius) && void 0 !== _a ? _a : 0);
|
|
65118
|
-
}
|
|
65123
|
+
innerRadius: () => this._computeLayoutRadius() * this._innerRadius
|
|
65119
65124
|
};
|
|
65120
65125
|
this._roseMark.setAnimationConfig(animationConfig(null === (_c = Factory.getAnimationInKey("rose")) || void 0 === _c ? void 0 : _c(animationParams, appearPreset), userAnimationConfig("rose", this._spec, this._markAttributeContext)));
|
|
65121
65126
|
}
|
|
@@ -76156,11 +76161,12 @@
|
|
|
76156
76161
|
|
|
76157
76162
|
class RadarChartSpecTransformer extends RoseLikeChartSpecTransformer {
|
|
76158
76163
|
_getDefaultSeriesSpec(spec) {
|
|
76159
|
-
var _a;
|
|
76160
|
-
const series = super._getDefaultSeriesSpec(spec)
|
|
76164
|
+
var _a, _b, _c, _d;
|
|
76165
|
+
const series = super._getDefaultSeriesSpec(spec),
|
|
76166
|
+
areaTheme = null === (_b = (_a = this._option).getTheme) || void 0 === _b ? void 0 : _b.call(_a, "series", "radar", "area");
|
|
76161
76167
|
return series.line = spec.line, series.point = spec.point, series.stack = spec.stack, series.percent = spec.percent, series.area = mergeSpec({
|
|
76162
|
-
visible:
|
|
76163
|
-
}, spec.area), series.seriesMark = null !== (
|
|
76168
|
+
visible: null !== (_c = null == areaTheme ? void 0 : areaTheme.visible) && void 0 !== _c && _c
|
|
76169
|
+
}, spec.area), series.seriesMark = null !== (_d = spec.seriesMark) && void 0 !== _d ? _d : "area", series.activePoint = spec.activePoint, series.pointDis = spec.pointDis, series.pointDisMul = spec.pointDisMul, series.markOverlap = spec.markOverlap, series;
|
|
76164
76170
|
}
|
|
76165
76171
|
transformSpec(spec) {
|
|
76166
76172
|
var _a;
|
|
@@ -77183,7 +77189,7 @@
|
|
|
77183
77189
|
return [this._legendComponent];
|
|
77184
77190
|
}
|
|
77185
77191
|
clear() {
|
|
77186
|
-
super.clear(), this._cacheAttrs = null, this._preSelectedData = null;
|
|
77192
|
+
super.clear(), this._legendComponent = null, this._cacheAttrs = null, this._preSelectedData = null;
|
|
77187
77193
|
}
|
|
77188
77194
|
}
|
|
77189
77195
|
BaseLegend.specKey = "legends";
|
|
@@ -85838,7 +85844,7 @@
|
|
|
85838
85844
|
} = this.options,
|
|
85839
85845
|
statedGraphics = interaction.getStatedGraphics(this),
|
|
85840
85846
|
g = null != graphic ? graphic : null == statedGraphics ? void 0 : statedGraphics[0];
|
|
85841
|
-
g && statedGraphics.includes(g) && (g.removeState(state), interaction.setStatedGraphics(this, statedGraphics.filter(sg => sg !== g)));
|
|
85847
|
+
g && (null == statedGraphics ? void 0 : statedGraphics.includes(g)) && (g.removeState(state), interaction.setStatedGraphics(this, statedGraphics.filter(sg => sg !== g)));
|
|
85842
85848
|
}
|
|
85843
85849
|
}
|
|
85844
85850
|
ElementActive.type = "element-active", ElementActive.defaultOptions = defaultOptions$3;
|
|
@@ -89281,7 +89287,7 @@
|
|
|
89281
89287
|
|
|
89282
89288
|
const VChartSimple = createChart('VChartSimple');
|
|
89283
89289
|
|
|
89284
|
-
const version = "2.0.23-alpha.
|
|
89290
|
+
const version = "2.0.23-alpha.8";
|
|
89285
89291
|
|
|
89286
89292
|
exports.Area = Area;
|
|
89287
89293
|
exports.AreaChart = AreaChart;
|