2
0
mirror of https://github.com/esiur/iui.git synced 2025-06-27 09:23:12 +00:00
This commit is contained in:
2021-12-18 16:25:51 +03:00
parent e52b89fb4d
commit f57c1b4bc5
9 changed files with 832 additions and 496 deletions

View File

@ -25,17 +25,13 @@ export default IUI.module(class Form extends IUIElement {
}
async create() {
//var elements = this.querySelectorAll("*[field]");
//for (var i = 0; i < elements.length; i++)
// this.form[elements[i].getAttribute("field")] = elements[i];
}
async setData(value) {
this.original = value;
//var copy = {};
//Object.assign(copy, value);
super.setData(new Modifiable(this.original));// Form._copy(this.original));
//super.setData({ ...this.original });
super.setData(new Modifiable(this.original, true));
}

View File

@ -33,10 +33,10 @@ export default class Modifiable
return true;
}
constructor(original){
constructor(original, copy = false){
this._events = {};
this._data = Modifiable._copy(original);
this._data = copy ? Modifiable._copy(original) : original;
this._original = original;
for(let p in this._data)

View File

@ -150,6 +150,9 @@ export default IUI.module(class Input extends IUIElement {
this._input.value = value != null ? value.toISOString().slice(0, 10) : value;
else if (this.type == null || this.type == "text" || this.type == "search" || this.type == "password")
this._input.value = value == null ? '' : value;
else if (this.type == "file") {
// can't set value on file input
}
else
this._input.value = value;
@ -163,7 +166,7 @@ export default IUI.module(class Input extends IUIElement {
this.value = value[this.field];
else if (this.field != null)
this.value = null;
*/
*/
}

View File

@ -1,5 +1,6 @@
import {IUI, iui} from "./Core/IUI.js";
import "./Core/IUIElement.js";
import './Core/App.js';
@ -40,6 +41,7 @@ import './UI/Grid.js';
import './UI/Location.js';
import './UI/CodePreview.js';
import Modifiable from "./Data/Modifiable.js";
window.addEventListener("beforeprint", (e)=>{
let viewRoute = router.current.viewRoute;
@ -56,9 +58,9 @@ window.addEventListener("afterprint", (e)=>{
window.addEventListener("load", async function () {
await IUI.create(document.body);
await IUI.created(document.body);
//if (window.app != null) {
// window.app._emit("load", { app: window.app });
// }
});
window.iui = iui;
window.iui = iui;
window.Modifiable = Modifiable;