gluon-web-model: add custom events for form elements
This commit is contained in:
parent
a3a1d217f2
commit
ba1df47dba
File diff suppressed because one or more lines are too long
@ -183,6 +183,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
|
window.dispatchEvent(new Event('gluon-update'));
|
||||||
|
|
||||||
var state = false;
|
var state = false;
|
||||||
for (var id in dep_entries) {
|
for (var id in dep_entries) {
|
||||||
var entry = dep_entries[id];
|
var entry = dep_entries[id];
|
||||||
@ -191,6 +193,7 @@
|
|||||||
|
|
||||||
if (node && node.parentNode && !check(entry.deps)) {
|
if (node && node.parentNode && !check(entry.deps)) {
|
||||||
node.parentNode.removeChild(node);
|
node.parentNode.removeChild(node);
|
||||||
|
node.dispatchEvent(new Event('gluon-hide'));
|
||||||
state = true;
|
state = true;
|
||||||
} else if (parent && (!node || !node.parentNode) && check(entry.deps)) {
|
} else if (parent && (!node || !node.parentNode) && check(entry.deps)) {
|
||||||
var next = undefined;
|
var next = undefined;
|
||||||
@ -207,6 +210,7 @@
|
|||||||
parent.insertBefore(entry.node, next);
|
parent.insertBefore(entry.node, next);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
entry.node.dispatchEvent(new Event('gluon-show'));
|
||||||
state = true;
|
state = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,6 +475,7 @@
|
|||||||
|
|
||||||
bind(field, "blur", validator);
|
bind(field, "blur", validator);
|
||||||
bind(field, "keyup", validator);
|
bind(field, "keyup", validator);
|
||||||
|
bind(field, "gluon-revalidate", validator);
|
||||||
|
|
||||||
if (field.nodeName.toLowerCase() == 'select') {
|
if (field.nodeName.toLowerCase() == 'select') {
|
||||||
bind(field, "change", validator);
|
bind(field, "change", validator);
|
||||||
|
Loading…
Reference in New Issue
Block a user