dom-render
Advanced tools
Comparing version 1.0.36 to 1.0.37
@@ -466,3 +466,8 @@ 'use strict'; | ||
var textContent = cNode.textContent; | ||
var n = document.createTextNode(ScriptUtils.eval("\n const " + RawSet.SCRIPTS_VARNAME + " = this.__render.scripts;\n const " + RawSet.RAWSET_VARNAME + " = this.__render.rawset;\n return `" + textContent + "`\n ", (config === null || config === void 0 ? void 0 : config.scripts) ? Object.assign(obj, { __render: Object.freeze({ rawset: _this, scripts: config === null || config === void 0 ? void 0 : config.scripts }) }) : obj)); | ||
var n = document.createTextNode(ScriptUtils.eval("\n const " + RawSet.SCRIPTS_VARNAME + " = this.__render.scripts;\n const " + RawSet.RAWSET_VARNAME + " = this.__render.rawset;\n return `" + textContent + "`\n ", Object.assign(obj, { | ||
__render: Object.freeze({ | ||
rawset: _this, | ||
scripts: _this.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) | ||
}) | ||
}))); | ||
(_a = cNode.parentNode) === null || _a === void 0 ? void 0 : _a.replaceChild(n, cNode); | ||
@@ -488,3 +493,11 @@ } | ||
var newTemp = document.createElement('temp'); | ||
ScriptUtils.eval("\n const " + RawSet.SCRIPTS_VARNAME + " = this.__render.scripts;\n const " + RawSet.RAWSET_VARNAME + " = this.__render.rawset;\n const n = this.__render.element.cloneNode(true);\n var destIt = " + drAttr.drItOption + ";\n if (destIt !== undefined) {\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt);\n }\n if (this.__render.drStripOption) {\n Array.from(n.childNodes).forEach(it => this.__fag.append(it));\n } else {\n this.__render.fag.append(n);\n }", Object.assign(obj, { __render: Object.freeze({ fag: newTemp, drStripOption: drAttr.drStripOption, element: element_2, rawset: _this, scripts: config === null || config === void 0 ? void 0 : config.scripts }) })); | ||
ScriptUtils.eval("\n const " + RawSet.SCRIPTS_VARNAME + " = this.__render.scripts;\n const " + RawSet.RAWSET_VARNAME + " = this.__render.rawset;\n const n = this.__render.element.cloneNode(true);\n var destIt = " + drAttr.drItOption + ";\n if (destIt !== undefined) {\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt);\n }\n if (this.__render.drStripOption) {\n Array.from(n.childNodes).forEach(it => this.__fag.append(it));\n } else {\n this.__render.fag.append(n);\n }", Object.assign(obj, { | ||
__render: Object.freeze({ | ||
fag: newTemp, | ||
drStripOption: drAttr.drStripOption, | ||
element: element_2, | ||
rawset: _this, | ||
scripts: _this.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) | ||
}) | ||
})); | ||
RawSet.drVarDecoding(newTemp, vars); | ||
@@ -503,3 +516,11 @@ RawSet.drItOtherDecoding(newTemp, itRandom); | ||
var newTemp = document.createElement('temp'); | ||
ScriptUtils.eval("\n const " + RawSet.SCRIPTS_VARNAME + " = this.__render.scripts;\n const " + RawSet.RAWSET_VARNAME + " = this.__render.rawset;\n if(" + drAttr.drIf + ") {\n const n = this.__render.element.cloneNode(true);\n var destIt = " + drAttr.drItOption + ";\n if (destIt !== undefined) {\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt);\n }\n if (this.__render.drStripOption) {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n }", Object.assign(obj, { __render: Object.freeze({ fag: newTemp, drStripOption: drAttr.drStripOption, element: element_2, rawset: _this, scripts: config === null || config === void 0 ? void 0 : config.scripts }) })); | ||
ScriptUtils.eval("\n const " + RawSet.SCRIPTS_VARNAME + " = this.__render.scripts;\n const " + RawSet.RAWSET_VARNAME + " = this.__render.rawset;\n if(" + drAttr.drIf + ") {\n const n = this.__render.element.cloneNode(true);\n var destIt = " + drAttr.drItOption + ";\n if (destIt !== undefined) {\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt);\n }\n if (this.__render.drStripOption) {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n }", Object.assign(obj, { | ||
__render: Object.freeze({ | ||
fag: newTemp, | ||
drStripOption: drAttr.drStripOption, | ||
element: element_2, | ||
rawset: _this, | ||
scripts: _this.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) | ||
}) | ||
})); | ||
RawSet.drVarDecoding(newTemp, vars); | ||
@@ -530,3 +551,6 @@ RawSet.drItOtherDecoding(newTemp, itRandom); | ||
ScriptUtils.eval("\n const n = this.__element.cloneNode(true);\n n.innerText = this.__data;\n if (this.__drStripOption) {\n Array.from(n.childNodes).forEach(it => this.__fag.append(it));\n } else {\n this.__fag.append(n);\n }\n ", Object.assign({ | ||
__fag: newTemp, __drStripOption: drAttr.drStripOption, __data: data, __element: element_2 | ||
__fag: newTemp, | ||
__drStripOption: drAttr.drStripOption, | ||
__data: data, | ||
__element: element_2 | ||
}, obj)); | ||
@@ -544,3 +568,6 @@ var tempalte = document.createElement('template'); | ||
ScriptUtils.eval("\n const n = this.__element.cloneNode(true);\n n.innerHTML = this.__data;\n if (this.__drStripOption) {\n Array.from(n.childNodes).forEach(it => this.__fag.append(it));\n } else {\n this.__fag.append(n);\n }\n ", Object.assign({ | ||
__fag: newTemp, __drStripOption: drAttr.drStripOption, __data: data, __element: element_2 | ||
__fag: newTemp, | ||
__drStripOption: drAttr.drStripOption, | ||
__data: data, | ||
__element: element_2 | ||
}, obj)); | ||
@@ -558,3 +585,10 @@ var tempalte = document.createElement('template'); | ||
var newTemp = document.createElement('temp'); | ||
ScriptUtils.eval("\n const " + RawSet.SCRIPTS_VARNAME + " = this.__render.scripts;\n for(" + drAttr.drFor + ") {\n const n = this.__render.element.cloneNode(true);\n var destIt = " + drAttr.drItOption + ";\n if (destIt !== undefined) {\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt);\n }\n if (this.__render.drStripOption) {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n }", Object.assign(obj, { __render: Object.freeze({ fag: newTemp, drStripOption: drAttr.drStripOption, element: element_2, scripts: config === null || config === void 0 ? void 0 : config.scripts }) })); | ||
ScriptUtils.eval("\n const " + RawSet.SCRIPTS_VARNAME + " = this.__render.scripts;\n for(" + drAttr.drFor + ") {\n const n = this.__render.element.cloneNode(true);\n var destIt = " + drAttr.drItOption + ";\n if (destIt !== undefined) {\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt);\n }\n if (this.__render.drStripOption) {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n }", Object.assign(obj, { | ||
__render: Object.freeze({ | ||
fag: newTemp, | ||
drStripOption: drAttr.drStripOption, | ||
element: element_2, | ||
scripts: _this.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) | ||
}) | ||
})); | ||
RawSet.drVarDecoding(newTemp, vars); | ||
@@ -573,3 +607,10 @@ RawSet.drItOtherDecoding(newTemp, itRandom); | ||
var newTemp = document.createElement('temp'); | ||
ScriptUtils.eval("\n const " + RawSet.SCRIPTS_VARNAME + " = this.__render.scripts;\n var i = 0; \n for(const it of " + drAttr.drForOf + ") {\n var destIt = it;\n var forOfStr = `" + drAttr.drForOf + "`;\n if (/,/g.test(forOfStr)) {\n if (typeof it === 'string') {\n destIt = it;\n } else {\n destIt = forOfStr.substring(1, forOfStr.length-1).split(',')[i];\n }\n } else {\n destIt = forOfStr + '[' + i +']'\n }\n \n const n = this.__render.element.cloneNode(true);\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt);\n \n if (this.__render.drStripOption) {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n i++;\n }", Object.assign(obj, { __render: Object.freeze({ drStripOption: drAttr.drStripOption, fag: newTemp, element: element_2 }) })); | ||
ScriptUtils.eval("\n const " + RawSet.SCRIPTS_VARNAME + " = this.__render.scripts;\n var i = 0; \n for(const it of " + drAttr.drForOf + ") {\n var destIt = it;\n var forOfStr = `" + drAttr.drForOf + "`;\n if (/,/g.test(forOfStr)) {\n if (typeof it === 'string') {\n destIt = it;\n } else {\n destIt = forOfStr.substring(1, forOfStr.length-1).split(',')[i];\n }\n } else {\n destIt = forOfStr + '[' + i +']'\n }\n \n const n = this.__render.element.cloneNode(true);\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt);\n \n if (this.__render.drStripOption) {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n i++;\n }", Object.assign(obj, { | ||
__render: Object.freeze({ | ||
drStripOption: drAttr.drStripOption, | ||
fag: newTemp, | ||
element: element_2, | ||
scripts: _this.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) | ||
}) | ||
})); | ||
RawSet.drVarDecoding(newTemp, vars); | ||
@@ -598,3 +639,6 @@ RawSet.drItOtherDecoding(newTemp, itRandom); | ||
raws.push.apply(raws, rr); | ||
onElementInitCallBack.push({ name: name, obj: obj }); | ||
onElementInitCallBack.push({ | ||
name: name, | ||
obj: obj | ||
}); | ||
(_b = it === null || it === void 0 ? void 0 : it.complete) === null || _b === void 0 ? void 0 : _b.call(it, element_2, obj, _this); | ||
@@ -615,3 +659,7 @@ } | ||
raws.push.apply(raws, rr); | ||
onAttrInitCallBack.push({ attrName: attrName, attrValue: attrValue, obj: obj }); | ||
onAttrInitCallBack.push({ | ||
attrName: attrName, | ||
attrValue: attrValue, | ||
obj: obj | ||
}); | ||
(_b = it === null || it === void 0 ? void 0 : it.complete) === null || _b === void 0 ? void 0 : _b.call(it, element_2, attrValue, obj, _this); | ||
@@ -668,3 +716,9 @@ } | ||
var a = StringUtils.regexExec(/\$\{.*?\}/g, text); | ||
var map = a.map(function (it) { return { uuid: RandomUtils.uuid(), content: it[0], regexArr: it }; }); | ||
var map = a.map(function (it) { | ||
return { | ||
uuid: RandomUtils.uuid(), | ||
content: it[0], | ||
regexArr: it | ||
}; | ||
}); | ||
var lasterIndex_1 = 0; | ||
@@ -681,3 +735,6 @@ map.forEach(function (it) { | ||
fragment.append(document.createTextNode(it.content)); | ||
pars.push(new RawSet(it.uuid, { start: start, end: end }, fragment)); | ||
pars.push(new RawSet(it.uuid, { | ||
start: start, | ||
end: end | ||
}, fragment)); | ||
lasterIndex_1 = regexArr.index + it.content.length; | ||
@@ -696,3 +753,6 @@ }); | ||
fragment.append(currentNode); | ||
pars.push(new RawSet(uuid, { start: start, end: end }, fragment)); | ||
pars.push(new RawSet(uuid, { | ||
start: start, | ||
end: end | ||
}, fragment)); | ||
} | ||
@@ -794,2 +854,14 @@ }; | ||
}; | ||
RawSet.prototype.setBindProperty = function (scripts, obj) { | ||
if (scripts) { | ||
var newScripts = Object.assign({}, scripts); | ||
for (var _i = 0, _a = Object.entries(newScripts); _i < _a.length; _i++) { | ||
var _b = _a[_i], key = _b[0], value = _b[1]; | ||
if (typeof value === 'function') { | ||
newScripts[key] = value.bind(obj); | ||
} | ||
} | ||
return newScripts; | ||
} | ||
}; | ||
RawSet.DR = 'dr'; | ||
@@ -889,2 +961,3 @@ RawSet.DR_IF_NAME = 'dr-if'; | ||
var _this = this; | ||
console.log('render-->raws', raws); | ||
(raws !== null && raws !== void 0 ? raws : this.getRawSets()).forEach(function (it) { | ||
@@ -891,0 +964,0 @@ if (it.point.start.isConnected && it.point.start.isConnected) { |
@@ -79,2 +79,3 @@ "use strict"; | ||
var _this = this; | ||
console.log('render-->raws', raws); | ||
(raws !== null && raws !== void 0 ? raws : this.getRawSets()).forEach(function (it) { | ||
@@ -81,0 +82,0 @@ if (it.point.start.isConnected && it.point.start.isConnected) { |
{ | ||
"name": "dom-render", | ||
"version": "1.0.36", | ||
"version": "1.0.37", | ||
"main": "DomRender.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -53,2 +53,10 @@ import { Config } from './Config'; | ||
static drThisCreate(element: Element, drThis: string, drVarOption: string, drStripOption: boolean, obj: any): DocumentFragment; | ||
private setBindProperty; | ||
} | ||
export declare type Render = { | ||
rawset: RawSet; | ||
scripts: { | ||
[n: string]: any; | ||
}; | ||
[n: string]: any; | ||
}; |
@@ -55,3 +55,8 @@ "use strict"; | ||
var textContent = cNode.textContent; | ||
var n = document.createTextNode(ScriptUtils_1.ScriptUtils.eval("\n const " + RawSet.SCRIPTS_VARNAME + " = this.__render.scripts;\n const " + RawSet.RAWSET_VARNAME + " = this.__render.rawset;\n return `" + textContent + "`\n ", (config === null || config === void 0 ? void 0 : config.scripts) ? Object.assign(obj, { __render: Object.freeze({ rawset: _this, scripts: config === null || config === void 0 ? void 0 : config.scripts }) }) : obj)); | ||
var n = document.createTextNode(ScriptUtils_1.ScriptUtils.eval("\n const " + RawSet.SCRIPTS_VARNAME + " = this.__render.scripts;\n const " + RawSet.RAWSET_VARNAME + " = this.__render.rawset;\n return `" + textContent + "`\n ", Object.assign(obj, { | ||
__render: Object.freeze({ | ||
rawset: _this, | ||
scripts: _this.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) | ||
}) | ||
}))); | ||
(_a = cNode.parentNode) === null || _a === void 0 ? void 0 : _a.replaceChild(n, cNode); | ||
@@ -77,3 +82,11 @@ } | ||
var newTemp = document.createElement('temp'); | ||
ScriptUtils_1.ScriptUtils.eval("\n const " + RawSet.SCRIPTS_VARNAME + " = this.__render.scripts;\n const " + RawSet.RAWSET_VARNAME + " = this.__render.rawset;\n const n = this.__render.element.cloneNode(true);\n var destIt = " + drAttr.drItOption + ";\n if (destIt !== undefined) {\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt);\n }\n if (this.__render.drStripOption) {\n Array.from(n.childNodes).forEach(it => this.__fag.append(it));\n } else {\n this.__render.fag.append(n);\n }", Object.assign(obj, { __render: Object.freeze({ fag: newTemp, drStripOption: drAttr.drStripOption, element: element_2, rawset: _this, scripts: config === null || config === void 0 ? void 0 : config.scripts }) })); | ||
ScriptUtils_1.ScriptUtils.eval("\n const " + RawSet.SCRIPTS_VARNAME + " = this.__render.scripts;\n const " + RawSet.RAWSET_VARNAME + " = this.__render.rawset;\n const n = this.__render.element.cloneNode(true);\n var destIt = " + drAttr.drItOption + ";\n if (destIt !== undefined) {\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt);\n }\n if (this.__render.drStripOption) {\n Array.from(n.childNodes).forEach(it => this.__fag.append(it));\n } else {\n this.__render.fag.append(n);\n }", Object.assign(obj, { | ||
__render: Object.freeze({ | ||
fag: newTemp, | ||
drStripOption: drAttr.drStripOption, | ||
element: element_2, | ||
rawset: _this, | ||
scripts: _this.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) | ||
}) | ||
})); | ||
RawSet.drVarDecoding(newTemp, vars); | ||
@@ -92,3 +105,11 @@ RawSet.drItOtherDecoding(newTemp, itRandom); | ||
var newTemp = document.createElement('temp'); | ||
ScriptUtils_1.ScriptUtils.eval("\n const " + RawSet.SCRIPTS_VARNAME + " = this.__render.scripts;\n const " + RawSet.RAWSET_VARNAME + " = this.__render.rawset;\n if(" + drAttr.drIf + ") {\n const n = this.__render.element.cloneNode(true);\n var destIt = " + drAttr.drItOption + ";\n if (destIt !== undefined) {\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt);\n }\n if (this.__render.drStripOption) {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n }", Object.assign(obj, { __render: Object.freeze({ fag: newTemp, drStripOption: drAttr.drStripOption, element: element_2, rawset: _this, scripts: config === null || config === void 0 ? void 0 : config.scripts }) })); | ||
ScriptUtils_1.ScriptUtils.eval("\n const " + RawSet.SCRIPTS_VARNAME + " = this.__render.scripts;\n const " + RawSet.RAWSET_VARNAME + " = this.__render.rawset;\n if(" + drAttr.drIf + ") {\n const n = this.__render.element.cloneNode(true);\n var destIt = " + drAttr.drItOption + ";\n if (destIt !== undefined) {\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt);\n }\n if (this.__render.drStripOption) {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n }", Object.assign(obj, { | ||
__render: Object.freeze({ | ||
fag: newTemp, | ||
drStripOption: drAttr.drStripOption, | ||
element: element_2, | ||
rawset: _this, | ||
scripts: _this.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) | ||
}) | ||
})); | ||
RawSet.drVarDecoding(newTemp, vars); | ||
@@ -119,3 +140,6 @@ RawSet.drItOtherDecoding(newTemp, itRandom); | ||
ScriptUtils_1.ScriptUtils.eval("\n const n = this.__element.cloneNode(true);\n n.innerText = this.__data;\n if (this.__drStripOption) {\n Array.from(n.childNodes).forEach(it => this.__fag.append(it));\n } else {\n this.__fag.append(n);\n }\n ", Object.assign({ | ||
__fag: newTemp, __drStripOption: drAttr.drStripOption, __data: data, __element: element_2 | ||
__fag: newTemp, | ||
__drStripOption: drAttr.drStripOption, | ||
__data: data, | ||
__element: element_2 | ||
}, obj)); | ||
@@ -133,3 +157,6 @@ var tempalte = document.createElement('template'); | ||
ScriptUtils_1.ScriptUtils.eval("\n const n = this.__element.cloneNode(true);\n n.innerHTML = this.__data;\n if (this.__drStripOption) {\n Array.from(n.childNodes).forEach(it => this.__fag.append(it));\n } else {\n this.__fag.append(n);\n }\n ", Object.assign({ | ||
__fag: newTemp, __drStripOption: drAttr.drStripOption, __data: data, __element: element_2 | ||
__fag: newTemp, | ||
__drStripOption: drAttr.drStripOption, | ||
__data: data, | ||
__element: element_2 | ||
}, obj)); | ||
@@ -147,3 +174,10 @@ var tempalte = document.createElement('template'); | ||
var newTemp = document.createElement('temp'); | ||
ScriptUtils_1.ScriptUtils.eval("\n const " + RawSet.SCRIPTS_VARNAME + " = this.__render.scripts;\n for(" + drAttr.drFor + ") {\n const n = this.__render.element.cloneNode(true);\n var destIt = " + drAttr.drItOption + ";\n if (destIt !== undefined) {\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt);\n }\n if (this.__render.drStripOption) {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n }", Object.assign(obj, { __render: Object.freeze({ fag: newTemp, drStripOption: drAttr.drStripOption, element: element_2, scripts: config === null || config === void 0 ? void 0 : config.scripts }) })); | ||
ScriptUtils_1.ScriptUtils.eval("\n const " + RawSet.SCRIPTS_VARNAME + " = this.__render.scripts;\n for(" + drAttr.drFor + ") {\n const n = this.__render.element.cloneNode(true);\n var destIt = " + drAttr.drItOption + ";\n if (destIt !== undefined) {\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt);\n }\n if (this.__render.drStripOption) {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n }", Object.assign(obj, { | ||
__render: Object.freeze({ | ||
fag: newTemp, | ||
drStripOption: drAttr.drStripOption, | ||
element: element_2, | ||
scripts: _this.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) | ||
}) | ||
})); | ||
RawSet.drVarDecoding(newTemp, vars); | ||
@@ -162,3 +196,10 @@ RawSet.drItOtherDecoding(newTemp, itRandom); | ||
var newTemp = document.createElement('temp'); | ||
ScriptUtils_1.ScriptUtils.eval("\n const " + RawSet.SCRIPTS_VARNAME + " = this.__render.scripts;\n var i = 0; \n for(const it of " + drAttr.drForOf + ") {\n var destIt = it;\n var forOfStr = `" + drAttr.drForOf + "`;\n if (/,/g.test(forOfStr)) {\n if (typeof it === 'string') {\n destIt = it;\n } else {\n destIt = forOfStr.substring(1, forOfStr.length-1).split(',')[i];\n }\n } else {\n destIt = forOfStr + '[' + i +']'\n }\n \n const n = this.__render.element.cloneNode(true);\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt);\n \n if (this.__render.drStripOption) {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n i++;\n }", Object.assign(obj, { __render: Object.freeze({ drStripOption: drAttr.drStripOption, fag: newTemp, element: element_2 }) })); | ||
ScriptUtils_1.ScriptUtils.eval("\n const " + RawSet.SCRIPTS_VARNAME + " = this.__render.scripts;\n var i = 0; \n for(const it of " + drAttr.drForOf + ") {\n var destIt = it;\n var forOfStr = `" + drAttr.drForOf + "`;\n if (/,/g.test(forOfStr)) {\n if (typeof it === 'string') {\n destIt = it;\n } else {\n destIt = forOfStr.substring(1, forOfStr.length-1).split(',')[i];\n }\n } else {\n destIt = forOfStr + '[' + i +']'\n }\n \n const n = this.__render.element.cloneNode(true);\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt);\n \n if (this.__render.drStripOption) {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n i++;\n }", Object.assign(obj, { | ||
__render: Object.freeze({ | ||
drStripOption: drAttr.drStripOption, | ||
fag: newTemp, | ||
element: element_2, | ||
scripts: _this.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) | ||
}) | ||
})); | ||
RawSet.drVarDecoding(newTemp, vars); | ||
@@ -187,3 +228,6 @@ RawSet.drItOtherDecoding(newTemp, itRandom); | ||
raws.push.apply(raws, rr); | ||
onElementInitCallBack.push({ name: name, obj: obj }); | ||
onElementInitCallBack.push({ | ||
name: name, | ||
obj: obj | ||
}); | ||
(_b = it === null || it === void 0 ? void 0 : it.complete) === null || _b === void 0 ? void 0 : _b.call(it, element_2, obj, _this); | ||
@@ -204,3 +248,7 @@ } | ||
raws.push.apply(raws, rr); | ||
onAttrInitCallBack.push({ attrName: attrName, attrValue: attrValue, obj: obj }); | ||
onAttrInitCallBack.push({ | ||
attrName: attrName, | ||
attrValue: attrValue, | ||
obj: obj | ||
}); | ||
(_b = it === null || it === void 0 ? void 0 : it.complete) === null || _b === void 0 ? void 0 : _b.call(it, element_2, attrValue, obj, _this); | ||
@@ -257,3 +305,9 @@ } | ||
var a = StringUtils_1.StringUtils.regexExec(/\$\{.*?\}/g, text); | ||
var map = a.map(function (it) { return { uuid: RandomUtils_1.RandomUtils.uuid(), content: it[0], regexArr: it }; }); | ||
var map = a.map(function (it) { | ||
return { | ||
uuid: RandomUtils_1.RandomUtils.uuid(), | ||
content: it[0], | ||
regexArr: it | ||
}; | ||
}); | ||
var lasterIndex_1 = 0; | ||
@@ -270,3 +324,6 @@ map.forEach(function (it) { | ||
fragment.append(document.createTextNode(it.content)); | ||
pars.push(new RawSet(it.uuid, { start: start, end: end }, fragment)); | ||
pars.push(new RawSet(it.uuid, { | ||
start: start, | ||
end: end | ||
}, fragment)); | ||
lasterIndex_1 = regexArr.index + it.content.length; | ||
@@ -285,3 +342,6 @@ }); | ||
fragment.append(currentNode); | ||
pars.push(new RawSet(uuid, { start: start, end: end }, fragment)); | ||
pars.push(new RawSet(uuid, { | ||
start: start, | ||
end: end | ||
}, fragment)); | ||
} | ||
@@ -383,2 +443,14 @@ }; | ||
}; | ||
RawSet.prototype.setBindProperty = function (scripts, obj) { | ||
if (scripts) { | ||
var newScripts = Object.assign({}, scripts); | ||
for (var _i = 0, _a = Object.entries(newScripts); _i < _a.length; _i++) { | ||
var _b = _a[_i], key = _b[0], value = _b[1]; | ||
if (typeof value === 'function') { | ||
newScripts[key] = value.bind(obj); | ||
} | ||
} | ||
return newScripts; | ||
} | ||
}; | ||
RawSet.DR = 'dr'; | ||
@@ -385,0 +457,0 @@ RawSet.DR_IF_NAME = 'dr-if'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
130557
2522