UNPKG

@visactor/vchart

Version:

charts lib based @visactor/VGrammar

34 lines (30 loc) 1.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.GrammarItem = void 0; const id_1 = require("../util/id"), compilable_base_1 = require("./compilable-base"), factory_1 = require("../core/factory"); class GrammarItem extends compilable_base_1.CompilableBase { constructor() { super(...arguments), this.id = (0, id_1.createID)(), this._compiledProductId = null; } getProductId() { var _a; return null !== (_a = this._compiledProductId) && void 0 !== _a ? _a : this.generateProductId(); } compile(option) { this._compileProduct(option); } setTransform(transform) { this._transform = transform; } runTransforms(transforms, data) { if (!transforms || !transforms.length) return data; let current = data; return transforms.forEach((entry => { var _a; current = null === (_a = factory_1.Factory.getGrammarTransform(entry.type)) || void 0 === _a ? void 0 : _a.transform(entry, current); })), current; } } exports.GrammarItem = GrammarItem; //# sourceMappingURL=grammar-item.js.map