2
0
mirror of https://github.com/esiur/iui.git synced 2025-09-13 15:13:18 +00:00
This commit is contained in:
2021-10-29 17:09:15 +03:00
parent 1e8ae99d39
commit b3479dbdbd
35 changed files with 857 additions and 166 deletions

View File

@@ -39,43 +39,56 @@ export default IUI.module(class Include extends IUIElement
//let xeval = (code) => eval(code);
// call create for the new elements
var newElements = this.querySelectorAll("*");
for (var i = 0; i < newElements.length; i++) {
var el = newElements[i];
// set route for all elements
//newElements[i].route = this.route;
el.route = this.route;
el.view = this;
if (el.hasAttribute("ref")) {
this.refs[el.getAttribute("ref")] = el;
}
if (el instanceof HTMLScriptElement) {
// this because HTML parser don't evaluate script tag
let func = new Function("//# sourceURL=iui://" + src + "-" + Math.round(Math.random() * 10000) + "\r\n return " + el.text.trim());// "return " + el.text + ";");
let rt = func.call(el.parentElement);
//let rt = xeval.call(el.parentElement, "//# sourceURL=iui://" + src + Math.round(Math.random() * 10000) + "\r\n (" + el.text + ")");
if (typeof (rt) === "object") {
for (var k in rt)
el.parentElement[k] = rt[k];
}
}
if (window?.app?.loaded)
{
await IUI.create(this);
await IUI.created(this);
IUI.bind(this, this, "include:" + src);
await IUI.render(this, this._data, true);
}
// // call create for the new elements
// var newElements = this.querySelectorAll("*");
// for (var i = 0; i < newElements.length; i++) {
// var el = newElements[i];
// // set route for all elements
// //newElements[i].route = this.route;
// el.route = this.route;
// el.view = this;
// if (el.hasAttribute("ref")) {
// this.refs[el.getAttribute("ref")] = el;
// }
// if (el instanceof HTMLScriptElement) {
// // this because HTML parser don't evaluate script tag
// let func = new Function("//# sourceURL=iui://" + src + "-" + Math.round(Math.random() * 10000) + "\r\n return " + el.text.trim());// "return " + el.text + ";");
// let rt = func.call(el.parentElement);
// //let rt = xeval.call(el.parentElement, "//# sourceURL=iui://" + src + Math.round(Math.random() * 10000) + "\r\n (" + el.text + ")");
// if (typeof (rt) === "object") {
// for (var k in rt)
// el.parentElement[k] = rt[k];
// }
// }
// }
}
this.classList.remove(this.cssClass + "-loading");
if (window?.app?.loaded)
{
await IUI.create(this);
await IUI.created(this);
this.updateBindings();
await this.render();
}
// if (window?.app?.loaded)
// {
// await IUI.create(this);
// await IUI.created(this);
// for(let i = 0; i < this.children.length; i++)
// {
// let el = this.children[i];
// IUIElement._make_bindings(el);
// await IUIElement._renderElement(el, el._data);
// }
// }
this._loading = false;
}

View File

@@ -190,7 +190,8 @@ export default IUI.module(class Repeat extends IUIElement
//console.log("ST4");
this._make_bindings(e)
//this._make_bindings(e)
IUI.bind(e, this, "repeat");
this._container.insertBefore(e, this._beforeNode);
this._assign(e, i);// { view: this.view, route: this.route, index: i });
@@ -260,9 +261,7 @@ export default IUI.module(class Repeat extends IUIElement
}
//super._uiBindings = null;
//super.updateBindings();
// @TODO: check if this works for event names starting with ":"
this._emit(":data", { data: value });
// this._emit("modified", { data: value, property: "data" });