@pageboard/html 0.14.10 → 0.14.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/ui/form.js +0 -34
package/package.json
CHANGED
package/ui/form.js
CHANGED
|
@@ -19,40 +19,6 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
static patch(state) {
|
|
22
|
-
state.scope.$filters.form = (ctx, val, action, name) => {
|
|
23
|
-
const form = name
|
|
24
|
-
? document.querySelector(`form[name="${name}"]`)
|
|
25
|
-
: ctx.dest.node.closest('form');
|
|
26
|
-
if (!form) {
|
|
27
|
-
// eslint-disable-next-line no-console
|
|
28
|
-
console.warn("No parent form found");
|
|
29
|
-
return val;
|
|
30
|
-
}
|
|
31
|
-
if (action == "toggle") {
|
|
32
|
-
action = val ? "enable" : "disable";
|
|
33
|
-
}
|
|
34
|
-
const isQuery = ctx.expr.path[0] == "$query" && ctx.expr.path.length == 1;
|
|
35
|
-
|
|
36
|
-
state.finish(() => {
|
|
37
|
-
if (action == "enable") {
|
|
38
|
-
form.enable?.();
|
|
39
|
-
} else if (action == "disable") {
|
|
40
|
-
form.disable?.();
|
|
41
|
-
} else if (action == "fill") {
|
|
42
|
-
if (val == null) {
|
|
43
|
-
form.reset?.();
|
|
44
|
-
} else if (typeof val == "object") {
|
|
45
|
-
const vars = form.fill?.(this.linearizeValues(val), state.scope) ?? [];
|
|
46
|
-
if (isQuery) {
|
|
47
|
-
for (const name of vars) state.vars[name] = true;
|
|
48
|
-
}
|
|
49
|
-
form.save?.();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
return val;
|
|
55
|
-
};
|
|
56
22
|
state.finish(() => {
|
|
57
23
|
let index = 0;
|
|
58
24
|
for (const node of document.querySelectorAll('label[for]')) {
|