@gov-cy/govcy-express-services 1.6.12 → 1.7.0
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 +2 -2
- package/src/public/js/govcyForms.js +33 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gov-cy/govcy-express-services",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "An Express-based system that dynamically renders services using @gov-cy/govcy-frontend-renderer and posts data to a submission API.",
|
|
5
5
|
"author": "DMRID - DSF Team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@gov-cy/dsf-email-templates": "^2.1.11",
|
|
60
|
-
"@gov-cy/govcy-frontend-renderer": "^1.26.
|
|
60
|
+
"@gov-cy/govcy-frontend-renderer": "^1.26.3",
|
|
61
61
|
"axios": "^1.9.0",
|
|
62
62
|
"cookie-parser": "^1.4.7",
|
|
63
63
|
"dotenv": "^16.3.1",
|
|
@@ -1,20 +1,42 @@
|
|
|
1
1
|
document.addEventListener("DOMContentLoaded", function () {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
function updateConditionalRadios() {
|
|
3
|
+
// 1. Close ALL conditional blocks
|
|
4
|
+
Array.prototype.forEach.call(
|
|
5
|
+
document.querySelectorAll('.govcy-radio__conditional'),
|
|
6
|
+
function (el) {
|
|
7
|
+
el.classList.add('govcy-radio__conditional--hidden');
|
|
8
|
+
}
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
// 2. Re-open conditionals for CHECKED radios
|
|
12
|
+
// --- Show conditionals for checked radios ---
|
|
13
|
+
// CHANGED: NodeList.prototype.forEach is not in IE11 → use Array.prototype.forEach.call
|
|
14
|
+
// CHANGED: Arrow function → function
|
|
15
|
+
Array.prototype.forEach.call(
|
|
16
|
+
document.querySelectorAll('.govcy-radio-input[data-aria-controls]:checked'),
|
|
17
|
+
function (radio) { // CHANGED: arrow → function
|
|
18
|
+
// CHANGED: const → var (ES5)
|
|
19
|
+
var targetId = radio.getAttribute('data-aria-controls');
|
|
20
|
+
var targetElement = document.getElementById(targetId);
|
|
11
21
|
|
|
12
|
-
|
|
13
|
-
|
|
22
|
+
if (targetElement) {
|
|
23
|
+
targetElement.classList.remove('govcy-radio__conditional--hidden');
|
|
24
|
+
}
|
|
14
25
|
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Attach to *all* radios to repair DS behaviour
|
|
30
|
+
Array.prototype.forEach.call(
|
|
31
|
+
document.querySelectorAll('.govcy-radio-input'),
|
|
32
|
+
function (radio) {
|
|
33
|
+
radio.addEventListener('change', updateConditionalRadios);
|
|
15
34
|
}
|
|
16
35
|
);
|
|
17
36
|
|
|
37
|
+
// Apply once on page load
|
|
38
|
+
updateConditionalRadios();
|
|
39
|
+
|
|
18
40
|
// --- Disable submit button after form submission ---
|
|
19
41
|
// CHANGED: NodeList.forEach → Array.prototype.forEach.call
|
|
20
42
|
Array.prototype.forEach.call(document.querySelectorAll('form'), function (form) { // CHANGED
|