@planning-inspectorate/dynamic-forms 3.15.0 → 3.15.2
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/address/question.js +1 -1
- package/src/components/boolean/question.js +1 -14
- package/src/components/checkbox/question.js +1 -10
- package/src/components/date/question.js +3 -4
- package/src/components/date-period/question.js +12 -10
- package/src/components/date-time/question.js +3 -5
- package/src/components/email/question.js +1 -5
- package/src/components/manage-list/question.js +1 -1
- package/src/components/multi-field-input/question.js +3 -3
- package/src/components/number-entry/question.js +3 -5
- package/src/components/radio/question.js +1 -17
- package/src/components/select/question.js +1 -16
- package/src/components/single-line-input/question.js +1 -4
- package/src/components/text-entry/question.js +3 -5
- package/src/components/text-entry-redact/question.js +3 -10
- package/src/components/unit-option-entry/question.js +3 -6
- package/src/questions/question-props.d.ts +132 -28
- package/types/src/components/address/question.d.ts +2 -2
- package/types/src/components/address/question.d.ts.map +1 -1
- package/types/src/components/boolean/question.d.ts +3 -30
- package/types/src/components/boolean/question.d.ts.map +1 -1
- package/types/src/components/checkbox/question.d.ts +2 -21
- package/types/src/components/checkbox/question.d.ts.map +1 -1
- package/types/src/components/date/question.d.ts +3 -4
- package/types/src/components/date/question.d.ts.map +1 -1
- package/types/src/components/date-period/question.d.ts +11 -15
- package/types/src/components/date-period/question.d.ts.map +1 -1
- package/types/src/components/date-time/question.d.ts +4 -6
- package/types/src/components/date-time/question.d.ts.map +1 -1
- package/types/src/components/email/question.d.ts +4 -0
- package/types/src/components/email/question.d.ts.map +1 -1
- package/types/src/components/manage-list/question.d.ts +2 -2
- package/types/src/components/manage-list/question.d.ts.map +1 -1
- package/types/src/components/multi-field-input/question.d.ts +6 -5
- package/types/src/components/multi-field-input/question.d.ts.map +1 -1
- package/types/src/components/number-entry/question.d.ts +4 -6
- package/types/src/components/number-entry/question.d.ts.map +1 -1
- package/types/src/components/radio/question.d.ts +2 -37
- package/types/src/components/radio/question.d.ts.map +1 -1
- package/types/src/components/select/question.d.ts +2 -35
- package/types/src/components/select/question.d.ts.map +1 -1
- package/types/src/components/single-line-input/question.d.ts +4 -7
- package/types/src/components/single-line-input/question.d.ts.map +1 -1
- package/types/src/components/text-entry/question.d.ts +4 -6
- package/types/src/components/text-entry/question.d.ts.map +1 -1
- package/types/src/components/text-entry-redact/question.d.ts +9 -16
- package/types/src/components/text-entry-redact/question.d.ts.map +1 -1
- package/types/src/components/unit-option-entry/question.d.ts +7 -2
- package/types/src/components/unit-option-entry/question.d.ts.map +1 -1
- package/types/src/questions/question-props.d.ts +132 -28
|
@@ -18,14 +18,22 @@ type QuestionTypes =
|
|
|
18
18
|
| 'text-entry-redact'
|
|
19
19
|
| 'unit-option';
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Base params that question classes need to function (NO type - that's routing metadata)
|
|
23
|
+
*/
|
|
24
|
+
export type CommonQuestionParams = Omit<QuestionParameters, 'viewFolder'>;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Full props including type for routing/factory layer
|
|
28
|
+
*/
|
|
29
|
+
type CommonQuestionProps = CommonQuestionParams & {
|
|
22
30
|
type: QuestionTypes;
|
|
23
31
|
};
|
|
24
32
|
|
|
25
33
|
/**
|
|
26
34
|
* Generic question props type so that custom components can be used without having to define a new type for each one.
|
|
27
35
|
*/
|
|
28
|
-
export type BaseQuestionProps =
|
|
36
|
+
export type BaseQuestionProps = CommonQuestionParams & {
|
|
29
37
|
type: string;
|
|
30
38
|
};
|
|
31
39
|
|
|
@@ -68,6 +76,7 @@ interface InputField {
|
|
|
68
76
|
suffix?: Affix; // used to add a suffix to the field
|
|
69
77
|
prefix?: Affix; // used to add a prefix to the field
|
|
70
78
|
hint?: string;
|
|
79
|
+
classes?: string;
|
|
71
80
|
}
|
|
72
81
|
|
|
73
82
|
/*
|
|
@@ -95,79 +104,174 @@ interface UnitOption {
|
|
|
95
104
|
};
|
|
96
105
|
}
|
|
97
106
|
|
|
98
|
-
|
|
99
|
-
|
|
107
|
+
/**
|
|
108
|
+
* Internal base params for questions with options - not exported
|
|
109
|
+
*/
|
|
110
|
+
type OptionsQuestionParams = CommonQuestionParams & {
|
|
111
|
+
options: Option[];
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export type BooleanQuestionParams = Omit<RadioQuestionParams, 'options'> & {
|
|
100
115
|
options?: Option[];
|
|
101
116
|
interfaceType?: 'checkbox' | 'radio';
|
|
102
117
|
};
|
|
103
118
|
|
|
104
|
-
type
|
|
119
|
+
type BooleanQuestionProps = BooleanQuestionParams & {
|
|
120
|
+
type: 'boolean';
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export type CheckboxQuestionParams = OptionsQuestionParams;
|
|
124
|
+
|
|
125
|
+
type CheckboxQuestionProps = CheckboxQuestionParams & {
|
|
105
126
|
type: 'checkbox';
|
|
106
|
-
options: Option[];
|
|
107
127
|
};
|
|
108
128
|
|
|
109
|
-
type
|
|
129
|
+
export type DateQuestionParams = CommonQuestionParams & {
|
|
130
|
+
dateFormat?: string;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
type DateQuestionProps = DateQuestionParams & {
|
|
110
134
|
type: 'date';
|
|
111
135
|
};
|
|
112
136
|
|
|
113
|
-
|
|
137
|
+
// Minute and second will default to 0 if not provided
|
|
138
|
+
interface TimeComponents {
|
|
139
|
+
hour: number;
|
|
140
|
+
minute?: number;
|
|
141
|
+
second?: number;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export type DatePeriodQuestionParams = CommonQuestionParams & {
|
|
145
|
+
dateFormat?: string;
|
|
146
|
+
labels?: { start: string; end: string };
|
|
147
|
+
hintStart?: string;
|
|
148
|
+
hintEnd?: string;
|
|
149
|
+
startTime?: TimeComponents;
|
|
150
|
+
endTime?: TimeComponents;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
type DatePeriodQuestionProps = DatePeriodQuestionParams & {
|
|
114
154
|
type: 'date-period';
|
|
115
155
|
};
|
|
116
156
|
|
|
117
|
-
type
|
|
157
|
+
export type DateTimeQuestionParams = CommonQuestionParams & {
|
|
158
|
+
dateFormat?: string;
|
|
159
|
+
timeFormat?: string;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
type DateTimeQuestionProps = DateTimeQuestionParams & {
|
|
118
163
|
type: 'date-time';
|
|
119
164
|
};
|
|
120
165
|
|
|
121
|
-
type
|
|
166
|
+
export type ManageListQuestionParams = CommonQuestionParams & {
|
|
167
|
+
titleSingular?: string;
|
|
168
|
+
showManageListQuestions?: boolean;
|
|
169
|
+
showAnswersInSummary?: boolean;
|
|
170
|
+
confirmationQuestion?: string;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
type ManageListQuestionProps = ManageListQuestionParams & {
|
|
122
174
|
type: 'manage-list';
|
|
123
175
|
};
|
|
124
176
|
|
|
125
|
-
type
|
|
177
|
+
export type EmailQuestionParams = SingleLineInputQuestionParams & {
|
|
178
|
+
autocomplete?: string; // autocomplete attribute value (defaults to 'email')
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
type EmailQuestionProps = EmailQuestionParams & {
|
|
126
182
|
type: 'email';
|
|
127
183
|
};
|
|
128
184
|
|
|
129
|
-
export type
|
|
130
|
-
type: 'multi-field-input';
|
|
185
|
+
export type MultiFieldInputQuestionParams = CommonQuestionParams & {
|
|
131
186
|
inputFields: InputField[];
|
|
132
187
|
};
|
|
133
188
|
|
|
134
|
-
type
|
|
135
|
-
type: '
|
|
189
|
+
export type MultiFieldInputQuestionProps = MultiFieldInputQuestionParams & {
|
|
190
|
+
type: 'multi-field-input';
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
export type NumberEntryQuestionParams = CommonQuestionParams & {
|
|
136
194
|
suffix?: string;
|
|
195
|
+
label?: string;
|
|
137
196
|
};
|
|
138
197
|
|
|
139
|
-
type
|
|
198
|
+
type NumberEntryQuestionProps = NumberEntryQuestionParams & {
|
|
199
|
+
type: 'number';
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
export type RadioQuestionParams = OptionsQuestionParams & {
|
|
203
|
+
label?: string;
|
|
204
|
+
legend?: string;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
type RadioQuestionProps = RadioQuestionParams & {
|
|
140
208
|
type: 'radio';
|
|
141
|
-
options: Option[];
|
|
142
209
|
};
|
|
143
210
|
|
|
144
|
-
type
|
|
145
|
-
type: 'select';
|
|
146
|
-
options: Option[];
|
|
211
|
+
export type SelectQuestionParams = OptionsQuestionParams & {
|
|
147
212
|
disableAccessibleAutocomplete?: boolean;
|
|
213
|
+
label?: string;
|
|
214
|
+
legend?: string;
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
type SelectQuestionProps = SelectQuestionParams & {
|
|
218
|
+
type: 'select';
|
|
148
219
|
};
|
|
149
220
|
|
|
150
|
-
type
|
|
221
|
+
export type SingleLineInputQuestionParams = CommonQuestionParams & {
|
|
222
|
+
inputAttributes?: Record<string, string>; // HTML attributes to add to the input
|
|
223
|
+
label?: string; // if defined this will show as a label for the input and the question will just be a standard h1
|
|
224
|
+
classes?: string; // HTML classes to add to the input
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
type SingleLineInputQuestionProps = SingleLineInputQuestionParams & {
|
|
151
228
|
type: 'single-line-input';
|
|
152
|
-
inputAttributes?: Record<string, string>;
|
|
153
229
|
};
|
|
154
230
|
|
|
155
|
-
type
|
|
231
|
+
export type SiteAddressQuestionParams = CommonQuestionParams;
|
|
232
|
+
|
|
233
|
+
type SiteAddressQuestionProps = SiteAddressQuestionParams & {
|
|
156
234
|
type: 'site-address';
|
|
157
235
|
};
|
|
158
236
|
|
|
159
|
-
type
|
|
237
|
+
type TextEntryCheckbox = {
|
|
238
|
+
header: string;
|
|
239
|
+
text: string;
|
|
240
|
+
name: string;
|
|
241
|
+
errorMessage?: string;
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
export type TextEntryQuestionParams = CommonQuestionParams & {
|
|
245
|
+
textEntryCheckbox?: TextEntryCheckbox;
|
|
246
|
+
label?: string; // if defined this will show as a label for the input and the question will just be a standard h1
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
type TextEntryQuestionProps = TextEntryQuestionParams & {
|
|
160
250
|
type: 'text-entry';
|
|
161
251
|
};
|
|
162
252
|
|
|
163
|
-
type
|
|
253
|
+
export type TextEntryRedactQuestionParams = CommonQuestionParams & {
|
|
254
|
+
textEntryCheckbox?: TextEntryCheckbox;
|
|
255
|
+
label?: string; // if defined this will show as a label for the input and the question will just be a standard h1
|
|
256
|
+
onlyShowRedactedValueForSummary?: boolean;
|
|
257
|
+
useRedactedFieldNameForSave?: boolean;
|
|
258
|
+
showSuggestionsUi?: boolean;
|
|
259
|
+
summaryText?: string; // summaryText to use with the details component
|
|
260
|
+
shouldTruncateSummary?: boolean; // determines whether redacted comment is truncated in summary view
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
type TextEntryRedactQuestionProps = TextEntryRedactQuestionParams & {
|
|
164
264
|
type: 'text-entry-redact';
|
|
165
265
|
};
|
|
166
266
|
|
|
167
|
-
type
|
|
168
|
-
|
|
169
|
-
conditionalFieldName: string;
|
|
267
|
+
export type UnitOptionEntryQuestionParams = CommonQuestionParams & {
|
|
268
|
+
conditionalFieldName: string; // will be the quantity and is captured by the conditional in the options
|
|
170
269
|
options: UnitOption[];
|
|
270
|
+
label?: string;
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
type UnitOptionEntryQuestionProps = UnitOptionEntryQuestionParams & {
|
|
274
|
+
type: 'unit-option';
|
|
171
275
|
};
|
|
172
276
|
|
|
173
277
|
export type QuestionProps =
|