@visactor/react-vchart 2.1.0-alpha.7 → 2.1.0-alpha.8
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 +37 -12
- package/build/index.min.js +1 -1
- package/package.json +4 -4
package/build/index.js
CHANGED
|
@@ -53841,6 +53841,9 @@
|
|
|
53841
53841
|
}
|
|
53842
53842
|
|
|
53843
53843
|
class ColorOrdinalScale extends OrdinalScale {
|
|
53844
|
+
setSpecified(value) {
|
|
53845
|
+
return this._specified = value ? Object.assign({}, value) : {}, this;
|
|
53846
|
+
}
|
|
53844
53847
|
range(value) {
|
|
53845
53848
|
return value ? (this._range = value, this._resetRange(), this) : super.range();
|
|
53846
53849
|
}
|
|
@@ -54972,7 +54975,7 @@
|
|
|
54972
54975
|
return this._composedEventMap;
|
|
54973
54976
|
}
|
|
54974
54977
|
constructor(eventDispatcher, mode) {
|
|
54975
|
-
this._composedEventMap = new Map(), this._eventDispatcher = eventDispatcher, this._mode = mode;
|
|
54978
|
+
this._composedEventMap = new Map(), this._eventHandlerMap = new Map(), this._eventDispatcher = eventDispatcher, this._mode = mode;
|
|
54976
54979
|
}
|
|
54977
54980
|
on(eType, query, callback) {
|
|
54978
54981
|
const handler = "function" == typeof query ? {
|
|
@@ -54989,16 +54992,16 @@
|
|
|
54989
54992
|
eventType: eType,
|
|
54990
54993
|
event: composedEvent
|
|
54991
54994
|
});
|
|
54992
|
-
} else this._eventDispatcher.register(eType, handler);
|
|
54995
|
+
} else this._eventDispatcher.register(eType, handler), this._addEventHandler(eType, handler);
|
|
54993
54996
|
return this;
|
|
54994
54997
|
}
|
|
54995
54998
|
off(eType, query, cb) {
|
|
54996
|
-
var _a, _b;
|
|
54999
|
+
var _a, _b, _c;
|
|
54997
55000
|
const callback = null != cb ? cb : query;
|
|
54998
55001
|
if (Factory.getComposedEvent(eType)) {
|
|
54999
55002
|
if (callback) null === (_a = this._composedEventMap.get(callback)) || void 0 === _a || _a.event.unregister(), this._composedEventMap.delete(callback);else for (const entry of this._composedEventMap.entries()) entry[1].eventType === eType && (null === (_b = this._composedEventMap.get(entry[0])) || void 0 === _b || _b.event.unregister(), this._composedEventMap.delete(entry[0]));
|
|
55000
55003
|
} else if (callback) {
|
|
55001
|
-
const handler = {
|
|
55004
|
+
const handler = null !== (_c = this._getEventHandler(eType, callback)) && void 0 !== _c ? _c : {
|
|
55002
55005
|
callback: callback,
|
|
55003
55006
|
query: null,
|
|
55004
55007
|
filter: {
|
|
@@ -55011,8 +55014,8 @@
|
|
|
55011
55014
|
userId: null
|
|
55012
55015
|
}
|
|
55013
55016
|
};
|
|
55014
|
-
this._eventDispatcher.unregister(eType, handler);
|
|
55015
|
-
} else this._eventDispatcher.unregister(eType);
|
|
55017
|
+
this._eventDispatcher.unregister(eType, handler), this._removeEventHandler(eType, callback);
|
|
55018
|
+
} else this._eventDispatcher.unregister(eType), this._eventHandlerMap.delete(eType);
|
|
55016
55019
|
return this;
|
|
55017
55020
|
}
|
|
55018
55021
|
emit(eType, params, level) {
|
|
@@ -55025,7 +55028,24 @@
|
|
|
55025
55028
|
return this._eventDispatcher.allow(eType), this;
|
|
55026
55029
|
}
|
|
55027
55030
|
release() {
|
|
55028
|
-
this.
|
|
55031
|
+
this._eventHandlerMap.forEach((handlers, eventType) => {
|
|
55032
|
+
handlers.forEach(handler => {
|
|
55033
|
+
this._eventDispatcher.unregister(eventType, handler);
|
|
55034
|
+
});
|
|
55035
|
+
}), this._eventHandlerMap.clear(), this._composedEventMap.forEach(entry => {
|
|
55036
|
+
entry.event.unregister();
|
|
55037
|
+
}), this._composedEventMap.clear();
|
|
55038
|
+
}
|
|
55039
|
+
_addEventHandler(eventType, handler) {
|
|
55040
|
+
handler.callback && (this._eventHandlerMap.has(eventType) || this._eventHandlerMap.set(eventType, new Map()), this._eventHandlerMap.get(eventType).set(handler.callback, handler));
|
|
55041
|
+
}
|
|
55042
|
+
_getEventHandler(eventType, callback) {
|
|
55043
|
+
var _a;
|
|
55044
|
+
return null === (_a = this._eventHandlerMap.get(eventType)) || void 0 === _a ? void 0 : _a.get(callback);
|
|
55045
|
+
}
|
|
55046
|
+
_removeEventHandler(eventType, callback) {
|
|
55047
|
+
const handlerMap = this._eventHandlerMap.get(eventType);
|
|
55048
|
+
handlerMap && (handlerMap.delete(callback), handlerMap.size || this._eventHandlerMap.delete(eventType));
|
|
55029
55049
|
}
|
|
55030
55050
|
};
|
|
55031
55051
|
|
|
@@ -59956,10 +59976,7 @@
|
|
|
59956
59976
|
}
|
|
59957
59977
|
_reCompile(updateResult, morphConfig) {
|
|
59958
59978
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
59959
|
-
if (updateResult.reMake && (this._releaseData(), this._initDataSet(), null === (_a = this._chart) || void 0 === _a || _a.release(!1), this._chart = null), updateResult.reTransformSpec && (this._chartSpecTransformer = null), updateResult.changeTheme ? (this._setCurrentTheme(), this._setFontFamilyTheme(this.getTheme("fontFamily"))) : updateResult.changeBackground && (null === (_b = this._compiler) || void 0 === _b || _b.setBackground(this._getBackground())), updateResult.reMake ?
|
|
59960
|
-
var _a;
|
|
59961
|
-
return null === (_a = this._event) || void 0 === _a ? void 0 : _a.on(e.eType, e.query, e.handler);
|
|
59962
|
-
})) : updateResult.reCompile && (null === (_d = this._compiler) || void 0 === _d || _d.clear({
|
|
59979
|
+
if (updateResult.reMake && (this._releaseData(), this._initDataSet(), null === (_a = this._chart) || void 0 === _a || _a.release(!1), this._chart = null), updateResult.reTransformSpec && (this._chartSpecTransformer = null), updateResult.changeTheme ? (this._setCurrentTheme(), this._setFontFamilyTheme(this.getTheme("fontFamily"))) : updateResult.changeBackground && (null === (_b = this._compiler) || void 0 === _b || _b.setBackground(this._getBackground())), updateResult.reMake ? null === (_c = this._compiler) || void 0 === _c || _c.releaseGrammar(!0) : updateResult.reCompile && (null === (_d = this._compiler) || void 0 === _d || _d.clear({
|
|
59963
59980
|
chart: this._chart,
|
|
59964
59981
|
vChart: this
|
|
59965
59982
|
}), null === (_e = this._compiler) || void 0 === _e || _e.compile({
|
|
@@ -66102,7 +66119,15 @@
|
|
|
66102
66119
|
const lastSpec = this._spec.find(_s => _s.id === s.id);
|
|
66103
66120
|
if (!lastSpec.id) return result.reMake = !0, result;
|
|
66104
66121
|
if (lastSpec.type !== s.type) return result.reMake = !0, result;
|
|
66105
|
-
if (!isEqual(lastSpec.specified, s.specified))
|
|
66122
|
+
if (!isEqual(lastSpec.specified, s.specified)) {
|
|
66123
|
+
if ("color" !== s.id) return result.reMake = !0, result;
|
|
66124
|
+
const colorScale = scale;
|
|
66125
|
+
if (colorScale.setSpecified) colorScale.setSpecified(s.specified);else {
|
|
66126
|
+
if (!s.specified || !colorScale.specified) return result.reMake = !0, result;
|
|
66127
|
+
colorScale.specified(s.specified);
|
|
66128
|
+
}
|
|
66129
|
+
result.reRender = !0;
|
|
66130
|
+
}
|
|
66106
66131
|
s.range && !isEqual(s.range, scale.range()) && (scale.range(s.range), result.reRender = !0), isDataDomainSpec(s.domain) ? result.reRender = !0 : isEqual(s.domain, scale.domain()) || (scale.domain(s.domain), result.reRender = !0), this._scaleSpecMap.set(s.id, s);
|
|
66107
66132
|
}
|
|
66108
66133
|
return this._spec = spec, result;
|