@pageboard/html 0.10.27 → 0.10.29
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/consent.js +36 -3
- package/package.json +1 -1
- package/ui/consent.js +10 -2
package/elements/consent.js
CHANGED
|
@@ -2,7 +2,7 @@ exports.consent_form = {
|
|
|
2
2
|
priority: 11,
|
|
3
3
|
title: 'Consent',
|
|
4
4
|
icon: '<i class="handshake icon"></i>',
|
|
5
|
-
group: "block",
|
|
5
|
+
group: "block form",
|
|
6
6
|
menu: 'form',
|
|
7
7
|
properties: {
|
|
8
8
|
transient: {
|
|
@@ -26,8 +26,41 @@ exports.consent_form = {
|
|
|
26
26
|
|
|
27
27
|
const consents = [];
|
|
28
28
|
|
|
29
|
+
exports.input_radio_consent = {
|
|
30
|
+
title: 'Consent custom',
|
|
31
|
+
icon: '<i class="hand scissors icon"></i>',
|
|
32
|
+
menu: "form",
|
|
33
|
+
group: "block",
|
|
34
|
+
context: 'consent_form//',
|
|
35
|
+
properties: {
|
|
36
|
+
value: {
|
|
37
|
+
title: 'Consent',
|
|
38
|
+
anyOf: [{
|
|
39
|
+
const: 'custom',
|
|
40
|
+
title: 'Custom'
|
|
41
|
+
}, {
|
|
42
|
+
const: 'yes',
|
|
43
|
+
title: 'All'
|
|
44
|
+
}, {
|
|
45
|
+
const: 'no',
|
|
46
|
+
title: 'None'
|
|
47
|
+
}]
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
contents: {
|
|
51
|
+
id: 'label',
|
|
52
|
+
nodes: 'inline*'
|
|
53
|
+
},
|
|
54
|
+
html: `<div class="field">
|
|
55
|
+
<div class="ui radio checkbox">
|
|
56
|
+
<input type="radio" name="consent" value="[value]" id="for-consent-[value]" />
|
|
57
|
+
<label block-content="label" for="for-consent-[value]">Custom</label>
|
|
58
|
+
</div>
|
|
59
|
+
</div>`
|
|
60
|
+
};
|
|
61
|
+
|
|
29
62
|
exports.input_radio_yes = {
|
|
30
|
-
title: '
|
|
63
|
+
title: 'Consent yes',
|
|
31
64
|
icon: '<i class="thumbs up icon"></i>',
|
|
32
65
|
menu: "form",
|
|
33
66
|
group: "block",
|
|
@@ -51,7 +84,7 @@ exports.input_radio_yes = {
|
|
|
51
84
|
};
|
|
52
85
|
|
|
53
86
|
exports.input_radio_no = {
|
|
54
|
-
title: '
|
|
87
|
+
title: 'Consent no',
|
|
55
88
|
icon: '<i class="thumbs down icon"></i>',
|
|
56
89
|
menu: "form",
|
|
57
90
|
group: "block",
|
package/package.json
CHANGED
package/ui/consent.js
CHANGED
|
@@ -46,8 +46,16 @@ class HTMLCustomConsentElement extends HTMLFormElement {
|
|
|
46
46
|
if (e.type == "submit") e.preventDefault();
|
|
47
47
|
if (this.isContentEditable) return;
|
|
48
48
|
const consents = window.HTMLCustomFormElement.prototype.read.call(this);
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
const names = new Set();
|
|
50
|
+
for (const node of this.elements) {
|
|
51
|
+
if (node.name?.startsWith('consent.')) names.push(node.name);
|
|
52
|
+
}
|
|
53
|
+
const def = consents.consent;
|
|
54
|
+
if (def != "custom") for (const consent of names) {
|
|
55
|
+
consents[consent] = def;
|
|
56
|
+
}
|
|
57
|
+
if (Array.from(names).some(c => consents[c] == null)) {
|
|
58
|
+
// not all consents have been answered
|
|
51
59
|
return;
|
|
52
60
|
}
|
|
53
61
|
for (const [key, val] of Object.entries(consents)) {
|