@planning-inspectorate/dynamic-forms 3.6.2 → 3.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 +1 -1
- package/src/components/task-list/index.njk +2 -2
- package/src/components/task-list/task-list-multi-section.njk +2 -2
- package/src/components/task-list/task-list-single-section.njk +2 -2
- package/src/components/utils/component-types.js +10 -10
- package/src/questions/question-props.d.ts +65 -53
- package/types/src/components/utils/component-types.d.ts +9 -9
package/package.json
CHANGED
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
<div class="govuk-grid-row">
|
|
30
30
|
<div class="govuk-grid-column-full">
|
|
31
31
|
{% if summaryListData.sections | length > 1 %}
|
|
32
|
-
{{ multiTaskList(summaryListData.sections, journeyComplete, beforeSubmitButton) }}
|
|
32
|
+
{{ multiTaskList(summaryListData.sections, journeyComplete, beforeSubmitButton, submitButtonText) }}
|
|
33
33
|
{% elif summaryListData.sections | length == 1 %}
|
|
34
|
-
{{ singleTaskList(summaryListData.sections | first, journeyComplete, beforeSubmitButton) }}
|
|
34
|
+
{{ singleTaskList(summaryListData.sections | first, journeyComplete, beforeSubmitButton, submitButtonText) }}
|
|
35
35
|
{% endif %}
|
|
36
36
|
</div>
|
|
37
37
|
</div>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
{% from "govuk/components/tag/macro.njk" import govukTag %}
|
|
3
3
|
{% from "govuk/components/button/macro.njk" import govukButton %}
|
|
4
4
|
|
|
5
|
-
{% macro multiTaskList(sections, journeyComplete, beforeSubmitButton) %}
|
|
5
|
+
{% macro multiTaskList(sections, journeyComplete, beforeSubmitButton, submitButtonText) %}
|
|
6
6
|
<ol class="app-task-list">
|
|
7
7
|
{% for section in sections %}
|
|
8
8
|
<li class="govuk-body govuk-!-margin-bottom-9">
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
<form action method="post">
|
|
47
47
|
<input type="hidden" name="_csrf" value="{{_csrf}}">
|
|
48
48
|
{{ govukButton({
|
|
49
|
-
text: "Accept & Submit",
|
|
49
|
+
text: submitButtonText | default("Accept & Submit", true),
|
|
50
50
|
type: "submit"
|
|
51
51
|
}) }}
|
|
52
52
|
</form>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
{% from "govuk/components/button/macro.njk" import govukButton %}
|
|
4
4
|
{% from "govuk/components/warning-text/macro.njk" import govukWarningText %}
|
|
5
5
|
|
|
6
|
-
{% macro singleTaskList(section, journeyComplete, beforeSubmitButton) %}
|
|
6
|
+
{% macro singleTaskList(section, journeyComplete, beforeSubmitButton, submitButtonText) %}
|
|
7
7
|
{% if section.list.rows.length %}
|
|
8
8
|
{{ govukSummaryList(section.list) }}
|
|
9
9
|
{% endif %}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<form action method="post">
|
|
16
16
|
<input type="hidden" name="_csrf" value="{{_csrf}}">
|
|
17
17
|
{{ govukButton({
|
|
18
|
-
text: "Accept & Submit",
|
|
18
|
+
text: submitButtonText | default("Accept & Submit", true),
|
|
19
19
|
type: "submit"
|
|
20
20
|
}) }}
|
|
21
21
|
</form>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
export const COMPONENT_TYPES = Object.freeze({
|
|
2
|
-
|
|
2
|
+
ADDRESS: 'site-address',
|
|
3
3
|
BOOLEAN: 'boolean',
|
|
4
|
-
|
|
4
|
+
CHECKBOX: 'checkbox',
|
|
5
5
|
DATE: 'date',
|
|
6
6
|
DATE_PERIOD: 'date-period',
|
|
7
7
|
DATE_TIME: 'date-time',
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
SELECT: 'select',
|
|
11
|
-
SINGLE_LINE_INPUT: 'single-line-input',
|
|
8
|
+
EMAIL: 'email',
|
|
9
|
+
MANAGE_LIST: 'manage-list',
|
|
12
10
|
MULTI_FIELD_INPUT: 'multi-field-input',
|
|
13
11
|
NUMBER: 'number',
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
RADIO: 'radio',
|
|
13
|
+
SELECT: 'select',
|
|
14
|
+
SINGLE_LINE_INPUT: 'single-line-input',
|
|
15
|
+
TEXT_ENTRY: 'text-entry',
|
|
16
|
+
TEXT_ENTRY_REDACT: 'text-entry-redact',
|
|
17
|
+
UNIT_OPTION: 'unit-option'
|
|
18
18
|
});
|
|
@@ -1,40 +1,27 @@
|
|
|
1
1
|
import { DocType } from '@pins/common/src/document-types';
|
|
2
|
-
import {
|
|
3
|
-
import BaseValidator from '../validator/base-validator';
|
|
2
|
+
import { QuestionParameters } from '#question-types';
|
|
4
3
|
|
|
5
4
|
type QuestionTypes =
|
|
6
|
-
| 'checkbox'
|
|
7
|
-
| 'multi-file-upload'
|
|
8
5
|
| 'boolean'
|
|
9
|
-
| '
|
|
6
|
+
| 'checkbox'
|
|
10
7
|
| 'date'
|
|
11
8
|
| 'date-period'
|
|
12
|
-
| '
|
|
13
|
-
| '
|
|
14
|
-
| '
|
|
15
|
-
| 'single-line-input'
|
|
9
|
+
| 'date-time'
|
|
10
|
+
| 'email'
|
|
11
|
+
| 'manage-list'
|
|
16
12
|
| 'multi-field-input'
|
|
17
13
|
| 'number'
|
|
14
|
+
| 'radio'
|
|
15
|
+
| 'select'
|
|
16
|
+
| 'single-line-input'
|
|
18
17
|
| 'site-address'
|
|
19
|
-
| '
|
|
20
|
-
| '
|
|
18
|
+
| 'text-entry'
|
|
19
|
+
| 'text-entry-redact'
|
|
20
|
+
| 'unit-option';
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
type CommonQuestionProps = QuestionParameters & {
|
|
23
23
|
type: QuestionTypes;
|
|
24
|
-
|
|
25
|
-
question: string;
|
|
26
|
-
viewFolder?: string;
|
|
27
|
-
fieldName: string;
|
|
28
|
-
url?: string;
|
|
29
|
-
pageTitle?: string;
|
|
30
|
-
description?: string;
|
|
31
|
-
label?: string;
|
|
32
|
-
validators?: BaseValidator[];
|
|
33
|
-
html?: string;
|
|
34
|
-
hint?: string;
|
|
35
|
-
shouldDisplay?: (response: JourneyResponse) => boolean;
|
|
36
|
-
autocomplete?: string;
|
|
37
|
-
}
|
|
24
|
+
};
|
|
38
25
|
|
|
39
26
|
type Option =
|
|
40
27
|
| {
|
|
@@ -92,24 +79,14 @@ interface UnitOption {
|
|
|
92
79
|
};
|
|
93
80
|
}
|
|
94
81
|
|
|
95
|
-
type CheckboxQuestionProps = CommonQuestionProps & {
|
|
96
|
-
type: 'checkbox';
|
|
97
|
-
options: Option[];
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
type MultiFileUploadQuestionProps = CommonQuestionProps & {
|
|
101
|
-
type: 'multi-file-upload';
|
|
102
|
-
documentType: DocType;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
82
|
type BooleanQuestionProps = CommonQuestionProps & {
|
|
106
83
|
type: 'boolean';
|
|
107
84
|
options?: Option[];
|
|
108
85
|
interfaceType?: 'checkbox' | 'radio';
|
|
109
86
|
};
|
|
110
87
|
|
|
111
|
-
type
|
|
112
|
-
type: '
|
|
88
|
+
type CheckboxQuestionProps = CommonQuestionProps & {
|
|
89
|
+
type: 'checkbox';
|
|
113
90
|
options: Option[];
|
|
114
91
|
};
|
|
115
92
|
|
|
@@ -117,51 +94,86 @@ type DateQuestionProps = CommonQuestionProps & {
|
|
|
117
94
|
type: 'date';
|
|
118
95
|
};
|
|
119
96
|
|
|
120
|
-
type
|
|
121
|
-
type: '
|
|
122
|
-
label?: string;
|
|
97
|
+
type DatePeriodQuestionProps = CommonQuestionProps & {
|
|
98
|
+
type: 'date-period';
|
|
123
99
|
};
|
|
124
100
|
|
|
125
|
-
type
|
|
126
|
-
type: '
|
|
127
|
-
|
|
128
|
-
|
|
101
|
+
type DateTimeQuestionProps = CommonQuestionProps & {
|
|
102
|
+
type: 'date-time';
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
type ManageListQuestionProps = CommonQuestionProps & {
|
|
106
|
+
type: 'manage-list';
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
type EmailQuestionProps = CommonQuestionProps & {
|
|
110
|
+
type: 'email';
|
|
129
111
|
};
|
|
130
112
|
|
|
131
113
|
type MultiFieldInputQuestionProps = CommonQuestionProps & {
|
|
132
114
|
type: 'multi-field-input';
|
|
133
|
-
label?: string;
|
|
134
115
|
inputAttributes?: Record<string, string>;
|
|
135
116
|
inputFields: InputField[];
|
|
136
117
|
formatType?: 'contactDetails' | 'standard';
|
|
137
118
|
};
|
|
138
119
|
|
|
120
|
+
type MultiFileUploadQuestionProps = CommonQuestionProps & {
|
|
121
|
+
type: 'multi-file-upload';
|
|
122
|
+
documentType: DocType;
|
|
123
|
+
};
|
|
124
|
+
|
|
139
125
|
type NumberEntryQuestionProps = CommonQuestionProps & {
|
|
140
126
|
type: 'number';
|
|
141
|
-
label?: string;
|
|
142
127
|
suffix?: string;
|
|
143
128
|
};
|
|
144
129
|
|
|
130
|
+
type RadioQuestionProps = CommonQuestionProps & {
|
|
131
|
+
type: 'radio';
|
|
132
|
+
options: Option[];
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
type SelectQuestionProps = CommonQuestionProps & {
|
|
136
|
+
type: 'select';
|
|
137
|
+
options: Option[];
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
type SingleLineInputQuestionProps = CommonQuestionProps & {
|
|
141
|
+
type: 'single-line-input';
|
|
142
|
+
inputAttributes?: Record<string, string>;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
145
|
type SiteAddressQuestionProps = CommonQuestionProps & {
|
|
146
146
|
type: 'site-address';
|
|
147
147
|
};
|
|
148
148
|
|
|
149
|
+
type TextEntryQuestionProps = CommonQuestionProps & {
|
|
150
|
+
type: 'text-entry';
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
type TextEntryRedactQuestionProps = CommonQuestionProps & {
|
|
154
|
+
type: 'text-entry-redact';
|
|
155
|
+
};
|
|
156
|
+
|
|
149
157
|
type UnitOptionEntryQuestionProps = CommonQuestionProps & {
|
|
150
158
|
type: 'unit-option';
|
|
151
159
|
conditionalFieldName: string;
|
|
152
160
|
options: UnitOption[];
|
|
153
|
-
label?: string;
|
|
154
161
|
};
|
|
155
162
|
|
|
156
163
|
export type QuestionProps =
|
|
157
|
-
| CheckboxQuestionProps
|
|
158
|
-
| MultiFileUploadQuestionProps
|
|
159
164
|
| BooleanQuestionProps
|
|
160
|
-
|
|
|
165
|
+
| CheckboxQuestionProps
|
|
161
166
|
| DateQuestionProps
|
|
162
|
-
|
|
|
163
|
-
|
|
|
167
|
+
| DatePeriodQuestionProps
|
|
168
|
+
| DateTimeQuestionProps
|
|
169
|
+
| ManageListQuestionProps
|
|
170
|
+
| EmailQuestionProps
|
|
164
171
|
| MultiFieldInputQuestionProps
|
|
165
172
|
| NumberEntryQuestionProps
|
|
173
|
+
| RadioQuestionProps
|
|
174
|
+
| SelectQuestionProps
|
|
175
|
+
| SingleLineInputQuestionProps
|
|
166
176
|
| SiteAddressQuestionProps
|
|
177
|
+
| TextEntryQuestionProps
|
|
178
|
+
| TextEntryRedactQuestionProps
|
|
167
179
|
| UnitOptionEntryQuestionProps;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
export const COMPONENT_TYPES: Readonly<{
|
|
2
|
-
|
|
2
|
+
ADDRESS: "site-address";
|
|
3
3
|
BOOLEAN: "boolean";
|
|
4
|
-
|
|
4
|
+
CHECKBOX: "checkbox";
|
|
5
5
|
DATE: "date";
|
|
6
6
|
DATE_PERIOD: "date-period";
|
|
7
7
|
DATE_TIME: "date-time";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
SELECT: "select";
|
|
11
|
-
SINGLE_LINE_INPUT: "single-line-input";
|
|
8
|
+
EMAIL: "email";
|
|
9
|
+
MANAGE_LIST: "manage-list";
|
|
12
10
|
MULTI_FIELD_INPUT: "multi-field-input";
|
|
13
11
|
NUMBER: "number";
|
|
14
|
-
|
|
12
|
+
RADIO: "radio";
|
|
13
|
+
SELECT: "select";
|
|
14
|
+
SINGLE_LINE_INPUT: "single-line-input";
|
|
15
|
+
TEXT_ENTRY: "text-entry";
|
|
16
|
+
TEXT_ENTRY_REDACT: "text-entry-redact";
|
|
15
17
|
UNIT_OPTION: "unit-option";
|
|
16
|
-
EMAIL: "email";
|
|
17
|
-
MANAGE_LIST: "manage-list";
|
|
18
18
|
}>;
|
|
19
19
|
//# sourceMappingURL=component-types.d.ts.map
|