@visactor/react-vchart 2.1.0-alpha.6 → 2.1.0-alpha.7
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 +62 -23
- package/build/index.min.js +3 -3
- package/package.json +5 -5
package/build/index.js
CHANGED
|
@@ -66334,17 +66334,10 @@
|
|
|
66334
66334
|
[ComponentTypeEnum.markArea]: !0
|
|
66335
66335
|
},
|
|
66336
66336
|
MARKER_ADDITION_REMAKE_SPEC_KEYS = {
|
|
66337
|
-
autoRange: !0,
|
|
66338
66337
|
regionId: !0,
|
|
66339
66338
|
regionIndex: !0,
|
|
66340
66339
|
seriesId: !0,
|
|
66341
66340
|
seriesIndex: !0,
|
|
66342
|
-
relativeSeriesId: !0,
|
|
66343
|
-
relativeSeriesIndex: !0,
|
|
66344
|
-
startRelativeSeriesId: !0,
|
|
66345
|
-
startRelativeSeriesIndex: !0,
|
|
66346
|
-
endRelativeSeriesId: !0,
|
|
66347
|
-
endRelativeSeriesIndex: !0,
|
|
66348
66341
|
specifiedDataSeriesId: !0,
|
|
66349
66342
|
specifiedDataSeriesIndex: !0
|
|
66350
66343
|
};
|
|
@@ -66423,7 +66416,11 @@
|
|
|
66423
66416
|
}, this.getComponentsByKey = key => this._components.filter(c => (c.specKey || c.type) === key), this.getComponentByUserId = userId => {
|
|
66424
66417
|
const component = this._components.find(s => s.userId === userId);
|
|
66425
66418
|
if (component) return component;
|
|
66426
|
-
}, this.getComponentsByType = type => this._components.filter(c => c.type === type), this._isMarkerAdditionSpecSafeWithoutRemake = spec =>
|
|
66419
|
+
}, this.getComponentsByType = type => this._components.filter(c => c.type === type), this._isMarkerAdditionSpecSafeWithoutRemake = spec => {
|
|
66420
|
+
if (!spec || "object" != typeof spec) return !1;
|
|
66421
|
+
const markerSpec = spec;
|
|
66422
|
+
return !1 !== markerSpec.visible && !Object.keys(MARKER_ADDITION_REMAKE_SPEC_KEYS).some(key => !isNil$1(markerSpec[key]));
|
|
66423
|
+
}, this._paddingSpec = normalizeLayoutPaddingSpec(null !== (_a = spec.padding) && void 0 !== _a ? _a : option.getTheme("padding")), this._event = new Event$1(option.eventDispatcher, option.mode), this._dataSet = option.dataSet, this._chartData = new ChartData(this._dataSet), this._modelOption = Object.assign(Object.assign({}, option), {
|
|
66427
66424
|
mode: this._option.mode,
|
|
66428
66425
|
map: this._idMap,
|
|
66429
66426
|
getChartLayoutRect: () => this._layoutRect,
|
|
@@ -66841,6 +66838,9 @@
|
|
|
66841
66838
|
_canAddMarkerComponentsWithoutRemake(key, currentSpec, nextSpec) {
|
|
66842
66839
|
return !!(MARKER_COMPONENT_SPEC_KEYS[key] && isArray$1(currentSpec) && isArray$1(nextSpec)) && !(nextSpec.length <= currentSpec.length) && nextSpec.slice(currentSpec.length).every(this._isMarkerAdditionSpecSafeWithoutRemake);
|
|
66843
66840
|
}
|
|
66841
|
+
_isAutoRangeMarkerSpec(spec) {
|
|
66842
|
+
return !!spec && "object" == typeof spec && !0 === spec.autoRange;
|
|
66843
|
+
}
|
|
66844
66844
|
_canRemoveMarkerComponentsWithoutRemake(key, currentSpec, nextSpec) {
|
|
66845
66845
|
return MARKER_COMPONENT_SPEC_KEYS[key] && isArray$1(currentSpec) && currentSpec.length > 0 && isArray$1(nextSpec) && 0 === nextSpec.length;
|
|
66846
66846
|
}
|
|
@@ -66906,13 +66906,17 @@
|
|
|
66906
66906
|
}
|
|
66907
66907
|
_createMissingMarkerComponentsForSpecs(result, componentCache) {
|
|
66908
66908
|
var _a;
|
|
66909
|
-
let createdCount = 0
|
|
66909
|
+
let createdCount = 0,
|
|
66910
|
+
hasAutoRangeMarker = !1;
|
|
66910
66911
|
null === (_a = this._specTransformer) || void 0 === _a || _a.forEachComponentInSpec(this._spec, (constructor, specInfo) => {
|
|
66911
66912
|
if (result.reMake) return;
|
|
66912
66913
|
const compSpecKey = constructor.specKey || constructor.type;
|
|
66913
|
-
MARKER_COMPONENT_SPEC_KEYS[compSpecKey] && !this._hasComponentForSpecInfo(compSpecKey, specInfo) && (this._isMarkerAdditionSpecSafeWithoutRemake(specInfo.spec) ? (this._createComponent(constructor, specInfo), componentCache[compSpecKey] && componentCache[compSpecKey].componentCount++, createdCount
|
|
66914
|
-
}, this._option.getSpecInfo()), createdCount && (result.change = !0, result.effects = Object.assign(Object.assign({}, result.effects), {
|
|
66915
|
-
component: !0
|
|
66914
|
+
MARKER_COMPONENT_SPEC_KEYS[compSpecKey] && !this._hasComponentForSpecInfo(compSpecKey, specInfo) && (this._isMarkerAdditionSpecSafeWithoutRemake(specInfo.spec) ? (this._createComponent(constructor, specInfo), componentCache[compSpecKey] && componentCache[compSpecKey].componentCount++, createdCount++, hasAutoRangeMarker = hasAutoRangeMarker || this._isAutoRangeMarkerSpec(specInfo.spec)) : result.reMake = !0);
|
|
66915
|
+
}, this._option.getSpecInfo()), createdCount && (result.change = !0, result.effects = Object.assign(Object.assign(Object.assign(Object.assign({}, result.effects), {
|
|
66916
|
+
component: !0
|
|
66917
|
+
}), hasAutoRangeMarker ? {
|
|
66918
|
+
scaleDomain: !0
|
|
66919
|
+
} : null), {
|
|
66916
66920
|
layout: !0,
|
|
66917
66921
|
render: !0
|
|
66918
66922
|
}));
|
|
@@ -90844,20 +90848,31 @@
|
|
|
90844
90848
|
MARKER_COORDINATE_PLACEHOLDER = "__vchart_marker_coordinate__",
|
|
90845
90849
|
MARKER_TEXT_PLACEHOLDER = "__vchart_marker_text__",
|
|
90846
90850
|
MARKER_AUTO_RANGE_PLACEHOLDER = "__vchart_marker_auto_range__",
|
|
90851
|
+
MARKER_STYLE_PLACEHOLDER = "__vchart_marker_style__",
|
|
90847
90852
|
MARKER_DOMAIN_POSITION_SPEC_KEYS = ["coordinate", "coordinates", "x", "y", "x1", "y1", "angle", "angle1", "radius", "radius1"],
|
|
90848
90853
|
MARKER_LAYOUT_POSITION_SPEC_KEYS = ["position", "positions", "coordinatesOffset", "regionRelative"],
|
|
90849
90854
|
normalizeMarkerLabelFormatMethod = label => Array.isArray(label) ? label.map(normalizeMarkerLabelFormatMethod) : label && "object" == typeof label ? "function" != typeof label.formatMethod ? label : Object.assign(Object.assign({}, label), {
|
|
90850
90855
|
formatMethod: MARKER_FORMAT_METHOD_PLACEHOLDER
|
|
90851
90856
|
}) : label,
|
|
90857
|
+
normalizeMarkerStyles = value => {
|
|
90858
|
+
if (Array.isArray(value)) return value.map(normalizeMarkerStyles);
|
|
90859
|
+
if (!value || "object" != typeof value) return value;
|
|
90860
|
+
const normalized = Object.assign({}, value);
|
|
90861
|
+
return Object.keys(normalized).forEach(key => {
|
|
90862
|
+
"style" === key || key.endsWith("Style") ? normalized[key] = MARKER_STYLE_PLACEHOLDER : normalized[key] = normalizeMarkerStyles(normalized[key]);
|
|
90863
|
+
}), normalized;
|
|
90864
|
+
},
|
|
90852
90865
|
normalizeMarkerSpecForComponentOnlyUpdate = (spec, options) => {
|
|
90853
90866
|
var _a;
|
|
90854
90867
|
if (!spec || "object" != typeof spec) return spec;
|
|
90855
90868
|
const normalized = Object.assign({}, spec);
|
|
90856
90869
|
options.normalizeDomainPosition && MARKER_DOMAIN_POSITION_SPEC_KEYS.forEach(key => {
|
|
90857
|
-
|
|
90870
|
+
normalized[key] = MARKER_COORDINATE_PLACEHOLDER;
|
|
90858
90871
|
}), options.normalizeAutoRange && "autoRange" in normalized && (normalized.autoRange = MARKER_AUTO_RANGE_PLACEHOLDER), MARKER_LAYOUT_POSITION_SPEC_KEYS.forEach(key => {
|
|
90859
90872
|
key in normalized && (normalized[key] = MARKER_COORDINATE_PLACEHOLDER);
|
|
90860
|
-
}), "label" in normalized && (normalized.label = normalizeMarkerLabelFormatMethod(normalized.label))
|
|
90873
|
+
}), "label" in normalized && (normalized.label = normalizeMarkerLabelFormatMethod(normalized.label)), Object.keys(normalized).forEach(key => {
|
|
90874
|
+
normalized[key] = normalizeMarkerStyles(normalized[key]);
|
|
90875
|
+
});
|
|
90861
90876
|
const text = null === (_a = normalized.itemContent) || void 0 === _a ? void 0 : _a.text;
|
|
90862
90877
|
return text && "object" == typeof text && (normalized.itemContent = Object.assign(Object.assign({}, normalized.itemContent), {
|
|
90863
90878
|
text: Object.assign(Object.assign({}, normalizeMarkerLabelFormatMethod(text)), {
|
|
@@ -91044,7 +91059,7 @@
|
|
|
91044
91059
|
}));
|
|
91045
91060
|
}
|
|
91046
91061
|
reInit(spec) {
|
|
91047
|
-
super.reInit(spec), this._bindSeries(), this._initDataView(), this._buildMarkerAttributeContext(), this._markerComponent && this._updateMarkerLayout();
|
|
91062
|
+
super.reInit(spec), this._releaseMarkerData(), this._bindSeries(), this._initDataView(), this._buildMarkerAttributeContext(), this._markerComponent && this._updateMarkerLayout();
|
|
91048
91063
|
}
|
|
91049
91064
|
_initCommonDataView() {
|
|
91050
91065
|
const {
|
|
@@ -93093,7 +93108,7 @@
|
|
|
93093
93108
|
return new MarkPoint$1(markPointAttrs);
|
|
93094
93109
|
}
|
|
93095
93110
|
_markerLayout() {
|
|
93096
|
-
var _a, _b, _c, _d, _e, _f;
|
|
93111
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
93097
93112
|
const spec = this._spec,
|
|
93098
93113
|
data = this._markerData,
|
|
93099
93114
|
relativeSeries = this._relativeSeries,
|
|
@@ -93101,9 +93116,30 @@
|
|
|
93101
93116
|
point: point
|
|
93102
93117
|
} = this._computePointsAttr(),
|
|
93103
93118
|
seriesData = this._getRelativeDataView().latestData,
|
|
93104
|
-
dataPoints = data ? data.latestData[0] && data.latestData[0].latestData ? data.latestData[0].latestData : data.latestData : seriesData
|
|
93119
|
+
dataPoints = data ? data.latestData[0] && data.latestData[0].latestData ? data.latestData[0].latestData : data.latestData : seriesData,
|
|
93120
|
+
{
|
|
93121
|
+
itemLine = {},
|
|
93122
|
+
itemContent = {}
|
|
93123
|
+
} = this._spec,
|
|
93124
|
+
{
|
|
93125
|
+
visible: itemLineVisible,
|
|
93126
|
+
line = {}
|
|
93127
|
+
} = itemLine,
|
|
93128
|
+
restItemLine = __rest$1(itemLine, ["visible", "line"]),
|
|
93129
|
+
itemLineAttrs = !1 !== itemLineVisible ? Object.assign(Object.assign({}, restItemLine), {
|
|
93130
|
+
visible: !0,
|
|
93131
|
+
lineStyle: transformToGraphic(line.style)
|
|
93132
|
+
}) : {
|
|
93133
|
+
visible: !1
|
|
93134
|
+
},
|
|
93135
|
+
labelAttrs = transformLabelAttributes(Object.assign(Object.assign({}, itemContent.text), {
|
|
93136
|
+
style: merge$1({
|
|
93137
|
+
dx: 0,
|
|
93138
|
+
dy: 0
|
|
93139
|
+
}, null !== (_b = null === (_a = itemContent.text) || void 0 === _a ? void 0 : _a.style) && void 0 !== _b ? _b : itemContent.style)
|
|
93140
|
+
}), data, this._markAttributeContext);
|
|
93105
93141
|
let limitRect;
|
|
93106
|
-
if (spec.clip || (null === (
|
|
93142
|
+
if (spec.clip || (null === (_c = spec.itemContent) || void 0 === _c ? void 0 : _c.confine)) {
|
|
93107
93143
|
const {
|
|
93108
93144
|
minX: minX,
|
|
93109
93145
|
maxX: maxX,
|
|
@@ -93118,21 +93154,24 @@
|
|
|
93118
93154
|
};
|
|
93119
93155
|
}
|
|
93120
93156
|
if (this._markerComponent) {
|
|
93121
|
-
const attribute = null !== (
|
|
93122
|
-
textStyle = null !== (
|
|
93123
|
-
specText = null === (
|
|
93157
|
+
const attribute = null !== (_d = this._markerComponent.attribute) && void 0 !== _d ? _d : {},
|
|
93158
|
+
textStyle = null !== (_f = null === (_e = attribute.itemContent) || void 0 === _e ? void 0 : _e.textStyle) && void 0 !== _f ? _f : {},
|
|
93159
|
+
specText = null === (_g = this._spec.itemContent.text) || void 0 === _g ? void 0 : _g.text;
|
|
93124
93160
|
this._markerComponent.setAttributes({
|
|
93125
93161
|
position: void 0 === point ? {
|
|
93126
93162
|
x: null,
|
|
93127
93163
|
y: null
|
|
93128
93164
|
} : point,
|
|
93129
93165
|
itemContent: Object.assign(Object.assign({}, attribute.itemContent), {
|
|
93130
|
-
|
|
93131
|
-
|
|
93166
|
+
panel: null !== (_h = labelAttrs.panel) && void 0 !== _h ? _h : null === (_j = attribute.itemContent) || void 0 === _j ? void 0 : _j.panel,
|
|
93167
|
+
padding: null !== (_k = labelAttrs.padding) && void 0 !== _k ? _k : null === (_l = attribute.itemContent) || void 0 === _l ? void 0 : _l.padding,
|
|
93168
|
+
textStyle: Object.assign(Object.assign(Object.assign({}, textStyle), null !== (_m = labelAttrs.textStyle) && void 0 !== _m ? _m : {}), {
|
|
93169
|
+
text: (null === (_o = this._spec.itemContent.text) || void 0 === _o ? void 0 : _o.formatMethod) ? this._spec.itemContent.text.formatMethod(dataPoints, seriesData) : isValid$1(specText) ? specText : textStyle.text
|
|
93132
93170
|
}),
|
|
93133
93171
|
offsetX: computeOffsetFromRegion(point, attribute.itemContent.offsetX, this._relativeSeries.getRegion()),
|
|
93134
93172
|
offsetY: computeOffsetFromRegion(point, attribute.itemContent.offsetY, this._relativeSeries.getRegion())
|
|
93135
93173
|
}),
|
|
93174
|
+
itemLine: itemLineAttrs,
|
|
93136
93175
|
limitRect: limitRect,
|
|
93137
93176
|
dx: this._layoutOffsetX,
|
|
93138
93177
|
dy: this._layoutOffsetY
|