@pageboard/html 0.15.6 → 0.15.8
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/elements/form.js +10 -14
- package/elements/inputs.js +13 -3
- package/elements/pagination.js +2 -2
- package/package.json +1 -1
- package/ui/form.js +5 -7
- package/ui/pagination.js +1 -1
package/elements/form.js
CHANGED
|
@@ -9,12 +9,12 @@ exports.query_form = {
|
|
|
9
9
|
title: 'Name',
|
|
10
10
|
description: 'Useful for query tags',
|
|
11
11
|
type: 'string',
|
|
12
|
-
format: '
|
|
12
|
+
format: 'name',
|
|
13
13
|
nullable: true
|
|
14
14
|
},
|
|
15
|
-
|
|
16
|
-
title: '
|
|
17
|
-
description: 'Hidden and disabled
|
|
15
|
+
hidden: {
|
|
16
|
+
title: 'Hidden',
|
|
17
|
+
description: 'Hidden and disabled\nShown by $query.toggle',
|
|
18
18
|
type: 'boolean',
|
|
19
19
|
default: false
|
|
20
20
|
},
|
|
@@ -52,7 +52,7 @@ exports.query_form = {
|
|
|
52
52
|
},
|
|
53
53
|
contents: 'block+',
|
|
54
54
|
tag: 'form[method="get"]',
|
|
55
|
-
html: `<form is="element-form" method="get"
|
|
55
|
+
html: `<form is="element-form" method="get" id="[name|else:$id]" hidden="[hidden]"
|
|
56
56
|
action="[redirection.url][redirection.parameters|as:query]"
|
|
57
57
|
autocomplete="off" class="ui form"></form>`,
|
|
58
58
|
stylesheets: [
|
|
@@ -87,16 +87,11 @@ exports.api_form = {
|
|
|
87
87
|
},
|
|
88
88
|
hidden: {
|
|
89
89
|
title: 'Hidden',
|
|
90
|
+
description: 'Hidden and disabled\nShown by $query.toggle',
|
|
90
91
|
type: 'boolean',
|
|
91
92
|
default: false,
|
|
92
93
|
context: 'template'
|
|
93
94
|
},
|
|
94
|
-
masked: {
|
|
95
|
-
title: 'Masked',
|
|
96
|
-
description: 'Hidden and disabled, unmasked by $query.toggle',
|
|
97
|
-
type: 'boolean',
|
|
98
|
-
default: false
|
|
99
|
-
},
|
|
100
95
|
action: {
|
|
101
96
|
title: 'Action',
|
|
102
97
|
description: 'Choose a service',
|
|
@@ -178,14 +173,15 @@ exports.api_form = {
|
|
|
178
173
|
},
|
|
179
174
|
contents: 'block+',
|
|
180
175
|
tag: 'form[method="post"]',
|
|
181
|
-
html: `<form is="element-form" method="post"
|
|
182
|
-
|
|
176
|
+
html: `<form is="element-form" method="post" hidden="[hidden]"
|
|
177
|
+
id="[name|else:$id]"
|
|
178
|
+
action="/@api/form/[$id]"
|
|
183
179
|
parameters="[action?.request|as:expressions]"
|
|
184
180
|
success="[redirection.parameters|as:query]"
|
|
185
181
|
badrequest="[badrequest.parameters|as:query]"
|
|
186
182
|
unauthorized="[unauthorized.parameters|as:query]"
|
|
187
183
|
notfound="[notfound.parameters|as:query]"
|
|
188
|
-
class="ui form
|
|
184
|
+
class="ui form"></form>`,
|
|
189
185
|
stylesheets: [
|
|
190
186
|
'../ui/components/form.css',
|
|
191
187
|
'../ui/form.css'
|
package/elements/inputs.js
CHANGED
|
@@ -38,6 +38,16 @@ exports.input_button = {
|
|
|
38
38
|
type: "string",
|
|
39
39
|
format: "singleline"
|
|
40
40
|
},
|
|
41
|
+
form: {
|
|
42
|
+
title: 'Target form',
|
|
43
|
+
type: 'string',
|
|
44
|
+
format: 'name',
|
|
45
|
+
nullable: true,
|
|
46
|
+
$filter: {
|
|
47
|
+
name: 'action',
|
|
48
|
+
action: 'write'
|
|
49
|
+
}
|
|
50
|
+
},
|
|
41
51
|
disabled: {
|
|
42
52
|
title: 'Disabled',
|
|
43
53
|
type: 'boolean',
|
|
@@ -73,7 +83,7 @@ exports.input_button = {
|
|
|
73
83
|
default: null
|
|
74
84
|
}
|
|
75
85
|
},
|
|
76
|
-
html: '<button type="[type]" disabled="[disabled]" class="ui [full|alt:fluid:] [icon] [compact] [float|post:%20floated] button" name="[name]" value="[value]">[type|schema:title]</button>',
|
|
86
|
+
html: '<button type="[type]" form="[form]" disabled="[disabled]" class="ui [full|alt:fluid:] [icon] [compact] [float|post:%20floated] button" name="[name]" value="[value]">[type|schema:title]</button>',
|
|
77
87
|
stylesheets: [
|
|
78
88
|
'../ui/components/button.css',
|
|
79
89
|
'../ui/button.css'
|
|
@@ -479,8 +489,8 @@ exports.input_select = {
|
|
|
479
489
|
html: `<div class="field">
|
|
480
490
|
<label block-content="label">Label</label>
|
|
481
491
|
<element-select class="ui selection dropdown [multiple]"
|
|
482
|
-
name="[name]" disabled="[disabled]" required="[required]"
|
|
483
|
-
multiple="[multiple]"
|
|
492
|
+
name="[name]" disabled="[disabled|as:batt]" required="[required|as:batt]"
|
|
493
|
+
multiple="[multiple|as:batt]"
|
|
484
494
|
value="[value]"
|
|
485
495
|
>
|
|
486
496
|
<i class="dropdown icon"></i><div class="text"></div><select></select>
|
package/elements/pagination.js
CHANGED
package/package.json
CHANGED
package/ui/form.js
CHANGED
|
@@ -74,12 +74,10 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
|
|
|
74
74
|
if (typeof toggle == "string") toggles.push(...toggle.split('-'));
|
|
75
75
|
else if (Array.isArray(toggle)) toggles.push(...toggle);
|
|
76
76
|
|
|
77
|
-
const masked = this.hasAttribute('masked');
|
|
78
|
-
|
|
79
77
|
if (this.method != "get") {
|
|
80
78
|
// ?submit=<name> for auto-submit
|
|
81
79
|
if (submit && submit == this.name) {
|
|
82
|
-
if (
|
|
80
|
+
if (this.hidden) toggles.push(submit);
|
|
83
81
|
state.vars.submit = true;
|
|
84
82
|
}
|
|
85
83
|
const actionLoc = Page.parse(this.getAttribute('action'));
|
|
@@ -94,9 +92,9 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
|
|
|
94
92
|
if (toggles.includes(this.name)) {
|
|
95
93
|
// ?toggle=<name> for toggling hidden state
|
|
96
94
|
if (toggle) state.vars.toggle = true;
|
|
97
|
-
this.disabled = this.hidden
|
|
95
|
+
this.disabled = !this.hidden;
|
|
98
96
|
} else {
|
|
99
|
-
this.disabled = this.hidden
|
|
97
|
+
this.disabled = this.hidden;
|
|
100
98
|
}
|
|
101
99
|
}
|
|
102
100
|
paint(state) {
|
|
@@ -368,10 +366,10 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
|
|
|
368
366
|
}
|
|
369
367
|
state.debounce(
|
|
370
368
|
() => {
|
|
371
|
-
msg
|
|
369
|
+
msg?.classList.remove('visible');
|
|
372
370
|
return state.push(loc, { vary });
|
|
373
371
|
},
|
|
374
|
-
msg
|
|
372
|
+
msg?.dataset.fading ? 1000 : 100
|
|
375
373
|
)();
|
|
376
374
|
}
|
|
377
375
|
}
|
package/ui/pagination.js
CHANGED
|
@@ -9,7 +9,7 @@ class HTMLElementPagination extends Page.create(HTMLAnchorElement) {
|
|
|
9
9
|
#update(state) {
|
|
10
10
|
const { fetch } = this.dataset;
|
|
11
11
|
const node = this.ownerDocument.querySelector(
|
|
12
|
-
`element-template[
|
|
12
|
+
`element-template[id="${fetch}"]`
|
|
13
13
|
);
|
|
14
14
|
if (!node) {
|
|
15
15
|
console.warn("pagination does not find fetch node", fetch);
|