2
0
mirror of https://github.com/esiur/iui.git synced 2025-06-27 09:23:12 +00:00
This commit is contained in:
2024-07-16 08:57:35 +03:00
parent 4b2a3f3834
commit 1552eaac30
4 changed files with 100 additions and 28 deletions

View File

@ -143,14 +143,12 @@ export default IUI.module(class Repeat extends IUIElement
value = [];
//debugger;
await super.setData(value, radix);
for (let i = 0; i < value.length; i++) {
let el = this._repeatNode.cloneNode(true);
el.setAttribute(":data", `d[${i}]`);
this.list.push(el);
try {
@ -171,6 +169,7 @@ export default IUI.module(class Repeat extends IUIElement
await IUI.created(el, true);
/*
if (el instanceof IUIElement){
// @TODO should check if the element depends on parent or not
if (el.dataMap != null) {
@ -194,9 +193,11 @@ export default IUI.module(class Repeat extends IUIElement
// data is now the radix
await IUI.render(el, el.data, false, value[i]);
}
*/
}
await super.setData(value, radix);
// @TODO: check if this works for event names starting with ":"

View File

@ -16,11 +16,18 @@ export default IUI.module(class Grid extends IUIElement {
this.windows = [];
}
create() {
async create() {
for (var i = 0; i < this.children.length; i++)
this.add(this.children[i]);
}
async updated(){
if (this.hasAttribute("dynamic")){
for (var i = 0; i < this.children.length; i++)
this.add(this.children[i]);
}
}
setGridLayout(style)
{
this.style.grid = style;

View File

@ -8,6 +8,7 @@ export default IUI.module(class IUIWindow extends IUIElement {
this._register("resize");
this._register("move");
this._register("close");
this._register("config");
this._uid = "d:" + Math.random().toString(36).substring(2);
@ -15,6 +16,30 @@ export default IUI.module(class IUIWindow extends IUIElement {
static moduleName = "window";
get closeable(){
return this.hasAttribute("closeable");
}
set closeable(value){
if (!value)
this.removeAttribute("closeable");
else
this.setAttribute("closeable", true);
}
get configurable(){
return this.hasAttribute("configurable");
}
set configurable(value){
if (!value)
this.removeAttribute("configurable");
else
this.setAttribute("configurable", true);
}
async create() {
await super.create();
@ -73,14 +98,27 @@ export default IUI.module(class IUIWindow extends IUIElement {
this._header.appendChild(this._subtitle);
this._header.appendChild(this._tools);
if (this.configurable) {
this._config = document.createElement("div");
this._config.className = this.cssClass + "-tools-config button";
this._config.addEventListener("click", function () {
self._emit("config");
});
this._tools.appendChild(this._config);
}
if (this.closeable) {
this._close = document.createElement("div");
this._close.className = this.cssClass + "-tools-close button";
this._close.addEventListener("click", function () {
self._emit("close");
});
this._tools.appendChild(this._close);
}
//this.addEventListener("mousedown", function (e) {
// self.setFocus(true);
//});