UNPKG

@visactor/vchart

Version:

charts lib based @visactor/VGrammar

30 lines (27 loc) 981 B
import { createID } from "../util/id"; import { CompilableBase } from "./compilable-base"; import { Factory } from "../core/factory"; export class GrammarItem extends CompilableBase { constructor() { super(...arguments), this.id = 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.getGrammarTransform(entry.type)) || void 0 === _a ? void 0 : _a.transform(entry, current); })), current; } } //# sourceMappingURL=grammar-item.js.map