UNPKG

@visactor/vchart

Version:

charts lib based @visactor/VGrammar

55 lines (50 loc) 1.76 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.CompilableData = void 0; const grammar_item_1 = require("../grammar-item"); class CompilableData extends grammar_item_1.GrammarItem { getProduct() { return this._product || (this._product = this.runTransforms(this._transform, this.getLatestData())), this._product; } getDataView() { return this._data; } setDataView(d) { this._data = d; } getLatestData() { var _a; return null === (_a = this._data) || void 0 === _a ? void 0 : _a.latestData; } constructor(option, dataView) { super(option), this._data = null, this._data = dataView; } removeProduct() { this._product = null, this._prevProduct = null, this._compiledProductId = null; } release() { this.removeProduct(), super.release(), this._data = null; } addRelatedMark(mark) { this._relatedMarks || (this._relatedMarks = {}), this._relatedMarks[mark.id] = mark; } updateData(noRender) { if (this._compileProduct(), this._relatedMarks) { let hasCommited = !1; if (Object.keys(this._relatedMarks).forEach((id => { this._relatedMarks[id] && (hasCommited = !0, this._relatedMarks[id].commit()); })), !noRender && hasCommited) return this.getCompiler().renderNextTick(); } } _compileProduct() { this._prevProduct = this._product, this._product = null; } generateProductId() { var _a; return `${null === (_a = this.getDataView()) || void 0 === _a ? void 0 : _a.name}`; } } exports.CompilableData = CompilableData; //# sourceMappingURL=compilable-data.js.map