@planning-inspectorate/dynamic-forms 1.9.0 → 1.10.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
CHANGED
|
@@ -86,6 +86,21 @@
|
|
|
86
86
|
type: "submit",
|
|
87
87
|
attributes: { "data-cy":"button-save-and-continue"}
|
|
88
88
|
}) }}
|
|
89
|
+
{% if extraActionButtons|length %}
|
|
90
|
+
{% for extraActionButton in extraActionButtons %}
|
|
91
|
+
{{ govukButton({
|
|
92
|
+
text: extraActionButton.text,
|
|
93
|
+
type: extraActionButton.type,
|
|
94
|
+
href: extraActionButton.href,
|
|
95
|
+
attributes: {
|
|
96
|
+
"formaction": extraActionButton.formaction or "",
|
|
97
|
+
"data-cy": "button-" + extraActionButton.text|lower|replace(" ", "-"),
|
|
98
|
+
"name": extraActionButton.text|lower|replace(" ", "-")
|
|
99
|
+
},
|
|
100
|
+
classes: extraActionButton.classes or "govuk-button--secondary"
|
|
101
|
+
}) }}
|
|
102
|
+
{% endfor %}
|
|
103
|
+
{% endif %}
|
|
89
104
|
</form>
|
|
90
105
|
</div>
|
|
91
106
|
</div>
|
|
@@ -17,6 +17,7 @@ export default class RadioQuestion extends OptionsQuestion {
|
|
|
17
17
|
* @param {Array.<import('../../questions/options-question.js').Option>} params.options
|
|
18
18
|
* @param {Array.<import('../../questions/question.js').BaseValidator>} [params.validators]
|
|
19
19
|
* @param {boolean} [params.editable]
|
|
20
|
+
* @param {Object<string, any>} [params.viewData]
|
|
20
21
|
* @param {import('../../questions/question-types.js').ActionLink} [params.actionLink]
|
|
21
22
|
*/
|
|
22
23
|
constructor({
|
|
@@ -34,7 +35,8 @@ export default class RadioQuestion extends OptionsQuestion {
|
|
|
34
35
|
options,
|
|
35
36
|
validators,
|
|
36
37
|
actionLink,
|
|
37
|
-
editable
|
|
38
|
+
editable,
|
|
39
|
+
viewData
|
|
38
40
|
}) {
|
|
39
41
|
super({
|
|
40
42
|
title,
|
|
@@ -48,7 +50,8 @@ export default class RadioQuestion extends OptionsQuestion {
|
|
|
48
50
|
options,
|
|
49
51
|
validators,
|
|
50
52
|
actionLink,
|
|
51
|
-
editable
|
|
53
|
+
editable,
|
|
54
|
+
viewData
|
|
52
55
|
});
|
|
53
56
|
|
|
54
57
|
this.html = html;
|
|
@@ -161,9 +161,8 @@
|
|
|
161
161
|
* @param {HTMLDivElement} unredactedText
|
|
162
162
|
* @param {HTMLAnchorElement[]} rejectLinks
|
|
163
163
|
* @param {import('@azure/ai-text-analytics').PiiEntity[]} suggestions
|
|
164
|
-
* @param {HTMLAnchorElement} toggleOriginal
|
|
165
164
|
*/
|
|
166
|
-
function registerEventListeners({textArea, redactSelectedText, redactUndo, redactUndoAll, unredactedText, rejectLinks, suggestions
|
|
165
|
+
function registerEventListeners({textArea, redactSelectedText, redactUndo, redactUndoAll, unredactedText, rejectLinks, suggestions}) {
|
|
167
166
|
const formGroup = textArea.parentElement;
|
|
168
167
|
const errorMessage = document.createElement('p');
|
|
169
168
|
errorMessage.id = '{{ question.fieldName }}-error';
|
|
@@ -231,16 +230,6 @@
|
|
|
231
230
|
}
|
|
232
231
|
});
|
|
233
232
|
}
|
|
234
|
-
toggleOriginal.addEventListener('click', (event) => {
|
|
235
|
-
event.preventDefault();
|
|
236
|
-
if (unredactedText.classList.contains('govuk-!-display-none')) {
|
|
237
|
-
unredactedText.classList.remove('govuk-!-display-none');
|
|
238
|
-
toggleOriginal.text = 'Hide';
|
|
239
|
-
} else {
|
|
240
|
-
unredactedText.classList.add('govuk-!-display-none');
|
|
241
|
-
toggleOriginal.text = 'Show';
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
233
|
}
|
|
245
234
|
|
|
246
235
|
function initRedact() {
|
|
@@ -248,8 +237,7 @@
|
|
|
248
237
|
const redactSelectedText = document.querySelector('#redact-selected-text');
|
|
249
238
|
const redactUndo = document.querySelector('#redact-undo');
|
|
250
239
|
const redactUndoAll = document.querySelector('#redact-undo-all');
|
|
251
|
-
const unredactedText = document.querySelector('#{{ question.fieldName }}-unredacted');
|
|
252
|
-
const toggleOriginal = document.querySelector('#toggle-original');
|
|
240
|
+
const unredactedText = document.querySelector('#{{ question.fieldName }}-unredacted > div');
|
|
253
241
|
const rejectLinks = document.querySelectorAll('[data-redact]');
|
|
254
242
|
{% if not redactionSuggestions %}
|
|
255
243
|
{% set redactionSuggestions = [] %}
|
|
@@ -271,11 +259,8 @@
|
|
|
271
259
|
if (!unredactedText || !(unredactedText instanceof HTMLDivElement)) {
|
|
272
260
|
return;
|
|
273
261
|
}
|
|
274
|
-
if (!toggleOriginal || !(toggleOriginal instanceof HTMLAnchorElement)) {
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
262
|
|
|
278
|
-
registerEventListeners({textArea, redactSelectedText, redactUndo, redactUndoAll, unredactedText, rejectLinks, suggestions
|
|
263
|
+
registerEventListeners({textArea, redactSelectedText, redactUndo, redactUndoAll, unredactedText, rejectLinks, suggestions});
|
|
279
264
|
}
|
|
280
265
|
|
|
281
266
|
initRedact();
|