@visactor/vdataset
Advanced tools
Comparing version 0.16.4 to 0.16.5
@@ -27,3 +27,3 @@ import type { DataView } from './data-view'; | ||
multipleDataViewAddListener(list: DataView[], event: string, call: Function): void; | ||
allDataViewAddListener(event: string, call: Function): void; | ||
allDataViewAddListener(event: string, call: () => void): void; | ||
multipleDataViewRemoveListener(list: DataView[], event: string, call: Function): void; | ||
@@ -30,0 +30,0 @@ multipleDataViewUpdateInParse(newData: { |
@@ -13,5 +13,4 @@ "use strict"; | ||
this.options = options, this.isDataSet = !0, this.transformMap = {}, this.parserMap = {}, | ||
this.dataViewMap = {}, this.target = new vutils_1.EventEmitter, this._callMap = new Map, | ||
name = (null == options ? void 0 : options.name) ? options.name : (0, uuid_1.getUUID)("dataset"), | ||
this.name = name; | ||
this.dataViewMap = {}, this.target = new vutils_1.EventEmitter, name = (null == options ? void 0 : options.name) ? options.name : (0, | ||
uuid_1.getUUID)("dataset"), this.name = name; | ||
} | ||
@@ -48,2 +47,3 @@ getDataView(name) { | ||
multipleDataViewAddListener(list, event, call) { | ||
this._callMap || (this._callMap = new Map); | ||
let callAd = this._callMap.get(call); | ||
@@ -60,6 +60,8 @@ callAd || (callAd = () => { | ||
multipleDataViewRemoveListener(list, event, call) { | ||
const callAd = this._callMap.get(call); | ||
callAd && list.forEach((l => { | ||
l.target.removeListener(event, callAd); | ||
})), this._callMap.delete(call); | ||
if (this._callMap) { | ||
const callAd = this._callMap.get(call); | ||
callAd && list.forEach((l => { | ||
l.target.removeListener(event, callAd); | ||
})), this._callMap.delete(call); | ||
} | ||
} | ||
@@ -66,0 +68,0 @@ multipleDataViewUpdateInParse(newData) { |
@@ -16,17 +16,17 @@ "use strict"; | ||
this.parseOption = null, this.transformsArr = [], this.isRunning = !1, this.rawData = {}, | ||
this.history = !1, this.historyData = [], this.parserData = {}, this.latestData = {}, | ||
this._fields = null, this._diffData = !1, this._diffKeys = null, this._diffMap = new Map, | ||
this._diffRank = 0, this.reRunAllTransform = (opt = { | ||
this.history = !1, this.parserData = {}, this.latestData = {}, this._fields = null, | ||
this.reRunAllTransform = (opt = { | ||
pushHistory: !0, | ||
emitMessage: !0 | ||
}) => (this.isRunning = !0, this.resetTransformData(), this.transformsArr.forEach((t => { | ||
this.executeTransform(t, Object.assign(Object.assign({}, opt), { | ||
this.executeTransform(t, { | ||
pushHistory: opt.pushHistory, | ||
emitMessage: !1 | ||
})), this.isLastTransform(t) && this.diffLastData(); | ||
})), this.isRunning = !1, !1 !== (null == opt ? void 0 : opt.emitMessage) && this.target.emit("change", []), | ||
}), this.isLastTransform(t) && this.diffLastData(); | ||
})), this.isRunning = !1, !1 !== opt.emitMessage && this.target.emit("change", []), | ||
this), this.markRunning = () => { | ||
this.isRunning = !0, this.target.emit("markRunning", []); | ||
}, name = (null == options ? void 0 : options.name) ? options.name : (0, uuid_1.getUUID)("dataview"), | ||
this.name = name, (null == options ? void 0 : options.history) && (this.history = options.history), | ||
this.dataSet.setDataView(name, this), this.setFields(null == options ? void 0 : options.fields); | ||
this.name = name, (null == options ? void 0 : options.history) && (this.history = options.history, | ||
this.historyData = []), this.dataSet.setDataView(name, this), this.setFields(null == options ? void 0 : options.fields); | ||
} | ||
@@ -38,3 +38,2 @@ parse(data, options, emit = !1) { | ||
if (null == options ? void 0 : options.type) { | ||
options = (0, vutils_1.cloneDeep)(options); | ||
const parserData = (null !== (_a = this.dataSet.getParser(options.type)) && void 0 !== _a ? _a : this.dataSet.getParser("bytejson"))(cloneData, options.options, this); | ||
@@ -57,3 +56,3 @@ this.rawData = cloneData, this.parserData = parserData, this.history && this.historyData.push(cloneData, parserData), | ||
const lastTag = this.isLastTransform(options); | ||
options = (0, vutils_1.cloneDeep)(options), this.executeTransform(options), lastTag && this.diffLastData(); | ||
this.executeTransform(options), lastTag && this.diffLastData(); | ||
} | ||
@@ -67,3 +66,3 @@ } | ||
sortTransform() { | ||
this.transformsArr.sort(((a, b) => { | ||
this.transformsArr.length >= 2 && this.transformsArr.sort(((a, b) => { | ||
var _a, _b; | ||
@@ -86,6 +85,6 @@ return (null !== (_a = a.level) && void 0 !== _a ? _a : 0) - (null !== (_b = b.level) && void 0 !== _b ? _b : 0); | ||
enableDiff(keys) { | ||
this._diffData = !0, this._diffKeys = keys; | ||
this._diffData = !0, this._diffKeys = keys, this._diffMap = new Map, this._diffRank = 0; | ||
} | ||
disableDiff() { | ||
this._diffData = !1, this.resetDiff(); | ||
this._diffData = !1, this._diffMap = null, this._diffRank = null; | ||
} | ||
@@ -152,4 +151,5 @@ resetDiff() { | ||
destroy() { | ||
this.dataSet.removeDataView(this.name), this.resetDiff(), this.latestData = null, | ||
this.rawData = null, this.parserData = null, this.transformsArr = null, this.target = null; | ||
this.dataSet.removeDataView(this.name), this._diffMap = null, this._diffRank = null, | ||
this.latestData = null, this.rawData = null, this.parserData = null, this.transformsArr = null, | ||
this.target = null; | ||
} | ||
@@ -156,0 +156,0 @@ } |
@@ -27,3 +27,3 @@ import type { DataView } from './data-view'; | ||
multipleDataViewAddListener(list: DataView[], event: string, call: Function): void; | ||
allDataViewAddListener(event: string, call: Function): void; | ||
allDataViewAddListener(event: string, call: () => void): void; | ||
multipleDataViewRemoveListener(list: DataView[], event: string, call: Function): void; | ||
@@ -30,0 +30,0 @@ multipleDataViewUpdateInParse(newData: { |
@@ -9,4 +9,3 @@ import { EventEmitter } from "@visactor/vutils"; | ||
this.options = options, this.isDataSet = !0, this.transformMap = {}, this.parserMap = {}, | ||
this.dataViewMap = {}, this.target = new EventEmitter, this._callMap = new Map, | ||
name = (null == options ? void 0 : options.name) ? options.name : getUUID("dataset"), | ||
this.dataViewMap = {}, this.target = new EventEmitter, name = (null == options ? void 0 : options.name) ? options.name : getUUID("dataset"), | ||
this.name = name; | ||
@@ -44,2 +43,3 @@ } | ||
multipleDataViewAddListener(list, event, call) { | ||
this._callMap || (this._callMap = new Map); | ||
let callAd = this._callMap.get(call); | ||
@@ -56,6 +56,8 @@ callAd || (callAd = () => { | ||
multipleDataViewRemoveListener(list, event, call) { | ||
const callAd = this._callMap.get(call); | ||
callAd && list.forEach((l => { | ||
l.target.removeListener(event, callAd); | ||
})), this._callMap.delete(call); | ||
if (this._callMap) { | ||
const callAd = this._callMap.get(call); | ||
callAd && list.forEach((l => { | ||
l.target.removeListener(event, callAd); | ||
})), this._callMap.delete(call); | ||
} | ||
} | ||
@@ -62,0 +64,0 @@ multipleDataViewUpdateInParse(newData) { |
@@ -14,17 +14,17 @@ import { cloneDeep, EventEmitter, merge, isNil } from "@visactor/vutils"; | ||
this.parseOption = null, this.transformsArr = [], this.isRunning = !1, this.rawData = {}, | ||
this.history = !1, this.historyData = [], this.parserData = {}, this.latestData = {}, | ||
this._fields = null, this._diffData = !1, this._diffKeys = null, this._diffMap = new Map, | ||
this._diffRank = 0, this.reRunAllTransform = (opt = { | ||
this.history = !1, this.parserData = {}, this.latestData = {}, this._fields = null, | ||
this.reRunAllTransform = (opt = { | ||
pushHistory: !0, | ||
emitMessage: !0 | ||
}) => (this.isRunning = !0, this.resetTransformData(), this.transformsArr.forEach((t => { | ||
this.executeTransform(t, Object.assign(Object.assign({}, opt), { | ||
this.executeTransform(t, { | ||
pushHistory: opt.pushHistory, | ||
emitMessage: !1 | ||
})), this.isLastTransform(t) && this.diffLastData(); | ||
})), this.isRunning = !1, !1 !== (null == opt ? void 0 : opt.emitMessage) && this.target.emit("change", []), | ||
}), this.isLastTransform(t) && this.diffLastData(); | ||
})), this.isRunning = !1, !1 !== opt.emitMessage && this.target.emit("change", []), | ||
this), this.markRunning = () => { | ||
this.isRunning = !0, this.target.emit("markRunning", []); | ||
}, name = (null == options ? void 0 : options.name) ? options.name : getUUID("dataview"), | ||
this.name = name, (null == options ? void 0 : options.history) && (this.history = options.history), | ||
this.dataSet.setDataView(name, this), this.setFields(null == options ? void 0 : options.fields); | ||
this.name = name, (null == options ? void 0 : options.history) && (this.history = options.history, | ||
this.historyData = []), this.dataSet.setDataView(name, this), this.setFields(null == options ? void 0 : options.fields); | ||
} | ||
@@ -36,3 +36,2 @@ parse(data, options, emit = !1) { | ||
if (null == options ? void 0 : options.type) { | ||
options = cloneDeep(options); | ||
const parserData = (null !== (_a = this.dataSet.getParser(options.type)) && void 0 !== _a ? _a : this.dataSet.getParser("bytejson"))(cloneData, options.options, this); | ||
@@ -55,3 +54,3 @@ this.rawData = cloneData, this.parserData = parserData, this.history && this.historyData.push(cloneData, parserData), | ||
const lastTag = this.isLastTransform(options); | ||
options = cloneDeep(options), this.executeTransform(options), lastTag && this.diffLastData(); | ||
this.executeTransform(options), lastTag && this.diffLastData(); | ||
} | ||
@@ -65,3 +64,3 @@ } | ||
sortTransform() { | ||
this.transformsArr.sort(((a, b) => { | ||
this.transformsArr.length >= 2 && this.transformsArr.sort(((a, b) => { | ||
var _a, _b; | ||
@@ -84,6 +83,6 @@ return (null !== (_a = a.level) && void 0 !== _a ? _a : 0) - (null !== (_b = b.level) && void 0 !== _b ? _b : 0); | ||
enableDiff(keys) { | ||
this._diffData = !0, this._diffKeys = keys; | ||
this._diffData = !0, this._diffKeys = keys, this._diffMap = new Map, this._diffRank = 0; | ||
} | ||
disableDiff() { | ||
this._diffData = !1, this.resetDiff(); | ||
this._diffData = !1, this._diffMap = null, this._diffRank = null; | ||
} | ||
@@ -150,6 +149,7 @@ resetDiff() { | ||
destroy() { | ||
this.dataSet.removeDataView(this.name), this.resetDiff(), this.latestData = null, | ||
this.rawData = null, this.parserData = null, this.transformsArr = null, this.target = null; | ||
this.dataSet.removeDataView(this.name), this._diffMap = null, this._diffRank = null, | ||
this.latestData = null, this.rawData = null, this.parserData = null, this.transformsArr = null, | ||
this.target = null; | ||
} | ||
} | ||
//# sourceMappingURL=data-view.js.map |
{ | ||
"name": "@visactor/vdataset", | ||
"version": "0.16.4", | ||
"version": "0.16.5", | ||
"main": "cjs/index.js", | ||
@@ -28,3 +28,3 @@ "module": "es/index.js", | ||
"dependencies": { | ||
"@visactor/vutils": "0.16.4", | ||
"@visactor/vutils": "0.16.5", | ||
"@turf/flatten": "^6.5.0", | ||
@@ -31,0 +31,0 @@ "@turf/helpers": "^6.5.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
834781
14720
+ Added@visactor/vutils@0.16.5(transitive)
- Removed@visactor/vutils@0.16.4(transitive)
Updated@visactor/vutils@0.16.5