UNPKG

@dooboostore/dom-render

Version:
60 lines (59 loc) 2.5 kB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var OperatorExecuter_exports = {}; __export(OperatorExecuter_exports, { ExecuteState: () => ExecuteState, OperatorExecuter: () => OperatorExecuter }); module.exports = __toCommonJS(OperatorExecuter_exports); var import_core = require("@dooboostore/core"); var ExecuteState = /* @__PURE__ */ ((ExecuteState2) => { ExecuteState2[ExecuteState2["EXECUTE"] = 0] = "EXECUTE"; ExecuteState2[ExecuteState2["NO_EXECUTE"] = 1] = "NO_EXECUTE"; ExecuteState2[ExecuteState2["STOP"] = 2] = "STOP"; return ExecuteState2; })(ExecuteState || {}); class OperatorExecuter { constructor(rawSet, render, returnContainer, elementSource, source, afterCallBack, startingExecute = true) { this.rawSet = rawSet; this.render = render; this.returnContainer = returnContainer; this.elementSource = elementSource; this.source = source; this.afterCallBack = afterCallBack; this.startingExecute = startingExecute; } async start() { let attrValue = this.elementSource.attr; if (this.source.operatorAround?.beforeAttr) { attrValue = this.source.operatorAround.beforeAttr(attrValue, this) ?? ""; } let r = attrValue; if (r && this.startingExecute) { const optionalPath = import_core.ObjectUtils.Path.toOptionalChainPath(attrValue); r = import_core.ObjectUtils.Script.evaluate(` ${this.render.bindScript}; return ${optionalPath}`, Object.assign(this.source.obj, { __render: this.render })); } if (this.source.operatorAround?.before) { r = this.source.operatorAround?.before(r, this); } const state = await this.execute(r); this.source.operatorAround?.after?.(r, this); return state; } } //# sourceMappingURL=OperatorExecuter.js.map