@defra/forms-model 3.0.567 → 3.0.568
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/dist/module/form/form-editor/__stubs__/preview.js +128 -1
- package/dist/module/form/form-editor/__stubs__/preview.js.map +1 -1
- package/dist/module/form/form-editor/index.js +1 -1
- package/dist/module/form/form-editor/index.js.map +1 -1
- package/dist/module/form/form-editor/macros/types.js.map +1 -1
- package/dist/module/form/form-editor/preview/component-elements.js +1 -0
- package/dist/module/form/form-editor/preview/component-elements.js.map +1 -1
- package/dist/module/form/form-editor/preview/helpers.js +3 -1
- package/dist/module/form/form-editor/preview/helpers.js.map +1 -1
- package/dist/module/form/form-editor/preview/number-only.js +75 -3
- package/dist/module/form/form-editor/preview/number-only.js.map +1 -1
- package/dist/module/form/form-editor/preview/question.js +30 -3
- package/dist/module/form/form-editor/preview/question.js.map +1 -1
- package/dist/module/form/form-editor/preview/types.js.map +1 -1
- package/dist/types/form/form-editor/__stubs__/preview.d.ts +71 -1
- package/dist/types/form/form-editor/__stubs__/preview.d.ts.map +1 -1
- package/dist/types/form/form-editor/index.d.ts.map +1 -1
- package/dist/types/form/form-editor/macros/types.d.ts +7 -0
- package/dist/types/form/form-editor/macros/types.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/component-elements.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/helpers.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/number-only.d.ts +123 -0
- package/dist/types/form/form-editor/preview/number-only.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/question.d.ts +13 -0
- package/dist/types/form/form-editor/preview/question.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/types.d.ts +8 -0
- package/dist/types/form/form-editor/preview/types.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/uk-address.d.ts +7 -0
- package/dist/types/form/form-editor/preview/uk-address.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/form/form-editor/__stubs__/preview.js +130 -1
- package/src/form/form-editor/index.ts +4 -1
- package/src/form/form-editor/macros/types.ts +3 -0
- package/src/form/form-editor/preview/component-elements.js +4 -0
- package/src/form/form-editor/preview/helpers.js +6 -1
- package/src/form/form-editor/preview/number-only.js +72 -3
- package/src/form/form-editor/preview/question.js +33 -3
- package/src/form/form-editor/preview/types.ts +10 -0
|
@@ -85,6 +85,11 @@ export class QuestionPreviewElements {
|
|
|
85
85
|
* @protected
|
|
86
86
|
*/
|
|
87
87
|
_shortDesc = '';
|
|
88
|
+
/**
|
|
89
|
+
* @type {string}
|
|
90
|
+
* @protected
|
|
91
|
+
*/
|
|
92
|
+
_userClasses = '';
|
|
88
93
|
/**
|
|
89
94
|
* @type {string}
|
|
90
95
|
* @protected
|
|
@@ -111,6 +116,7 @@ export class QuestionPreviewElements {
|
|
|
111
116
|
hintText,
|
|
112
117
|
optional,
|
|
113
118
|
shortDesc,
|
|
119
|
+
userClasses,
|
|
114
120
|
usePostcodeLookup,
|
|
115
121
|
items,
|
|
116
122
|
content
|
|
@@ -119,6 +125,7 @@ export class QuestionPreviewElements {
|
|
|
119
125
|
this._hintText = hintText;
|
|
120
126
|
this._optional = optional;
|
|
121
127
|
this._shortDesc = shortDesc;
|
|
128
|
+
this._userClasses = userClasses;
|
|
122
129
|
this._items = items;
|
|
123
130
|
this._content = content;
|
|
124
131
|
this._usePostcodeLookup = usePostcodeLookup ?? false;
|
|
@@ -133,6 +140,7 @@ export class QuestionPreviewElements {
|
|
|
133
140
|
hintText: this._hintText,
|
|
134
141
|
optional: this._optional,
|
|
135
142
|
shortDesc: this._shortDesc,
|
|
143
|
+
userClasses: this._userClasses,
|
|
136
144
|
usePostcodeLookup: this._usePostcodeLookup,
|
|
137
145
|
items: this._items,
|
|
138
146
|
content: this._content
|
|
@@ -200,10 +208,23 @@ export const baseElements = /** @type {BaseSettings} */{
|
|
|
200
208
|
optional: false,
|
|
201
209
|
question: 'Which quest would you like to pick?',
|
|
202
210
|
hintText: 'Choose one adventure that best suits you.',
|
|
211
|
+
userClasses: '',
|
|
203
212
|
shortDesc: '',
|
|
204
213
|
content: '',
|
|
205
214
|
largeTitle: true
|
|
206
215
|
};
|
|
216
|
+
export const numberElements = /** @type {NumberSettings} */{
|
|
217
|
+
items: [],
|
|
218
|
+
optional: false,
|
|
219
|
+
question: 'Which quest would you like to pick?',
|
|
220
|
+
hintText: 'Choose one adventure that best suits you.',
|
|
221
|
+
userClasses: '',
|
|
222
|
+
shortDesc: '',
|
|
223
|
+
content: '',
|
|
224
|
+
largeTitle: true,
|
|
225
|
+
prefix: '',
|
|
226
|
+
suffix: ''
|
|
227
|
+
};
|
|
207
228
|
const list1Id = '414d82a3-4cab-416a-bd54-6b86fbd51120';
|
|
208
229
|
const list2Id = '801385a4-81e6-4171-96c3-6c6727d97f22';
|
|
209
230
|
const list3Id = 'e6e3f621-b875-4ca3-a054-cca9149149dd';
|
|
@@ -259,10 +280,116 @@ export function buildPreviewShortAnswer(partialBaseElements, renderMock) {
|
|
|
259
280
|
...partialBaseElements
|
|
260
281
|
}), new QuestionRendererStub(renderMock));
|
|
261
282
|
}
|
|
283
|
+
export class NumberPreviewElements {
|
|
284
|
+
/**
|
|
285
|
+
* @protected
|
|
286
|
+
*/
|
|
287
|
+
_question = '';
|
|
288
|
+
/** @protected */
|
|
289
|
+
_hintText = '';
|
|
290
|
+
/** @protected */
|
|
291
|
+
_optional = false;
|
|
292
|
+
/**
|
|
293
|
+
* @type {string}
|
|
294
|
+
* @protected
|
|
295
|
+
*/
|
|
296
|
+
_shortDesc = '';
|
|
297
|
+
/**
|
|
298
|
+
* @type {string}
|
|
299
|
+
* @protected
|
|
300
|
+
*/
|
|
301
|
+
_userClasses = '';
|
|
302
|
+
/**
|
|
303
|
+
* @type {string}
|
|
304
|
+
* @protected
|
|
305
|
+
*/
|
|
306
|
+
_prefix = '';
|
|
307
|
+
/**
|
|
308
|
+
* @type {string}
|
|
309
|
+
* @protected
|
|
310
|
+
*/
|
|
311
|
+
_suffix = '';
|
|
312
|
+
/**
|
|
313
|
+
* @type {string}
|
|
314
|
+
* @protected
|
|
315
|
+
*/
|
|
316
|
+
_content = '';
|
|
317
|
+
/**
|
|
318
|
+
*
|
|
319
|
+
* @type {ListElement[]}
|
|
320
|
+
* @private
|
|
321
|
+
*/
|
|
322
|
+
_items = [];
|
|
323
|
+
/**
|
|
324
|
+
* @protected
|
|
325
|
+
* @type {boolean}
|
|
326
|
+
*/
|
|
327
|
+
_usePostcodeLookup = false;
|
|
328
|
+
afterInputsHTML = '<div class="govuk-inset-text">No items added yet.</div>';
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* @param {NumberSettings} baseSettings
|
|
332
|
+
*/
|
|
333
|
+
constructor({
|
|
334
|
+
question,
|
|
335
|
+
hintText,
|
|
336
|
+
optional,
|
|
337
|
+
shortDesc,
|
|
338
|
+
userClasses,
|
|
339
|
+
prefix,
|
|
340
|
+
suffix,
|
|
341
|
+
usePostcodeLookup,
|
|
342
|
+
items,
|
|
343
|
+
content
|
|
344
|
+
}) {
|
|
345
|
+
this._question = question;
|
|
346
|
+
this._hintText = hintText;
|
|
347
|
+
this._optional = optional;
|
|
348
|
+
this._shortDesc = shortDesc;
|
|
349
|
+
this._userClasses = userClasses;
|
|
350
|
+
this._prefix = prefix;
|
|
351
|
+
this._suffix = suffix;
|
|
352
|
+
this._items = items;
|
|
353
|
+
this._content = content;
|
|
354
|
+
this._usePostcodeLookup = usePostcodeLookup ?? false;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* @returns {NumberSettings}
|
|
359
|
+
*/
|
|
360
|
+
get values() {
|
|
361
|
+
return {
|
|
362
|
+
question: this._question,
|
|
363
|
+
hintText: this._hintText,
|
|
364
|
+
optional: this._optional,
|
|
365
|
+
shortDesc: this._shortDesc,
|
|
366
|
+
userClasses: this._userClasses,
|
|
367
|
+
prefix: this._prefix,
|
|
368
|
+
suffix: this._suffix,
|
|
369
|
+
usePostcodeLookup: this._usePostcodeLookup,
|
|
370
|
+
items: this._items,
|
|
371
|
+
content: this._content
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* @param {string} _value
|
|
377
|
+
*/
|
|
378
|
+
setPreviewHTML(_value) {
|
|
379
|
+
// Not implemented for server side render
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* @param {HTMLElement} _value
|
|
384
|
+
*/
|
|
385
|
+
setPreviewDOM(_value) {
|
|
386
|
+
// Not implemented for server side render
|
|
387
|
+
}
|
|
388
|
+
}
|
|
262
389
|
|
|
263
390
|
/**
|
|
264
391
|
* @import { ListElement } from '~/src/form/form-editor/types.js'
|
|
265
392
|
* @import { PagePreviewPanelMacro } from '~/src/form/form-editor/macros/types.js'
|
|
266
|
-
* @import { BaseSettings, ListElements, RenderContext, QuestionBaseModel,
|
|
393
|
+
* @import { BaseSettings, ListElements, NumberSettings, RenderContext, QuestionBaseModel, QuestionRenderer, AutocompleteElements, PageOverviewElements, PageRenderer } from '~/src/form/form-editor/preview/types.js'
|
|
267
394
|
*/
|
|
268
395
|
//# sourceMappingURL=preview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.js","names":["Question","QuestionRendererStub","renderMock","constructor","render","questionTemplate","questionBaseModel","buildHTML","_questionTemplate","_renderContext","PageRendererStub","pageTemplate","pagePreviewPanelMacro","QuestionPreviewElements","_question","_hintText","_optional","_shortDesc","_content","_items","_usePostcodeLookup","afterInputsHTML","question","hintText","optional","shortDesc","usePostcodeLookup","items","content","values","setPreviewHTML","_value","setPreviewDOM","AutocompletePreviewElements","autocompleteOptions","elements","PagePreviewElements","guidance","heading","addHeading","repeatQuestion","hasRepeater","undefined","length","baseElements","largeTitle","list1Id","list2Id","list3Id","list4Id","listElementsBase","label","text","value","id","listElementsStub","buildPreviewShortAnswer","partialBaseElements"],"sources":["../../../../../src/form/form-editor/__stubs__/preview.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\n/**\n * @implements {QuestionRenderer}\n */\nexport class QuestionRendererStub {\n /**\n * @type {jest.Mock<void, [string, QuestionBaseModel]>}\n */\n renderMock\n\n /**\n * @param {jest.Mock<void, [string, QuestionBaseModel]>} renderMock\n */\n constructor(renderMock) {\n this.renderMock = renderMock\n }\n\n /**\n * @param {string} questionTemplate\n * @param {QuestionBaseModel} questionBaseModel\n */\n render(questionTemplate, questionBaseModel) {\n this.renderMock(questionTemplate, questionBaseModel)\n }\n\n /**\n * @returns {string}\n * @param {string} _questionTemplate\n * @param {RenderContext} _renderContext\n */\n static buildHTML(_questionTemplate, _renderContext) {\n return '**** BUILT HTML ****'\n }\n}\n\n/**\n * @implements {PageRenderer}\n */\nexport class PageRendererStub {\n /**\n * @type {jest.Mock<void, [string, PagePreviewPanelMacro]>}\n */\n renderMock\n\n /**\n * @param {jest.Mock<void, [string, PagePreviewPanelMacro]>} renderMock\n */\n constructor(renderMock) {\n this.renderMock = renderMock\n }\n\n /**\n * @param {string} pageTemplate\n * @param {PagePreviewPanelMacro} pagePreviewPanelMacro\n */\n render(pageTemplate, pagePreviewPanelMacro) {\n this.renderMock(pageTemplate, pagePreviewPanelMacro)\n }\n\n /**\n * @returns {string}\n * @param {string} _questionTemplate\n * @param {RenderContext} _renderContext\n */\n static buildHTML(_questionTemplate, _renderContext) {\n return '**** BUILT HTML ****'\n }\n}\n\n/**\n * @implements {ListElements}\n */\nexport class QuestionPreviewElements {\n /**\n * @protected\n */\n _question = ''\n /** @protected */\n _hintText = ''\n /** @protected */\n _optional = false\n /**\n * @type {string}\n * @protected\n */\n _shortDesc = ''\n /**\n * @type {string}\n * @protected\n */\n _content = ''\n /**\n *\n * @type {ListElement[]}\n * @private\n */\n _items = []\n /**\n * @protected\n * @type {boolean}\n */\n _usePostcodeLookup = false\n afterInputsHTML = '<div class=\"govuk-inset-text\">No items added yet.</div>'\n\n /**\n * @param {BaseSettings} baseSettings\n */\n constructor({\n question,\n hintText,\n optional,\n shortDesc,\n usePostcodeLookup,\n items,\n content\n }) {\n this._question = question\n this._hintText = hintText\n this._optional = optional\n this._shortDesc = shortDesc\n this._items = items\n this._content = content\n this._usePostcodeLookup = usePostcodeLookup ?? false\n }\n\n /**\n * @returns {BaseSettings}\n */\n get values() {\n return {\n question: this._question,\n hintText: this._hintText,\n optional: this._optional,\n shortDesc: this._shortDesc,\n usePostcodeLookup: this._usePostcodeLookup,\n items: this._items,\n content: this._content\n }\n }\n\n /**\n * @param {string} _value\n */\n setPreviewHTML(_value) {\n // Not implemented for server side render\n }\n\n /**\n * @param {HTMLElement} _value\n */\n setPreviewDOM(_value) {\n // Not implemented for server side render\n }\n}\n\n/**\n * @implements {AutocompleteElements}\n */\nexport class AutocompletePreviewElements extends QuestionPreviewElements {\n /**\n * @param {BaseSettings & {autocompleteOptions: string}} elements\n */\n constructor({ autocompleteOptions, ...elements }) {\n super(elements)\n this.autocompleteOptions = autocompleteOptions\n }\n}\n\n/**\n * @implements {PageOverviewElements}\n */\nexport class PagePreviewElements {\n guidance\n heading\n addHeading\n repeatQuestion\n hasRepeater\n\n /**\n * @param {string} heading\n * @param {string} guidance\n * @param {boolean} [addHeading]\n * @param {string} repeatQuestion\n * @param {boolean} hasRepeater\n */\n constructor(\n heading,\n guidance = '',\n addHeading = undefined,\n repeatQuestion = '',\n hasRepeater = false\n ) {\n this.heading = heading\n this.guidance = guidance\n this.addHeading = addHeading ?? heading.length > 0\n this.repeatQuestion = repeatQuestion\n this.hasRepeater = hasRepeater\n }\n}\n\nexport const baseElements = /** @type {BaseSettings} */ ({\n items: [],\n optional: false,\n question: 'Which quest would you like to pick?',\n hintText: 'Choose one adventure that best suits you.',\n shortDesc: '',\n content: '',\n largeTitle: true\n})\n\nconst list1Id = '414d82a3-4cab-416a-bd54-6b86fbd51120'\nconst list2Id = '801385a4-81e6-4171-96c3-6c6727d97f22'\nconst list3Id = 'e6e3f621-b875-4ca3-a054-cca9149149dd'\nconst list4Id = 'd71b3909-582f-4e90-b6f5-490b89a6eb8f'\n\nconst listElementsBase = /** @type {BaseSettings} */ ({\n ...baseElements,\n items: [\n {\n label: { text: 'Treasure Hunting' },\n text: 'Treasure Hunting',\n value: 'Treasure Hunting',\n id: list1Id\n },\n {\n label: { text: 'Rescuing the princess' },\n text: 'Rescuing the princess',\n value: 'Rescuing the princess',\n id: list2Id\n },\n {\n label: { text: 'Saving a city' },\n text: 'Saving a city',\n value: 'Saving a city',\n id: list3Id\n },\n {\n label: { text: 'Defeating the baron' },\n text: 'Defeating the baron',\n value: 'Defeating the baron',\n id: list4Id\n }\n ]\n})\n\nexport const listElementsStub = {\n list1Id,\n list2Id,\n list3Id,\n list4Id,\n baseElements: listElementsBase\n}\n\n/**\n * @param {Partial<BaseSettings>} partialBaseElements\n * @param {jest.Mock<void, [string, QuestionBaseModel]>} renderMock\n * @returns {Question}\n */\nexport function buildPreviewShortAnswer(partialBaseElements, renderMock) {\n return new Question(\n new QuestionPreviewElements({\n ...baseElements,\n ...partialBaseElements\n }),\n new QuestionRendererStub(renderMock)\n )\n}\n\n/**\n * @import { ListElement } from '~/src/form/form-editor/types.js'\n * @import { PagePreviewPanelMacro } from '~/src/form/form-editor/macros/types.js'\n * @import { BaseSettings, ListElements, RenderContext, QuestionBaseModel, QuestionElements, QuestionRenderer, AutocompleteElements, PageOverviewElements, PageRenderer } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SAASA,QAAQ;;AAEjB;AACA;AACA;AACA,OAAO,MAAMC,oBAAoB,CAAC;EAChC;AACF;AACA;EACEC,UAAU;;EAEV;AACF;AACA;EACEC,WAAWA,CAACD,UAAU,EAAE;IACtB,IAAI,CAACA,UAAU,GAAGA,UAAU;EAC9B;;EAEA;AACF;AACA;AACA;EACEE,MAAMA,CAACC,gBAAgB,EAAEC,iBAAiB,EAAE;IAC1C,IAAI,CAACJ,UAAU,CAACG,gBAAgB,EAAEC,iBAAiB,CAAC;EACtD;;EAEA;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,SAASM,uBAAuBA,CAACC,mBAAmB,EAAEvD,UAAU,EAAE;EACvE,OAAO,IAAIF,QAAQ,CACjB,IAAIa,uBAAuB,CAAC;IAC1B,GAAG+B,YAAY;IACf,GAAGa;EACL,CAAC,CAAC,EACF,IAAIxD,oBAAoB,CAACC,UAAU,CACrC,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"preview.js","names":["Question","QuestionRendererStub","renderMock","constructor","render","questionTemplate","questionBaseModel","buildHTML","_questionTemplate","_renderContext","PageRendererStub","pageTemplate","pagePreviewPanelMacro","QuestionPreviewElements","_question","_hintText","_optional","_shortDesc","_userClasses","_content","_items","_usePostcodeLookup","afterInputsHTML","question","hintText","optional","shortDesc","userClasses","usePostcodeLookup","items","content","values","setPreviewHTML","_value","setPreviewDOM","AutocompletePreviewElements","autocompleteOptions","elements","PagePreviewElements","guidance","heading","addHeading","repeatQuestion","hasRepeater","undefined","length","baseElements","largeTitle","numberElements","prefix","suffix","list1Id","list2Id","list3Id","list4Id","listElementsBase","label","text","value","id","listElementsStub","buildPreviewShortAnswer","partialBaseElements","NumberPreviewElements","_prefix","_suffix"],"sources":["../../../../../src/form/form-editor/__stubs__/preview.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\n/**\n * @implements {QuestionRenderer}\n */\nexport class QuestionRendererStub {\n /**\n * @type {jest.Mock<void, [string, QuestionBaseModel]>}\n */\n renderMock\n\n /**\n * @param {jest.Mock<void, [string, QuestionBaseModel]>} renderMock\n */\n constructor(renderMock) {\n this.renderMock = renderMock\n }\n\n /**\n * @param {string} questionTemplate\n * @param {QuestionBaseModel} questionBaseModel\n */\n render(questionTemplate, questionBaseModel) {\n this.renderMock(questionTemplate, questionBaseModel)\n }\n\n /**\n * @returns {string}\n * @param {string} _questionTemplate\n * @param {RenderContext} _renderContext\n */\n static buildHTML(_questionTemplate, _renderContext) {\n return '**** BUILT HTML ****'\n }\n}\n\n/**\n * @implements {PageRenderer}\n */\nexport class PageRendererStub {\n /**\n * @type {jest.Mock<void, [string, PagePreviewPanelMacro]>}\n */\n renderMock\n\n /**\n * @param {jest.Mock<void, [string, PagePreviewPanelMacro]>} renderMock\n */\n constructor(renderMock) {\n this.renderMock = renderMock\n }\n\n /**\n * @param {string} pageTemplate\n * @param {PagePreviewPanelMacro} pagePreviewPanelMacro\n */\n render(pageTemplate, pagePreviewPanelMacro) {\n this.renderMock(pageTemplate, pagePreviewPanelMacro)\n }\n\n /**\n * @returns {string}\n * @param {string} _questionTemplate\n * @param {RenderContext} _renderContext\n */\n static buildHTML(_questionTemplate, _renderContext) {\n return '**** BUILT HTML ****'\n }\n}\n\n/**\n * @implements {ListElements}\n */\nexport class QuestionPreviewElements {\n /**\n * @protected\n */\n _question = ''\n /** @protected */\n _hintText = ''\n /** @protected */\n _optional = false\n /**\n * @type {string}\n * @protected\n */\n _shortDesc = ''\n /**\n * @type {string}\n * @protected\n */\n _userClasses = ''\n /**\n * @type {string}\n * @protected\n */\n _content = ''\n /**\n *\n * @type {ListElement[]}\n * @private\n */\n _items = []\n /**\n * @protected\n * @type {boolean}\n */\n _usePostcodeLookup = false\n afterInputsHTML = '<div class=\"govuk-inset-text\">No items added yet.</div>'\n\n /**\n * @param {BaseSettings} baseSettings\n */\n constructor({\n question,\n hintText,\n optional,\n shortDesc,\n userClasses,\n usePostcodeLookup,\n items,\n content\n }) {\n this._question = question\n this._hintText = hintText\n this._optional = optional\n this._shortDesc = shortDesc\n this._userClasses = userClasses\n this._items = items\n this._content = content\n this._usePostcodeLookup = usePostcodeLookup ?? false\n }\n\n /**\n * @returns {BaseSettings}\n */\n get values() {\n return {\n question: this._question,\n hintText: this._hintText,\n optional: this._optional,\n shortDesc: this._shortDesc,\n userClasses: this._userClasses,\n usePostcodeLookup: this._usePostcodeLookup,\n items: this._items,\n content: this._content\n }\n }\n\n /**\n * @param {string} _value\n */\n setPreviewHTML(_value) {\n // Not implemented for server side render\n }\n\n /**\n * @param {HTMLElement} _value\n */\n setPreviewDOM(_value) {\n // Not implemented for server side render\n }\n}\n\n/**\n * @implements {AutocompleteElements}\n */\nexport class AutocompletePreviewElements extends QuestionPreviewElements {\n /**\n * @param {BaseSettings & {autocompleteOptions: string}} elements\n */\n constructor({ autocompleteOptions, ...elements }) {\n super(elements)\n this.autocompleteOptions = autocompleteOptions\n }\n}\n\n/**\n * @implements {PageOverviewElements}\n */\nexport class PagePreviewElements {\n guidance\n heading\n addHeading\n repeatQuestion\n hasRepeater\n\n /**\n * @param {string} heading\n * @param {string} guidance\n * @param {boolean} [addHeading]\n * @param {string} repeatQuestion\n * @param {boolean} hasRepeater\n */\n constructor(\n heading,\n guidance = '',\n addHeading = undefined,\n repeatQuestion = '',\n hasRepeater = false\n ) {\n this.heading = heading\n this.guidance = guidance\n this.addHeading = addHeading ?? heading.length > 0\n this.repeatQuestion = repeatQuestion\n this.hasRepeater = hasRepeater\n }\n}\n\nexport const baseElements = /** @type {BaseSettings} */ ({\n items: [],\n optional: false,\n question: 'Which quest would you like to pick?',\n hintText: 'Choose one adventure that best suits you.',\n userClasses: '',\n shortDesc: '',\n content: '',\n largeTitle: true\n})\n\nexport const numberElements = /** @type {NumberSettings} */ ({\n items: [],\n optional: false,\n question: 'Which quest would you like to pick?',\n hintText: 'Choose one adventure that best suits you.',\n userClasses: '',\n shortDesc: '',\n content: '',\n largeTitle: true,\n prefix: '',\n suffix: ''\n})\n\nconst list1Id = '414d82a3-4cab-416a-bd54-6b86fbd51120'\nconst list2Id = '801385a4-81e6-4171-96c3-6c6727d97f22'\nconst list3Id = 'e6e3f621-b875-4ca3-a054-cca9149149dd'\nconst list4Id = 'd71b3909-582f-4e90-b6f5-490b89a6eb8f'\n\nconst listElementsBase = /** @type {BaseSettings} */ ({\n ...baseElements,\n items: [\n {\n label: { text: 'Treasure Hunting' },\n text: 'Treasure Hunting',\n value: 'Treasure Hunting',\n id: list1Id\n },\n {\n label: { text: 'Rescuing the princess' },\n text: 'Rescuing the princess',\n value: 'Rescuing the princess',\n id: list2Id\n },\n {\n label: { text: 'Saving a city' },\n text: 'Saving a city',\n value: 'Saving a city',\n id: list3Id\n },\n {\n label: { text: 'Defeating the baron' },\n text: 'Defeating the baron',\n value: 'Defeating the baron',\n id: list4Id\n }\n ]\n})\n\nexport const listElementsStub = {\n list1Id,\n list2Id,\n list3Id,\n list4Id,\n baseElements: listElementsBase\n}\n\n/**\n * @param {Partial<BaseSettings>} partialBaseElements\n * @param {jest.Mock<void, [string, QuestionBaseModel]>} renderMock\n * @returns {Question}\n */\nexport function buildPreviewShortAnswer(partialBaseElements, renderMock) {\n return new Question(\n new QuestionPreviewElements({\n ...baseElements,\n ...partialBaseElements\n }),\n new QuestionRendererStub(renderMock)\n )\n}\n\nexport class NumberPreviewElements {\n /**\n * @protected\n */\n _question = ''\n /** @protected */\n _hintText = ''\n /** @protected */\n _optional = false\n /**\n * @type {string}\n * @protected\n */\n _shortDesc = ''\n /**\n * @type {string}\n * @protected\n */\n _userClasses = ''\n /**\n * @type {string}\n * @protected\n */\n _prefix = ''\n /**\n * @type {string}\n * @protected\n */\n _suffix = ''\n /**\n * @type {string}\n * @protected\n */\n _content = ''\n /**\n *\n * @type {ListElement[]}\n * @private\n */\n _items = []\n /**\n * @protected\n * @type {boolean}\n */\n _usePostcodeLookup = false\n afterInputsHTML = '<div class=\"govuk-inset-text\">No items added yet.</div>'\n\n /**\n * @param {NumberSettings} baseSettings\n */\n constructor({\n question,\n hintText,\n optional,\n shortDesc,\n userClasses,\n prefix,\n suffix,\n usePostcodeLookup,\n items,\n content\n }) {\n this._question = question\n this._hintText = hintText\n this._optional = optional\n this._shortDesc = shortDesc\n this._userClasses = userClasses\n this._prefix = prefix\n this._suffix = suffix\n this._items = items\n this._content = content\n this._usePostcodeLookup = usePostcodeLookup ?? false\n }\n\n /**\n * @returns {NumberSettings}\n */\n get values() {\n return {\n question: this._question,\n hintText: this._hintText,\n optional: this._optional,\n shortDesc: this._shortDesc,\n userClasses: this._userClasses,\n prefix: this._prefix,\n suffix: this._suffix,\n usePostcodeLookup: this._usePostcodeLookup,\n items: this._items,\n content: this._content\n }\n }\n\n /**\n * @param {string} _value\n */\n setPreviewHTML(_value) {\n // Not implemented for server side render\n }\n\n /**\n * @param {HTMLElement} _value\n */\n setPreviewDOM(_value) {\n // Not implemented for server side render\n }\n}\n\n/**\n * @import { ListElement } from '~/src/form/form-editor/types.js'\n * @import { PagePreviewPanelMacro } from '~/src/form/form-editor/macros/types.js'\n * @import { BaseSettings, ListElements, NumberSettings, RenderContext, QuestionBaseModel, QuestionRenderer, AutocompleteElements, PageOverviewElements, PageRenderer } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SAASA,QAAQ;;AAEjB;AACA;AACA;AACA,OAAO,MAAMC,oBAAoB,CAAC;EAChC;AACF;AACA;EACEC,UAAU;;EAEV;AACF;AACA;EACEC,WAAWA,CAACD,UAAU,EAAE;IACtB,IAAI,CAACA,UAAU,GAAGA,UAAU;EAC9B;;EAEA;AACF;AACA;AACA;EACEE,MAAMA,CAACC,gBAAgB,EAAEC,iBAAiB,EAAE;IAC1C,IAAI,CAACJ,UAAU,CAACG,gBAAgB,EAAEC,iBAAiB,CAAC;EACtD;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAOC,SAASA,CAACC,iBAAiB,EAAEC,cAAc,EAAE;IAClD,OAAO,sBAAsB;EAC/B;AACF;;AAEA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,CAAC;EAC5B;AACF;AACA;EACER,UAAU;;EAEV;AACF;AACA;EACEC,WAAWA,CAACD,UAAU,EAAE;IACtB,IAAI,CAACA,UAAU,GAAGA,UAAU;EAC9B;;EAEA;AACF;AACA;AACA;EACEE,MAAMA,CAACO,YAAY,EAAEC,qBAAqB,EAAE;IAC1C,IAAI,CAACV,UAAU,CAACS,YAAY,EAAEC,qBAAqB,CAAC;EACtD;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAOL,SAASA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IAAI,CAACT,kBAAkB,GAAGO,iBAAiB,IAAI,KAAK;EACtD;;EAEA;AACF;AACA;EACE,IAAIG,MAAMA,CAAA,EAAG;IACX,OAAO;MACLR,QAAQ,EAAE,IAAI,CAACT,SAAS;MACxBU,QAAQ,EAAE,IAAI,CAACT,SAAS;MACxBU,QAAQ,EAAE,IAAI,CAACT,SAAS;MACxBU,SAAS,EAAE,IAAI,CAACT,UAAU;MAC1BU,WAAW,EAAE,IAAI,CAACT,YAAY;MAC9B+B,MAAM,EAAE,IAAI,CAACe,OAAO;MACpBd,MAAM,EAAE,IAAI,CAACe,OAAO;MACpBrC,iBAAiB,EAAE,IAAI,CAACP,kBAAkB;MAC1CQ,KAAK,EAAE,IAAI,CAACT,MAAM;MAClBU,OAAO,EAAE,IAAI,CAACX;IAChB,CAAC;EACH;;EAEA;AACF;AACA;EACEa,cAAcA,CAACC,MAAM,EAAE;IACrB;EAAA;;EAGF;AACF;AACA;EACEC,aAAaA,CAACD,MAAM,EAAE;IACpB;EAAA;AAEJ;;AAEA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -246,7 +246,7 @@ export const formEditorInputPageSettingsKeys = {
|
|
|
246
246
|
*/
|
|
247
247
|
export const formEditorInputPageSettingsSchema = Joi.object().keys(formEditorInputPageSettingsKeys).required().description('Settings for page content and display in the form editor');
|
|
248
248
|
export function govukFieldValueIsString(govukField) {
|
|
249
|
-
return ['question', 'hintText', 'shortDescription', 'autoCompleteOptions'].includes(`${govukField.name}`);
|
|
249
|
+
return ['question', 'hintText', 'shortDescription', 'autoCompleteOptions', 'classes', 'prefix', 'suffix'].includes(`${govukField.name}`);
|
|
250
250
|
}
|
|
251
251
|
export function govukFieldIsChecked(govukField) {
|
|
252
252
|
if (govukField.name !== 'questionOptional' && govukField.name !== 'usePostcodeLookup') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Joi","ComponentType","MAX_NUMBER_OF_REPEAT_ITEMS","MIN_NUMBER_OF_REPEAT_ITEMS","QuestionTypeSubGroup","pageTypeSchema","string","required","valid","description","questionTypeSchema","WrittenAnswerSubGroup","DateSubGroup","UkAddressField","TelephoneNumberField","FileUploadField","EmailAddressField","ListSubGroup","YesNoField","CheckboxesField","RadiosField","AutocompleteField","questionTypeFullSchema","TextField","MultilineTextField","NumberField","DatePartsField","MonthYearField","SelectField","writtenAnswerSubSchema","dateSubSchema","listSubSchema","nameSchema","trim","questionSchema","hintTextSchema","optional","allow","questionOptionalSchema","listForQuestionSchema","listItemCountSchema","number","listItemsDataSchema","exactFilesSchema","empty","integer","min","max","minFilesSchema","maxFilesSchema","fileTypesSchema","array","items","single","default","documentTypesSchema","imageTypesSchema","tabularDataTypesSchema","enhancedActionSchema","radioIdSchema","radioTextSchema","radioHintSchema","radioValueSchema","shortDescriptionSchema","pageHeadingAndGuidanceSchema","pageHeadingSchema","guidanceTextSchema","exitPageSchema","boolean","repeaterSchema","minItemsSchema","maxItemsSchema","questionSetNameSchema","needDeclarationSchema","declarationTextSchema","minSchema","maxSchema","minLengthSchema","maxLengthSchema","maxFutureSchema","maxPastSchema","precisionSchema","prefixSchema","regexSchema","rowsSchema","suffixSchema","classesSchema","jsEnabledSchema","usePostcodeLookupSchema","customValidator","extend","joi","type","base","messages","coerce","from","method","value","helpers","rowSeparatorRule","schema","$_getRule","colSeparatorRule","keysRule","rowSeparator","args","rows","split","map","v","filter","Boolean","colSeparator","keys","coercedValue","row","reduce","acc","col","idx","_err","console","error","errors","rules","convert","alias","$_addRule","name","ref","assert","RegExp","message","Array","isArray","every","k","autoCompleteOptionsSchema","dsv","object","text","disallow","parent","unique","ignoreUndefined","questionDetailsFullSchema","formEditorInputPageKeys","pageType","questionType","formEditorInputPageSchema","formEditorInputheckAnswersSettingsKeys","declarationText","formEditorInputCheckAnswersSettingSchema","formEditorInputQuestionKeys","question","shortDescription","hintText","questionOptional","formEditorInputQuestionSchema","formEditorInputPageSettingsKeys","pageHeadingAndGuidance","pageHeading","guidanceText","formEditorInputPageSettingsSchema","govukFieldValueIsString","govukField","includes","govukFieldIsChecked","checkedValue","checked","allowedErrorTemplateFunctions"],"sources":["../../../../src/form/form-editor/index.ts"],"sourcesContent":["import Joi, { type ArraySchema, type GetRuleOptions } from 'joi'\n\nimport { ComponentType } from '~/src/components/enums.js'\nimport {\n MAX_NUMBER_OF_REPEAT_ITEMS,\n MIN_NUMBER_OF_REPEAT_ITEMS\n} from '~/src/form/form-definition/index.js'\nimport {\n type FormEditorInputCheckAnswersSettings,\n type FormEditorInputPage,\n type FormEditorInputPageSettings,\n type FormEditorInputQuestion,\n type GovukField,\n type GovukFieldQuestionOptional,\n type GovukFieldUsePostcodeLookup,\n type GovukStringField\n} from '~/src/form/form-editor/types.js'\n\nexport enum QuestionTypeSubGroup {\n WrittenAnswerSubGroup = 'writtenAnswerSub',\n DateSubGroup = 'dateSub',\n ListSubGroup = 'listSub'\n}\n\nexport const pageTypeSchema = Joi.string()\n .required()\n .valid('question', 'guidance')\n .description('Type of page - either a question page or guidance page')\n\nexport const questionTypeSchema = Joi.string()\n .required()\n .valid(\n QuestionTypeSubGroup.WrittenAnswerSubGroup,\n QuestionTypeSubGroup.DateSubGroup,\n ComponentType.UkAddressField,\n ComponentType.TelephoneNumberField,\n ComponentType.FileUploadField,\n ComponentType.EmailAddressField,\n QuestionTypeSubGroup.ListSubGroup,\n ComponentType.YesNoField,\n ComponentType.CheckboxesField,\n ComponentType.RadiosField,\n ComponentType.AutocompleteField\n )\n .description('The high-level type of question, including grouped types')\n\nexport const questionTypeFullSchema = Joi.string()\n .required()\n .valid(\n ComponentType.TextField,\n ComponentType.MultilineTextField,\n ComponentType.NumberField,\n ComponentType.DatePartsField,\n ComponentType.MonthYearField,\n ComponentType.UkAddressField,\n ComponentType.TelephoneNumberField,\n ComponentType.FileUploadField,\n ComponentType.EmailAddressField,\n ComponentType.YesNoField,\n ComponentType.CheckboxesField,\n ComponentType.RadiosField,\n ComponentType.AutocompleteField,\n ComponentType.SelectField\n )\n .description('The specific component type to use for this question')\n\nexport const writtenAnswerSubSchema = Joi.string()\n .required()\n .valid(\n ComponentType.TextField,\n ComponentType.MultilineTextField,\n ComponentType.NumberField\n )\n .description('Subtype for written answer questions')\n\nexport const dateSubSchema = Joi.string()\n .required()\n .valid(ComponentType.DatePartsField, ComponentType.MonthYearField)\nexport const listSubSchema = Joi.string()\n .required()\n .valid(\n ComponentType.YesNoField,\n ComponentType.CheckboxesField,\n ComponentType.RadiosField,\n ComponentType.AutocompleteField,\n ComponentType.SelectField\n )\n .description('Subtype for date-related questions')\n\nexport const nameSchema = Joi.string()\n .trim()\n .required()\n .description('Unique identifier for the field')\n\nexport const questionSchema = Joi.string()\n .trim()\n .required()\n .description('The question text displayed to the user')\n\nexport const hintTextSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Optional guidance text displayed below the question')\n\nexport const questionOptionalSchema = Joi.string()\n .trim()\n .optional()\n .valid('', 'true')\n .description(\n 'Indicates whether a question is optional. Empty string or \"true\" values are accepted.'\n )\n\nexport const listForQuestionSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Unique identifier for the list used by the field')\n\nexport const listItemCountSchema = Joi.number()\n .optional()\n .description('Number of list items in the list used by the field')\n\nexport const listItemsDataSchema = Joi.string()\n .allow('')\n .description('List items in JSON format, such as for radios or checkboxes.')\n\nexport const exactFilesSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .max(25)\n .description(\n 'Specifies the exact number of files required for upload. Must be between 1 and 25.'\n )\n\nexport const minFilesSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .max(25)\n .description(\n 'Minimum number of files required for upload. Must be between 1 and 25.'\n )\n\nexport const maxFilesSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .max(25)\n .description(\n 'Maximum number of files allowed for upload. Must be between 1 and 25.'\n )\n\nexport const fileTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\n .description(\n 'Array of allowed file types. Can be provided as a single value or an array.'\n )\n\nexport const documentTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\n .description(\n 'Array of allowed document types. Can be provided as a single value or an array.'\n )\n\nexport const imageTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\n .description(\n 'Array of allowed image types. Can be provided as a single value or an array.'\n )\n\nexport const tabularDataTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\n\nexport const enhancedActionSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Action field that can include enhanced functionality')\n\nexport const radioIdSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Unique identifier for radio options')\n\nexport const radioTextSchema = Joi.string()\n .trim()\n .required()\n .description('The visible text shown next to radio options')\n\nexport const radioHintSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description(\n 'Optional hint text displayed with radio buttons to provide additional guidance'\n )\n\nexport const radioValueSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description(\n 'Array of allowed tabular data types. Can be provided as a single value or an array.'\n )\n\nexport const shortDescriptionSchema = Joi.string()\n .trim()\n .required()\n .description('Brief description of the question for internal use')\n\nexport const pageHeadingAndGuidanceSchema = Joi.string()\n .trim()\n .optional()\n .description('Combined heading and guidance for the page')\n\nexport const pageHeadingSchema = Joi.string()\n .trim()\n .required()\n .description('Main heading displayed at the top of the page')\n\nexport const guidanceTextSchema = Joi.string()\n .trim()\n .description('Guidance text to assist users in completing the page')\n\nexport const exitPageSchema = Joi.boolean()\n .default(false)\n .optional()\n .description('Determines if page is set as an Exit Page')\n\nexport const repeaterSchema = Joi.string()\n .trim()\n .optional()\n .description(\n 'Combined min/max items and question set name for the repeater page'\n )\n\nexport const minItemsSchema = Joi.number()\n .empty('')\n .min(MIN_NUMBER_OF_REPEAT_ITEMS)\n .description('The minimum number of repeater items')\n\nexport const maxItemsSchema = Joi.number()\n .empty('')\n .max(MAX_NUMBER_OF_REPEAT_ITEMS)\n .description('The maximum number of repeater items')\n\nexport const questionSetNameSchema = Joi.string()\n .trim()\n .description('The repeater question set name')\n\nexport const needDeclarationSchema = Joi.string()\n .trim()\n .required()\n .description('Whether a declaration is needed')\n\nexport const declarationTextSchema = Joi.string()\n .trim()\n .required()\n .description('Text of the declaration that users must agree to')\n\nexport const minSchema = Joi.number()\n .empty('')\n .integer()\n .description('Minimum value for numeric inputs')\n\nexport const maxSchema = Joi.number()\n .empty('')\n .integer()\n .description('Maximum value for numeric inputs')\n\nexport const minLengthSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .description('Minimum character length for text inputs')\n\nexport const maxLengthSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .description('Maximum character length for text inputs')\n\nexport const maxFutureSchema = Joi.number()\n .empty('')\n .integer()\n .min(0)\n .description('Maximum days in the future allowed for date inputs')\n\nexport const maxPastSchema = Joi.number()\n .empty('')\n .integer()\n .min(0)\n .description('Maximum days in the past allowed for date inputs')\n\nexport const precisionSchema = Joi.number()\n .empty('')\n .integer()\n .min(0)\n .description('Decimal precision for numeric inputs')\n\nexport const prefixSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Text to display before the input (e.g., £)')\n\nexport const regexSchema = Joi.string()\n .optional()\n .allow('')\n .description('Regular expression pattern for validation')\n\nexport const rowsSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .description('Number of rows for multiline text fields')\n\nexport const suffixSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Text to display after the input (e.g., kg)')\n\nexport const classesSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Custom CSS classes to apply to the component')\n\nexport const jsEnabledSchema = Joi.string()\n .trim()\n .optional()\n .allow('false', 'true')\n .description('Flag to show if Javascript is enabled or not')\n\nexport const usePostcodeLookupSchema = Joi.string()\n .trim()\n .optional()\n .valid('', 'true')\n .description(\n 'Indicates whether a UK address component supports postcode lookup. Empty string or \"true\" values are accepted.'\n )\n\ntype GenericRuleOptions<K extends string, T> = Omit<GetRuleOptions, 'args'> & {\n args: Record<K, T>\n}\n\ninterface DSLSchema<TSchema = Record<string, unknown>[]>\n extends ArraySchema<TSchema> {\n rowSeparator: (rowSep: string | RegExp) => DSLSchema<TSchema>\n row: (rowSep: string | RegExp) => DSLSchema<TSchema>\n colSeparator: (colSep: string | RegExp) => DSLSchema<TSchema>\n col: (colSep: string | RegExp) => DSLSchema<TSchema>\n keys: (keys: string[]) => DSLSchema<TSchema>\n}\n\ninterface CustomValidator extends Joi.Root {\n dsv<TSchema>(): DSLSchema<TSchema>\n}\n\nexport const customValidator = Joi.extend((joi: Joi.Root) => {\n return {\n type: 'dsv',\n base: joi.array(),\n messages: {\n 'dsv.invalid': 'Invalid parse string'\n },\n coerce: {\n from: 'string',\n method(value: string, helpers) {\n try {\n // Only called when prefs.convert is true\n // Rules\n const rowSeparatorRule = helpers.schema.$_getRule('rowSeparator') as\n | undefined\n | GenericRuleOptions<'rowSeparator', string | RegExp>\n const colSeparatorRule = helpers.schema.$_getRule('colSeparator') as\n | undefined\n | GenericRuleOptions<'colSeparator', string | RegExp>\n const keysRule = helpers.schema.$_getRule('keys') as\n | undefined\n | GenericRuleOptions<'keys', string[]>\n\n // Rows\n const rowSeparator = rowSeparatorRule?.args.rowSeparator ?? /\\r?\\n/\n const rows = value\n .split(rowSeparator)\n .map((v) => v.trim())\n .filter(Boolean)\n\n // Columns\n const colSeparator = colSeparatorRule?.args.colSeparator ?? ','\n const keys = keysRule?.args.keys ?? ['key', 'value']\n\n const coercedValue = rows.map((row) => {\n return row\n .split(colSeparator)\n .reduce<Record<string, string>>((acc, col, idx) => {\n return {\n ...acc,\n [keys[idx]]: col.trim()\n }\n }, {})\n })\n return { value: coercedValue }\n } catch (_err) {\n // eslint-disable-next-line no-console\n console.error(_err)\n return { value, errors: [helpers.error('dsv.invalid')] }\n }\n }\n },\n rules: {\n rowSeparator: {\n convert: true,\n alias: 'row',\n method(rowSeparator: string) {\n return this.$_addRule({\n name: 'rowSeparator',\n args: { rowSeparator }\n })\n },\n args: [\n {\n name: 'rowSeparator',\n ref: true,\n assert: (value) =>\n typeof value === 'string' || value instanceof RegExp,\n message: 'must be a string or regex'\n }\n ]\n },\n colSeparator: {\n convert: true,\n alias: 'col',\n method(colSeparator: string) {\n return this.$_addRule({\n name: 'colSeparator',\n args: { colSeparator }\n })\n },\n args: [\n {\n name: 'colSeparator',\n ref: true,\n assert: (value) =>\n typeof value === 'string' || value instanceof RegExp,\n message: 'must be a string or regex'\n }\n ]\n },\n keys: {\n convert: true,\n method(keys: string[]) {\n return this.$_addRule({ name: 'keys', args: { keys } })\n },\n args: [\n {\n name: 'keys',\n ref: true,\n assert: (value) =>\n Array.isArray(value) && value.every((k) => typeof k === 'string'),\n message: 'must be an array of strings'\n }\n ]\n }\n }\n }\n}) as CustomValidator\n\nexport const autoCompleteOptionsSchema = customValidator\n .dsv<{ text: string; value: string }[]>()\n .row(/\\r?\\n/)\n .col(':')\n .keys(['text', 'value'])\n .items(\n customValidator.object({\n text: customValidator.string().min(1).disallow('').required(),\n value: customValidator\n .string()\n .default((parent: { text: string; value?: string }) => parent.text)\n .min(1)\n .disallow('')\n })\n )\n .min(1)\n .unique('text')\n .unique('value', { ignoreUndefined: true })\n .required()\n\nexport const questionDetailsFullSchema = {\n autoCompleteOptionsSchema,\n classesSchema,\n documentTypesSchema,\n enhancedActionSchema,\n exactFilesSchema,\n fileTypesSchema,\n hintTextSchema,\n imageTypesSchema,\n jsEnabledSchema,\n listForQuestionSchema,\n listItemCountSchema,\n listItemsDataSchema,\n maxFilesSchema,\n maxFutureSchema,\n maxLengthSchema,\n maxPastSchema,\n maxSchema,\n minFilesSchema,\n minLengthSchema,\n minSchema,\n nameSchema,\n precisionSchema,\n prefixSchema,\n questionOptionalSchema,\n questionSchema,\n questionTypeFullSchema,\n radioHintSchema,\n radioIdSchema,\n radioTextSchema,\n radioValueSchema,\n regexSchema,\n rowsSchema,\n shortDescriptionSchema,\n suffixSchema,\n tabularDataTypesSchema,\n usePostcodeLookupSchema\n}\n\nexport const formEditorInputPageKeys = {\n pageType: pageTypeSchema,\n questionType: questionTypeSchema\n}\n\n/**\n * Joi schema for `FormEditorInputPage` interface\n * @see {@link FormEditorInputPage}\n */\nexport const formEditorInputPageSchema = Joi.object<FormEditorInputPage>()\n .keys(formEditorInputPageKeys)\n .required()\n .description('Input schema for creating a new page in the form editor')\n\nexport const formEditorInputheckAnswersSettingsKeys = {\n declarationText: shortDescriptionSchema\n}\n\n/**\n * Joi schema for `FormEditorInputCheckAnswersSettings` interface\n * @see {@link FormEditorInputCheckAnswersSettings}\n */\nexport const formEditorInputCheckAnswersSettingSchema =\n Joi.object<FormEditorInputCheckAnswersSettings>()\n .keys(formEditorInputheckAnswersSettingsKeys)\n .required()\n .description('Configuration for the check-answers page')\n\nexport const formEditorInputQuestionKeys = {\n question: questionSchema,\n shortDescription: shortDescriptionSchema,\n hintText: hintTextSchema,\n questionOptional: questionOptionalSchema\n}\n\n/**\n * Joi schema for `FormEditorInputQuestion` interface\n * @see {@link FormEditorInputQuestion}\n */\nexport const formEditorInputQuestionSchema =\n Joi.object<FormEditorInputQuestion>()\n .keys(formEditorInputQuestionKeys)\n .required()\n .description(\n 'Input schema for creating or updating a question in the form editor'\n )\n\nexport const formEditorInputPageSettingsKeys = {\n pageHeadingAndGuidance: pageHeadingAndGuidanceSchema,\n pageHeading: pageHeadingSchema,\n guidanceText: guidanceTextSchema\n}\n\n/**\n * Joi schema for `FormEditorInputPageSettings` interface\n * @see {@link FormEditorInputPageSettings}\n */\nexport const formEditorInputPageSettingsSchema =\n Joi.object<FormEditorInputPageSettings>()\n .keys(formEditorInputPageSettingsKeys)\n .required()\n .description('Settings for page content and display in the form editor')\n\nexport function govukFieldValueIsString(\n govukField: GovukField\n): govukField is GovukStringField {\n return [\n 'question',\n 'hintText',\n 'shortDescription',\n 'autoCompleteOptions'\n ].includes(`${govukField.name}`)\n}\n\nexport function govukFieldIsChecked(\n govukField: GovukField\n): govukField is GovukFieldQuestionOptional | GovukFieldUsePostcodeLookup {\n if (\n govukField.name !== 'questionOptional' &&\n govukField.name !== 'usePostcodeLookup'\n ) {\n return false\n }\n const checkedValue = govukField.items?.[0].checked\n return typeof checkedValue === 'boolean'\n}\n\n// A list of allowed template funtions for use within error message templates\nexport const allowedErrorTemplateFunctions = ['lowerFirst', 'capitalise']\n"],"mappings":"AAAA,OAAOA,GAAG,MAAiD,KAAK;AAEhE,SAASC,aAAa;AACtB,SACEC,0BAA0B,EAC1BC,0BAA0B;AAa5B,WAAYC,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAMhC,OAAO,MAAMC,cAAc,GAAGL,GAAG,CAACM,MAAM,CAAC,CAAC,CACvCC,QAAQ,CAAC,CAAC,CACVC,KAAK,CAAC,UAAU,EAAE,UAAU,CAAC,CAC7BC,WAAW,CAAC,wDAAwD,CAAC;AAExE,OAAO,MAAMC,kBAAkB,GAAGV,GAAG,CAACM,MAAM,CAAC,CAAC,CAC3CC,QAAQ,CAAC,CAAC,CACVC,KAAK,CACJJ,oBAAoB,CAACO,qBAAqB,EAC1CP,oBAAoB,CAACQ,YAAY,EACjCX,aAAa,CAACY,cAAc,EAC5BZ,aAAa,CAACa,oBAAoB,EAClCb,aAAa,CAACc,eAAe,EAC7Bd,aAAa,CAACe,iBAAiB,EAC/BZ,oBAAoB,CAACa,YAAY,EACjChB,aAAa,CAACiB,UAAU,EACxBjB,aAAa,CAACkB,eAAe,EAC7BlB,aAAa,CAACmB,WAAW,EACzBnB,aAAa,CAACoB,iBAChB,CAAC,CACAZ,WAAW,CAAC,0DAA0D,CAAC;AAE1E,OAAO,MAAMa,sBAAsB,GAAGtB,GAAG,CAACM,MAAM,CAAC,CAAC,CAC/CC,QAAQ,CAAC,CAAC,CACVC,KAAK,CACJP,aAAa,CAACsB,SAAS,EACvBtB,aAAa,C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OAAO,MAAME,6BAA6B,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["Joi","ComponentType","MAX_NUMBER_OF_REPEAT_ITEMS","MIN_NUMBER_OF_REPEAT_ITEMS","QuestionTypeSubGroup","pageTypeSchema","string","required","valid","description","questionTypeSchema","WrittenAnswerSubGroup","DateSubGroup","UkAddressField","TelephoneNumberField","FileUploadField","EmailAddressField","ListSubGroup","YesNoField","CheckboxesField","RadiosField","AutocompleteField","questionTypeFullSchema","TextField","MultilineTextField","NumberField","DatePartsField","MonthYearField","SelectField","writtenAnswerSubSchema","dateSubSchema","listSubSchema","nameSchema","trim","questionSchema","hintTextSchema","optional","allow","questionOptionalSchema","listForQuestionSchema","listItemCountSchema","number","listItemsDataSchema","exactFilesSchema","empty","integer","min","max","minFilesSchema","maxFilesSchema","fileTypesSchema","array","items","single","default","documentTypesSchema","imageTypesSchema","tabularDataTypesSchema","enhancedActionSchema","radioIdSchema","radioTextSchema","radioHintSchema","radioValueSchema","shortDescriptionSchema","pageHeadingAndGuidanceSchema","pageHeadingSchema","guidanceTextSchema","exitPageSchema","boolean","repeaterSchema","minItemsSchema","maxItemsSchema","questionSetNameSchema","needDeclarationSchema","declarationTextSchema","minSchema","maxSchema","minLengthSchema","maxLengthSchema","maxFutureSchema","maxPastSchema","precisionSchema","prefixSchema","regexSchema","rowsSchema","suffixSchema","classesSchema","jsEnabledSchema","usePostcodeLookupSchema","customValidator","extend","joi","type","base","messages","coerce","from","method","value","helpers","rowSeparatorRule","schema","$_getRule","colSeparatorRule","keysRule","rowSeparator","args","rows","split","map","v","filter","Boolean","colSeparator","keys","coercedValue","row","reduce","acc","col","idx","_err","console","error","errors","rules","convert","alias","$_addRule","name","ref","assert","RegExp","message","Array","isArray","every","k","autoCompleteOptionsSchema","dsv","object","text","disallow","parent","unique","ignoreUndefined","questionDetailsFullSchema","formEditorInputPageKeys","pageType","questionType","formEditorInputPageSchema","formEditorInputheckAnswersSettingsKeys","declarationText","formEditorInputCheckAnswersSettingSchema","formEditorInputQuestionKeys","question","shortDescription","hintText","questionOptional","formEditorInputQuestionSchema","formEditorInputPageSettingsKeys","pageHeadingAndGuidance","pageHeading","guidanceText","formEditorInputPageSettingsSchema","govukFieldValueIsString","govukField","includes","govukFieldIsChecked","checkedValue","checked","allowedErrorTemplateFunctions"],"sources":["../../../../src/form/form-editor/index.ts"],"sourcesContent":["import Joi, { type ArraySchema, type GetRuleOptions } from 'joi'\n\nimport { ComponentType } from '~/src/components/enums.js'\nimport {\n MAX_NUMBER_OF_REPEAT_ITEMS,\n MIN_NUMBER_OF_REPEAT_ITEMS\n} from '~/src/form/form-definition/index.js'\nimport {\n type FormEditorInputCheckAnswersSettings,\n type FormEditorInputPage,\n type FormEditorInputPageSettings,\n type FormEditorInputQuestion,\n type GovukField,\n type GovukFieldQuestionOptional,\n type GovukFieldUsePostcodeLookup,\n type GovukStringField\n} from '~/src/form/form-editor/types.js'\n\nexport enum QuestionTypeSubGroup {\n WrittenAnswerSubGroup = 'writtenAnswerSub',\n DateSubGroup = 'dateSub',\n ListSubGroup = 'listSub'\n}\n\nexport const pageTypeSchema = Joi.string()\n .required()\n .valid('question', 'guidance')\n .description('Type of page - either a question page or guidance page')\n\nexport const questionTypeSchema = Joi.string()\n .required()\n .valid(\n QuestionTypeSubGroup.WrittenAnswerSubGroup,\n QuestionTypeSubGroup.DateSubGroup,\n ComponentType.UkAddressField,\n ComponentType.TelephoneNumberField,\n ComponentType.FileUploadField,\n ComponentType.EmailAddressField,\n QuestionTypeSubGroup.ListSubGroup,\n ComponentType.YesNoField,\n ComponentType.CheckboxesField,\n ComponentType.RadiosField,\n ComponentType.AutocompleteField\n )\n .description('The high-level type of question, including grouped types')\n\nexport const questionTypeFullSchema = Joi.string()\n .required()\n .valid(\n ComponentType.TextField,\n ComponentType.MultilineTextField,\n ComponentType.NumberField,\n ComponentType.DatePartsField,\n ComponentType.MonthYearField,\n ComponentType.UkAddressField,\n ComponentType.TelephoneNumberField,\n ComponentType.FileUploadField,\n ComponentType.EmailAddressField,\n ComponentType.YesNoField,\n ComponentType.CheckboxesField,\n ComponentType.RadiosField,\n ComponentType.AutocompleteField,\n ComponentType.SelectField\n )\n .description('The specific component type to use for this question')\n\nexport const writtenAnswerSubSchema = Joi.string()\n .required()\n .valid(\n ComponentType.TextField,\n ComponentType.MultilineTextField,\n ComponentType.NumberField\n )\n .description('Subtype for written answer questions')\n\nexport const dateSubSchema = Joi.string()\n .required()\n .valid(ComponentType.DatePartsField, ComponentType.MonthYearField)\nexport const listSubSchema = Joi.string()\n .required()\n .valid(\n ComponentType.YesNoField,\n ComponentType.CheckboxesField,\n ComponentType.RadiosField,\n ComponentType.AutocompleteField,\n ComponentType.SelectField\n )\n .description('Subtype for date-related questions')\n\nexport const nameSchema = Joi.string()\n .trim()\n .required()\n .description('Unique identifier for the field')\n\nexport const questionSchema = Joi.string()\n .trim()\n .required()\n .description('The question text displayed to the user')\n\nexport const hintTextSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Optional guidance text displayed below the question')\n\nexport const questionOptionalSchema = Joi.string()\n .trim()\n .optional()\n .valid('', 'true')\n .description(\n 'Indicates whether a question is optional. Empty string or \"true\" values are accepted.'\n )\n\nexport const listForQuestionSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Unique identifier for the list used by the field')\n\nexport const listItemCountSchema = Joi.number()\n .optional()\n .description('Number of list items in the list used by the field')\n\nexport const listItemsDataSchema = Joi.string()\n .allow('')\n .description('List items in JSON format, such as for radios or checkboxes.')\n\nexport const exactFilesSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .max(25)\n .description(\n 'Specifies the exact number of files required for upload. Must be between 1 and 25.'\n )\n\nexport const minFilesSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .max(25)\n .description(\n 'Minimum number of files required for upload. Must be between 1 and 25.'\n )\n\nexport const maxFilesSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .max(25)\n .description(\n 'Maximum number of files allowed for upload. Must be between 1 and 25.'\n )\n\nexport const fileTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\n .description(\n 'Array of allowed file types. Can be provided as a single value or an array.'\n )\n\nexport const documentTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\n .description(\n 'Array of allowed document types. Can be provided as a single value or an array.'\n )\n\nexport const imageTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\n .description(\n 'Array of allowed image types. Can be provided as a single value or an array.'\n )\n\nexport const tabularDataTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\n\nexport const enhancedActionSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Action field that can include enhanced functionality')\n\nexport const radioIdSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Unique identifier for radio options')\n\nexport const radioTextSchema = Joi.string()\n .trim()\n .required()\n .description('The visible text shown next to radio options')\n\nexport const radioHintSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description(\n 'Optional hint text displayed with radio buttons to provide additional guidance'\n )\n\nexport const radioValueSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description(\n 'Array of allowed tabular data types. Can be provided as a single value or an array.'\n )\n\nexport const shortDescriptionSchema = Joi.string()\n .trim()\n .required()\n .description('Brief description of the question for internal use')\n\nexport const pageHeadingAndGuidanceSchema = Joi.string()\n .trim()\n .optional()\n .description('Combined heading and guidance for the page')\n\nexport const pageHeadingSchema = Joi.string()\n .trim()\n .required()\n .description('Main heading displayed at the top of the page')\n\nexport const guidanceTextSchema = Joi.string()\n .trim()\n .description('Guidance text to assist users in completing the page')\n\nexport const exitPageSchema = Joi.boolean()\n .default(false)\n .optional()\n .description('Determines if page is set as an Exit Page')\n\nexport const repeaterSchema = Joi.string()\n .trim()\n .optional()\n .description(\n 'Combined min/max items and question set name for the repeater page'\n )\n\nexport const minItemsSchema = Joi.number()\n .empty('')\n .min(MIN_NUMBER_OF_REPEAT_ITEMS)\n .description('The minimum number of repeater items')\n\nexport const maxItemsSchema = Joi.number()\n .empty('')\n .max(MAX_NUMBER_OF_REPEAT_ITEMS)\n .description('The maximum number of repeater items')\n\nexport const questionSetNameSchema = Joi.string()\n .trim()\n .description('The repeater question set name')\n\nexport const needDeclarationSchema = Joi.string()\n .trim()\n .required()\n .description('Whether a declaration is needed')\n\nexport const declarationTextSchema = Joi.string()\n .trim()\n .required()\n .description('Text of the declaration that users must agree to')\n\nexport const minSchema = Joi.number()\n .empty('')\n .integer()\n .description('Minimum value for numeric inputs')\n\nexport const maxSchema = Joi.number()\n .empty('')\n .integer()\n .description('Maximum value for numeric inputs')\n\nexport const minLengthSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .description('Minimum character length for text inputs')\n\nexport const maxLengthSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .description('Maximum character length for text inputs')\n\nexport const maxFutureSchema = Joi.number()\n .empty('')\n .integer()\n .min(0)\n .description('Maximum days in the future allowed for date inputs')\n\nexport const maxPastSchema = Joi.number()\n .empty('')\n .integer()\n .min(0)\n .description('Maximum days in the past allowed for date inputs')\n\nexport const precisionSchema = Joi.number()\n .empty('')\n .integer()\n .min(0)\n .description('Decimal precision for numeric inputs')\n\nexport const prefixSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Text to display before the input (e.g., £)')\n\nexport const regexSchema = Joi.string()\n .optional()\n .allow('')\n .description('Regular expression pattern for validation')\n\nexport const rowsSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .description('Number of rows for multiline text fields')\n\nexport const suffixSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Text to display after the input (e.g., kg)')\n\nexport const classesSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Custom CSS classes to apply to the component')\n\nexport const jsEnabledSchema = Joi.string()\n .trim()\n .optional()\n .allow('false', 'true')\n .description('Flag to show if Javascript is enabled or not')\n\nexport const usePostcodeLookupSchema = Joi.string()\n .trim()\n .optional()\n .valid('', 'true')\n .description(\n 'Indicates whether a UK address component supports postcode lookup. Empty string or \"true\" values are accepted.'\n )\n\ntype GenericRuleOptions<K extends string, T> = Omit<GetRuleOptions, 'args'> & {\n args: Record<K, T>\n}\n\ninterface DSLSchema<TSchema = Record<string, unknown>[]>\n extends ArraySchema<TSchema> {\n rowSeparator: (rowSep: string | RegExp) => DSLSchema<TSchema>\n row: (rowSep: string | RegExp) => DSLSchema<TSchema>\n colSeparator: (colSep: string | RegExp) => DSLSchema<TSchema>\n col: (colSep: string | RegExp) => DSLSchema<TSchema>\n keys: (keys: string[]) => DSLSchema<TSchema>\n}\n\ninterface CustomValidator extends Joi.Root {\n dsv<TSchema>(): DSLSchema<TSchema>\n}\n\nexport const customValidator = Joi.extend((joi: Joi.Root) => {\n return {\n type: 'dsv',\n base: joi.array(),\n messages: {\n 'dsv.invalid': 'Invalid parse string'\n },\n coerce: {\n from: 'string',\n method(value: string, helpers) {\n try {\n // Only called when prefs.convert is true\n // Rules\n const rowSeparatorRule = helpers.schema.$_getRule('rowSeparator') as\n | undefined\n | GenericRuleOptions<'rowSeparator', string | RegExp>\n const colSeparatorRule = helpers.schema.$_getRule('colSeparator') as\n | undefined\n | GenericRuleOptions<'colSeparator', string | RegExp>\n const keysRule = helpers.schema.$_getRule('keys') as\n | undefined\n | GenericRuleOptions<'keys', string[]>\n\n // Rows\n const rowSeparator = rowSeparatorRule?.args.rowSeparator ?? /\\r?\\n/\n const rows = value\n .split(rowSeparator)\n .map((v) => v.trim())\n .filter(Boolean)\n\n // Columns\n const colSeparator = colSeparatorRule?.args.colSeparator ?? ','\n const keys = keysRule?.args.keys ?? ['key', 'value']\n\n const coercedValue = rows.map((row) => {\n return row\n .split(colSeparator)\n .reduce<Record<string, string>>((acc, col, idx) => {\n return {\n ...acc,\n [keys[idx]]: col.trim()\n }\n }, {})\n })\n return { value: coercedValue }\n } catch (_err) {\n // eslint-disable-next-line no-console\n console.error(_err)\n return { value, errors: [helpers.error('dsv.invalid')] }\n }\n }\n },\n rules: {\n rowSeparator: {\n convert: true,\n alias: 'row',\n method(rowSeparator: string) {\n return this.$_addRule({\n name: 'rowSeparator',\n args: { rowSeparator }\n })\n },\n args: [\n {\n name: 'rowSeparator',\n ref: true,\n assert: (value) =>\n typeof value === 'string' || value instanceof RegExp,\n message: 'must be a string or regex'\n }\n ]\n },\n colSeparator: {\n convert: true,\n alias: 'col',\n method(colSeparator: string) {\n return this.$_addRule({\n name: 'colSeparator',\n args: { colSeparator }\n })\n },\n args: [\n {\n name: 'colSeparator',\n ref: true,\n assert: (value) =>\n typeof value === 'string' || value instanceof RegExp,\n message: 'must be a string or regex'\n }\n ]\n },\n keys: {\n convert: true,\n method(keys: string[]) {\n return this.$_addRule({ name: 'keys', args: { keys } })\n },\n args: [\n {\n name: 'keys',\n ref: true,\n assert: (value) =>\n Array.isArray(value) && value.every((k) => typeof k === 'string'),\n message: 'must be an array of strings'\n }\n ]\n }\n }\n }\n}) as CustomValidator\n\nexport const autoCompleteOptionsSchema = customValidator\n .dsv<{ text: string; value: string }[]>()\n .row(/\\r?\\n/)\n .col(':')\n .keys(['text', 'value'])\n .items(\n customValidator.object({\n text: customValidator.string().min(1).disallow('').required(),\n value: customValidator\n .string()\n .default((parent: { text: string; value?: string }) => parent.text)\n .min(1)\n .disallow('')\n })\n )\n .min(1)\n .unique('text')\n .unique('value', { ignoreUndefined: true })\n .required()\n\nexport const questionDetailsFullSchema = {\n autoCompleteOptionsSchema,\n classesSchema,\n documentTypesSchema,\n enhancedActionSchema,\n exactFilesSchema,\n fileTypesSchema,\n hintTextSchema,\n imageTypesSchema,\n jsEnabledSchema,\n listForQuestionSchema,\n listItemCountSchema,\n listItemsDataSchema,\n maxFilesSchema,\n maxFutureSchema,\n maxLengthSchema,\n maxPastSchema,\n maxSchema,\n minFilesSchema,\n minLengthSchema,\n minSchema,\n nameSchema,\n precisionSchema,\n prefixSchema,\n questionOptionalSchema,\n questionSchema,\n questionTypeFullSchema,\n radioHintSchema,\n radioIdSchema,\n radioTextSchema,\n radioValueSchema,\n regexSchema,\n rowsSchema,\n shortDescriptionSchema,\n suffixSchema,\n tabularDataTypesSchema,\n usePostcodeLookupSchema\n}\n\nexport const formEditorInputPageKeys = {\n pageType: pageTypeSchema,\n questionType: questionTypeSchema\n}\n\n/**\n * Joi schema for `FormEditorInputPage` interface\n * @see {@link FormEditorInputPage}\n */\nexport const formEditorInputPageSchema = Joi.object<FormEditorInputPage>()\n .keys(formEditorInputPageKeys)\n .required()\n .description('Input schema for creating a new page in the form editor')\n\nexport const formEditorInputheckAnswersSettingsKeys = {\n declarationText: shortDescriptionSchema\n}\n\n/**\n * Joi schema for `FormEditorInputCheckAnswersSettings` interface\n * @see {@link FormEditorInputCheckAnswersSettings}\n */\nexport const formEditorInputCheckAnswersSettingSchema =\n Joi.object<FormEditorInputCheckAnswersSettings>()\n .keys(formEditorInputheckAnswersSettingsKeys)\n .required()\n .description('Configuration for the check-answers page')\n\nexport const formEditorInputQuestionKeys = {\n question: questionSchema,\n shortDescription: shortDescriptionSchema,\n hintText: hintTextSchema,\n questionOptional: questionOptionalSchema\n}\n\n/**\n * Joi schema for `FormEditorInputQuestion` interface\n * @see {@link FormEditorInputQuestion}\n */\nexport const formEditorInputQuestionSchema =\n Joi.object<FormEditorInputQuestion>()\n .keys(formEditorInputQuestionKeys)\n .required()\n .description(\n 'Input schema for creating or updating a question in the form editor'\n )\n\nexport const formEditorInputPageSettingsKeys = {\n pageHeadingAndGuidance: pageHeadingAndGuidanceSchema,\n pageHeading: pageHeadingSchema,\n guidanceText: guidanceTextSchema\n}\n\n/**\n * Joi schema for `FormEditorInputPageSettings` interface\n * @see {@link FormEditorInputPageSettings}\n */\nexport const formEditorInputPageSettingsSchema =\n Joi.object<FormEditorInputPageSettings>()\n .keys(formEditorInputPageSettingsKeys)\n .required()\n .description('Settings for page content and display in the form editor')\n\nexport function govukFieldValueIsString(\n govukField: GovukField\n): govukField is GovukStringField {\n return [\n 'question',\n 'hintText',\n 'shortDescription',\n 'autoCompleteOptions',\n 'classes',\n 'prefix',\n 'suffix'\n ].includes(`${govukField.name}`)\n}\n\nexport function govukFieldIsChecked(\n govukField: GovukField\n): govukField is GovukFieldQuestionOptional | GovukFieldUsePostcodeLookup {\n if (\n govukField.name !== 'questionOptional' &&\n govukField.name !== 'usePostcodeLookup'\n ) {\n return false\n }\n const checkedValue = govukField.items?.[0].checked\n return typeof checkedValue === 'boolean'\n}\n\n// A list of allowed template funtions for use within error message templates\nexport const allowedErrorTemplateFunctions = ['lowerFirst', 'capitalise']\n"],"mappings":"AAAA,OAAOA,GAAG,MAAiD,KAAK;AAEhE,SAASC,aAAa;AACtB,SACEC,0BAA0B,EAC1BC,0BAA0B;AAa5B,WAAYC,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAMhC,OAAO,MAAMC,cAAc,GAAGL,GAAG,CAACM,MAAM,CAAC,CAAC,CACvCC,QAAQ,CAAC,CAAC,CACVC,KAAK,CAAC,UAAU,EAAE,UAAU,CAAC,CAC7BC,WAAW,CAAC,wDAAwD,CAAC;AAExE,OAAO,MAAMC,kBAAkB,GAAGV,GAAG,CAACM,MAAM,CAAC,CAAC,CAC3CC,QAAQ,CAAC,CAAC,CACVC,KAAK,CACJJ,oBAAoB,CAACO,qBAAqB,EAC1CP,oBAAoB,CAACQ,YAAY,EACjCX,aAAa,CAACY,cAAc,EAC5BZ,aAAa,CAACa,oBAAoB,EAClCb,aAAa,CAACc,eAAe,EAC7Bd,aAAa,CAACe,iBAAiB,EAC/BZ,oBAAoB,CAACa,YAAY,EACjChB,aAAa,CAACiB,UAAU,EACxBjB,aAAa,CAACkB,eAAe,EAC7BlB,aAAa,CAACmB,WAAW,EACzBnB,aAAa,CAACoB,iBAChB,CAAC,CACA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,kBAAkB,IACtCqC,UAAU,CAACrC,IAAI,KAAK,mBAAmB,EACvC;IACA,OAAO,KAAK;EACd;EACA,MAAMwC,YAAY,GAAGH,UAAU,CAAClH,KAAK,GAAG,CAAC,CAAC,CAACsH,OAAO;EAClD,OAAO,OAAOD,YAAY,KAAK,SAAS;AAC1C;;AAEA;AACA,OAAO,MAAME,6BAA6B,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/form/form-editor/macros/types.ts"],"sourcesContent":["import { type ComponentType } from '~/src/components/enums.js'\nimport {\n type DefaultComponent,\n type GovukFieldset\n} from '~/src/form/form-editor/preview/types.js'\nimport {\n type DateItem,\n type GovukField,\n type ListItemReadonly\n} from '~/src/form/form-editor/types.js'\n\nexport interface AppPreviewErrorPanelMacroErrorTemplate {\n advancedSettingsErrors: []\n baseErrors: { template: unknown; type: string }[]\n}\n\nexport interface AppPreviewErrorPanelMacro {\n errorTemplates: AppPreviewErrorPanelMacroErrorTemplate\n fieldDetails: {\n extraFields: GovukField[]\n basePageFields: GovukField[]\n }\n questionType: ComponentType\n}\n\nexport interface AppPreviewPanelTabsMacro {\n questionType: ComponentType\n previewPageUrl: string\n previewErrorsUrl: string\n errorTemplates: AppPreviewErrorPanelMacroErrorTemplate\n extraFields: GovukField[]\n basePageFields: GovukField[]\n}\n\nexport interface SelectAfterInput {\n afterInput: { html: string }\n}\nexport interface RadioAndCheckboxAfterInputs {\n afterInputs: { html: string }\n}\n\n// GDS components - Select uses afterInput, while Radio uses afterInputs\nexport type FormGroupAfterInput = SelectAfterInput | RadioAndCheckboxAfterInputs\n\nexport interface QuestionBaseModel {\n id?: string\n name?: string\n content?: string\n attributes?: Record<string, string>\n label?: DefaultComponent\n hint?: DefaultComponent\n fieldset?: GovukFieldset\n readonly items?: ListItemReadonly[] | DateItem[]\n text?: string\n formGroup?: FormGroupAfterInput\n type?: 'text' | 'number' | 'boolean'\n classes?: string\n}\n\nexport interface AppPreviewPanelMacro extends AppPreviewPanelTabsMacro {\n model: QuestionBaseModel\n}\n\nexport interface PagePreviewComponent {\n model: QuestionBaseModel\n questionType: ComponentType\n}\n\nexport interface PagePreviewPanelMacro {\n readonly pageTitle: {\n text: string\n classes: string\n }\n readonly guidance: {\n text: string\n classes: string\n }\n readonly components: PagePreviewComponent[]\n readonly sectionTitle?: {\n text: string\n classes: string\n }\n readonly repeaterButton?: {\n text: string\n classes: string\n }\n}\n\nexport interface SummaryRowActionItem {\n href: string\n text: string\n visuallyHiddenText: string\n}\n\nexport interface SummaryRow {\n key: { text: string }\n value: { text: string }\n actions: {\n items: SummaryRowActionItem[]\n }\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/form/form-editor/macros/types.ts"],"sourcesContent":["import { type ComponentType } from '~/src/components/enums.js'\nimport {\n type DefaultComponent,\n type GovukFieldset\n} from '~/src/form/form-editor/preview/types.js'\nimport {\n type DateItem,\n type GovukField,\n type ListItemReadonly\n} from '~/src/form/form-editor/types.js'\n\nexport interface AppPreviewErrorPanelMacroErrorTemplate {\n advancedSettingsErrors: []\n baseErrors: { template: unknown; type: string }[]\n}\n\nexport interface AppPreviewErrorPanelMacro {\n errorTemplates: AppPreviewErrorPanelMacroErrorTemplate\n fieldDetails: {\n extraFields: GovukField[]\n basePageFields: GovukField[]\n }\n questionType: ComponentType\n}\n\nexport interface AppPreviewPanelTabsMacro {\n questionType: ComponentType\n previewPageUrl: string\n previewErrorsUrl: string\n errorTemplates: AppPreviewErrorPanelMacroErrorTemplate\n extraFields: GovukField[]\n basePageFields: GovukField[]\n}\n\nexport interface SelectAfterInput {\n afterInput: { html: string }\n}\nexport interface RadioAndCheckboxAfterInputs {\n afterInputs: { html: string }\n}\n\n// GDS components - Select uses afterInput, while Radio uses afterInputs\nexport type FormGroupAfterInput = SelectAfterInput | RadioAndCheckboxAfterInputs\n\nexport interface QuestionBaseModel {\n id?: string\n name?: string\n content?: string\n attributes?: Record<string, string>\n label?: DefaultComponent\n hint?: DefaultComponent\n fieldset?: GovukFieldset\n readonly items?: ListItemReadonly[] | DateItem[]\n text?: string\n formGroup?: FormGroupAfterInput\n type?: 'text' | 'number' | 'boolean'\n classes?: string\n previewClasses?: string\n prefix?: { text: string }\n suffix?: { text: string }\n}\n\nexport interface AppPreviewPanelMacro extends AppPreviewPanelTabsMacro {\n model: QuestionBaseModel\n}\n\nexport interface PagePreviewComponent {\n model: QuestionBaseModel\n questionType: ComponentType\n}\n\nexport interface PagePreviewPanelMacro {\n readonly pageTitle: {\n text: string\n classes: string\n }\n readonly guidance: {\n text: string\n classes: string\n }\n readonly components: PagePreviewComponent[]\n readonly sectionTitle?: {\n text: string\n classes: string\n }\n readonly repeaterButton?: {\n text: string\n classes: string\n }\n}\n\nexport interface SummaryRowActionItem {\n href: string\n text: string\n visuallyHiddenText: string\n}\n\nexport interface SummaryRow {\n key: { text: string }\n value: { text: string }\n actions: {\n items: SummaryRowActionItem[]\n }\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-elements.js","names":["ComponentElements","_component","constructor","component","_getValues","required","options","question","title","hintText","optional","shortDesc","items","content","values","setPreviewDOM","_element","Error","setPreviewHTML","_value"],"sources":["../../../../../src/form/form-editor/preview/component-elements.js"],"sourcesContent":["/**\n * @implements {QuestionElements}\n */\nexport class ComponentElements {\n /**\n * @type {ComponentDef}\n * @protected\n */\n _component\n /**\n * @param {ComponentDef} component\n */\n constructor(component) {\n this._component = component\n }\n\n /**\n * @protected\n * @returns {BaseSettings}\n */\n _getValues() {\n const required = this._component.options?.required ?? true\n\n return {\n question: this._component.title,\n hintText: '',\n optional: !required,\n shortDesc: '',\n items: [],\n content: ''\n }\n }\n\n /**\n * @returns {BaseSettings}\n */\n get values() {\n const values = this._getValues()\n return values\n }\n\n /**\n * @param {HTMLElement} _element\n */\n setPreviewDOM(_element) {\n throw new Error('Not implemented')\n }\n\n /**\n * @param {string} _value\n */\n setPreviewHTML(_value) {\n throw new Error('Not implemented')\n }\n}\n\n/**\n * @import { ListenerRow, BaseSettings, QuestionElements, QuestionBaseModel, GovukFieldset, DefaultComponent, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { FormComponentsDef, ContentComponentsDef, ComponentDef } from '~/src/components/types.js'\n * @import { ListElement, ListItemReadonly } from '~/src/form/form-editor/types.js'\n */\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,MAAMA,iBAAiB,CAAC;EAC7B;AACF;AACA;AACA;EACEC,UAAU;EACV;AACF;AACA;EACEC,WAAWA,CAACC,SAAS,EAAE;IACrB,IAAI,CAACF,UAAU,GAAGE,SAAS;EAC7B;;EAEA;AACF;AACA;AACA;EACEC,UAAUA,CAAA,EAAG;IACX,MAAMC,QAAQ,GAAG,IAAI,CAACJ,UAAU,CAACK,OAAO,EAAED,QAAQ,IAAI,IAAI;IAE1D,OAAO;MACLE,QAAQ,EAAE,IAAI,CAACN,UAAU,CAACO,KAAK;MAC/BC,QAAQ,EAAE,EAAE;MACZC,QAAQ,EAAE,CAACL,QAAQ;MACnBM,SAAS,EAAE,EAAE;MACbC,KAAK,EAAE,EAAE;MACTC,OAAO,EAAE;IACX,CAAC;EACH;;EAEA;AACF;AACA;EACE,IAAIC,MAAMA,CAAA,EAAG;IACX,MAAMA,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"component-elements.js","names":["ComponentElements","_component","constructor","component","_getValues","required","options","question","title","hintText","optional","shortDesc","userClasses","classes","items","content","values","setPreviewDOM","_element","Error","setPreviewHTML","_value"],"sources":["../../../../../src/form/form-editor/preview/component-elements.js"],"sourcesContent":["/**\n * @implements {QuestionElements}\n */\nexport class ComponentElements {\n /**\n * @type {ComponentDef}\n * @protected\n */\n _component\n /**\n * @param {ComponentDef} component\n */\n constructor(component) {\n this._component = component\n }\n\n /**\n * @protected\n * @returns {BaseSettings}\n */\n _getValues() {\n const required = this._component.options?.required ?? true\n\n return {\n question: this._component.title,\n hintText: '',\n optional: !required,\n shortDesc: '',\n userClasses:\n this._component.options && 'classes' in this._component.options\n ? (this._component.options.classes ?? '')\n : '',\n items: [],\n content: ''\n }\n }\n\n /**\n * @returns {BaseSettings}\n */\n get values() {\n const values = this._getValues()\n return values\n }\n\n /**\n * @param {HTMLElement} _element\n */\n setPreviewDOM(_element) {\n throw new Error('Not implemented')\n }\n\n /**\n * @param {string} _value\n */\n setPreviewHTML(_value) {\n throw new Error('Not implemented')\n }\n}\n\n/**\n * @import { ListenerRow, BaseSettings, QuestionElements, QuestionBaseModel, GovukFieldset, DefaultComponent, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { FormComponentsDef, ContentComponentsDef, ComponentDef } from '~/src/components/types.js'\n * @import { ListElement, ListItemReadonly } from '~/src/form/form-editor/types.js'\n */\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,MAAMA,iBAAiB,CAAC;EAC7B;AACF;AACA;AACA;EACEC,UAAU;EACV;AACF;AACA;EACEC,WAAWA,CAACC,SAAS,EAAE;IACrB,IAAI,CAACF,UAAU,GAAGE,SAAS;EAC7B;;EAEA;AACF;AACA;AACA;EACEC,UAAUA,CAAA,EAAG;IACX,MAAMC,QAAQ,GAAG,IAAI,CAACJ,UAAU,CAACK,OAAO,EAAED,QAAQ,IAAI,IAAI;IAE1D,OAAO;MACLE,QAAQ,EAAE,IAAI,CAACN,UAAU,CAACO,KAAK;MAC/BC,QAAQ,EAAE,EAAE;MACZC,QAAQ,EAAE,CAACL,QAAQ;MACnBM,SAAS,EAAE,EAAE;MACbC,WAAW,EACT,IAAI,CAACX,UAAU,CAACK,OAAO,IAAI,SAAS,IAAI,IAAI,CAACL,UAAU,CAACK,OAAO,GAC1D,IAAI,CAACL,UAAU,CAACK,OAAO,CAACO,OAAO,IAAI,EAAE,GACtC,EAAE;MACRC,KAAK,EAAE,EAAE;MACTC,OAAO,EAAE;IACX,CAAC;EACH;;EAEA;AACF;AACA;EACE,IAAIC,MAAMA,CAAA,EAAG;IACX,MAAMA,MAAM,GAAG,IAAI,CAACZ,UAAU,CAAC,CAAC;IAChC,OAAOY,MAAM;EACf;;EAEA;AACF;AACA;EACEC,aAAaA,CAACC,QAAQ,EAAE;IACtB,MAAM,IAAIC,KAAK,CAAC,iBAAiB,CAAC;EACpC;;EAEA;AACF;AACA;EACEC,cAAcA,CAACC,MAAM,EAAE;IACrB,MAAM,IAAIF,KAAK,CAAC,iBAAiB,CAAC;EACpC;AACF;;AAEA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -10,7 +10,7 @@ import { ListComponentElements, ListQuestion, SelectComponentElements } from "./
|
|
|
10
10
|
import { LongAnswerQuestion } from "./long-answer.js";
|
|
11
11
|
import { Markdown } from "./markdown.js";
|
|
12
12
|
import { MonthYearQuestion } from "./month-year.js";
|
|
13
|
-
import { NumberOnlyQuestion } from "./number-only.js";
|
|
13
|
+
import { NumberComponentPreviewElements, NumberOnlyQuestion } from "./number-only.js";
|
|
14
14
|
import { PhoneNumberQuestion } from "./phone-number.js";
|
|
15
15
|
import { QuestionComponentElements } from "./question.js";
|
|
16
16
|
import { RadioQuestion } from "./radio.js";
|
|
@@ -61,6 +61,8 @@ export function mapComponentToPreviewQuestion(questionRenderer, definition) {
|
|
|
61
61
|
questionElements = new SelectComponentElements(component, list);
|
|
62
62
|
} else if (component.type === ComponentType.UkAddressField) {
|
|
63
63
|
questionElements = new UkAddressComponentPreviewElements(component);
|
|
64
|
+
} else if (component.type === ComponentType.NumberField) {
|
|
65
|
+
questionElements = new NumberComponentPreviewElements(component);
|
|
64
66
|
} else if (hasSelectionFields(component) && hasListField(component)) {
|
|
65
67
|
const list = findDefinitionListFromComponent(component, definition);
|
|
66
68
|
questionElements = new ListComponentElements(component, list);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","names":["ComponentType","hasContentField","hasInputField","hasListField","hasSelectionFields","AutocompleteListQuestion","CheckboxQuestion","ComponentElements","ContentElements","DateInputQuestion","EmailAddressQuestion","ListComponentElements","ListQuestion","SelectComponentElements","LongAnswerQuestion","Markdown","MonthYearQuestion","NumberOnlyQuestion","PhoneNumberQuestion","QuestionComponentElements","RadioQuestion","SelectQuestion","ShortAnswerQuestion","SupportingEvidenceQuestion","UkAddressComponentPreviewElements","UkAddressQuestion","YesNoQuestion","findDefinitionListFromComponent","InputFieldComponentDictionary","TextField","Details","InsetText","Html","List","EmailAddressField","NumberField","MultilineTextField","TelephoneNumberField","MonthYearField","DatePartsField","UkAddressField","AutocompleteField","RadiosField","CheckboxesField","SelectField","YesNoField","FileUploadField","mapComponentToPreviewQuestion","questionRenderer","definition","component","questionElements","type","list","QuestionConstructor","previewComponent","id"],"sources":["../../../../../src/form/form-editor/preview/helpers.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport {\n hasContentField,\n hasInputField,\n hasListField,\n hasSelectionFields\n} from '~/src/components/helpers.js'\nimport { AutocompleteListQuestion } from '~/src/form/form-editor/preview/autocomplete.js'\nimport { CheckboxQuestion } from '~/src/form/form-editor/preview/checkbox.js'\nimport { ComponentElements } from '~/src/form/form-editor/preview/component-elements.js'\nimport { ContentElements } from '~/src/form/form-editor/preview/content.js'\nimport { DateInputQuestion } from '~/src/form/form-editor/preview/date-input.js'\nimport { EmailAddressQuestion } from '~/src/form/form-editor/preview/email-address.js'\nimport {\n ListComponentElements,\n ListQuestion,\n SelectComponentElements\n} from '~/src/form/form-editor/preview/list.js'\nimport { LongAnswerQuestion } from '~/src/form/form-editor/preview/long-answer.js'\nimport { Markdown } from '~/src/form/form-editor/preview/markdown.js'\nimport { MonthYearQuestion } from '~/src/form/form-editor/preview/month-year.js'\nimport {
|
|
1
|
+
{"version":3,"file":"helpers.js","names":["ComponentType","hasContentField","hasInputField","hasListField","hasSelectionFields","AutocompleteListQuestion","CheckboxQuestion","ComponentElements","ContentElements","DateInputQuestion","EmailAddressQuestion","ListComponentElements","ListQuestion","SelectComponentElements","LongAnswerQuestion","Markdown","MonthYearQuestion","NumberComponentPreviewElements","NumberOnlyQuestion","PhoneNumberQuestion","QuestionComponentElements","RadioQuestion","SelectQuestion","ShortAnswerQuestion","SupportingEvidenceQuestion","UkAddressComponentPreviewElements","UkAddressQuestion","YesNoQuestion","findDefinitionListFromComponent","InputFieldComponentDictionary","TextField","Details","InsetText","Html","List","EmailAddressField","NumberField","MultilineTextField","TelephoneNumberField","MonthYearField","DatePartsField","UkAddressField","AutocompleteField","RadiosField","CheckboxesField","SelectField","YesNoField","FileUploadField","mapComponentToPreviewQuestion","questionRenderer","definition","component","questionElements","type","list","QuestionConstructor","previewComponent","id"],"sources":["../../../../../src/form/form-editor/preview/helpers.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport {\n hasContentField,\n hasInputField,\n hasListField,\n hasSelectionFields\n} from '~/src/components/helpers.js'\nimport { AutocompleteListQuestion } from '~/src/form/form-editor/preview/autocomplete.js'\nimport { CheckboxQuestion } from '~/src/form/form-editor/preview/checkbox.js'\nimport { ComponentElements } from '~/src/form/form-editor/preview/component-elements.js'\nimport { ContentElements } from '~/src/form/form-editor/preview/content.js'\nimport { DateInputQuestion } from '~/src/form/form-editor/preview/date-input.js'\nimport { EmailAddressQuestion } from '~/src/form/form-editor/preview/email-address.js'\nimport {\n ListComponentElements,\n ListQuestion,\n SelectComponentElements\n} from '~/src/form/form-editor/preview/list.js'\nimport { LongAnswerQuestion } from '~/src/form/form-editor/preview/long-answer.js'\nimport { Markdown } from '~/src/form/form-editor/preview/markdown.js'\nimport { MonthYearQuestion } from '~/src/form/form-editor/preview/month-year.js'\nimport {\n NumberComponentPreviewElements,\n NumberOnlyQuestion\n} from '~/src/form/form-editor/preview/number-only.js'\nimport { PhoneNumberQuestion } from '~/src/form/form-editor/preview/phone-number.js'\nimport { QuestionComponentElements } from '~/src/form/form-editor/preview/question.js'\nimport { RadioQuestion } from '~/src/form/form-editor/preview/radio.js'\nimport { SelectQuestion } from '~/src/form/form-editor/preview/select.js'\nimport { ShortAnswerQuestion } from '~/src/form/form-editor/preview/short-answer.js'\nimport { SupportingEvidenceQuestion } from '~/src/form/form-editor/preview/supporting-evidence.js'\nimport {\n UkAddressComponentPreviewElements,\n UkAddressQuestion\n} from '~/src/form/form-editor/preview/uk-address.js'\nimport { YesNoQuestion } from '~/src/form/form-editor/preview/yes-no.js'\nimport { findDefinitionListFromComponent } from '~/src/form/utils/list.js'\n/**\n * @type {Record<ComponentType, typeof PreviewComponent>}\n */\nconst InputFieldComponentDictionary = {\n [ComponentType.TextField]: ShortAnswerQuestion,\n [ComponentType.Details]: ShortAnswerQuestion,\n [ComponentType.InsetText]: ShortAnswerQuestion,\n [ComponentType.Html]: ShortAnswerQuestion,\n [ComponentType.Markdown]: Markdown,\n [ComponentType.List]: ListQuestion,\n [ComponentType.EmailAddressField]: EmailAddressQuestion,\n [ComponentType.NumberField]: NumberOnlyQuestion,\n [ComponentType.MultilineTextField]: LongAnswerQuestion,\n [ComponentType.TelephoneNumberField]: PhoneNumberQuestion,\n [ComponentType.MonthYearField]: MonthYearQuestion,\n [ComponentType.DatePartsField]: DateInputQuestion,\n [ComponentType.UkAddressField]: UkAddressQuestion,\n [ComponentType.AutocompleteField]: AutocompleteListQuestion,\n [ComponentType.RadiosField]: RadioQuestion,\n [ComponentType.CheckboxesField]: CheckboxQuestion,\n [ComponentType.SelectField]: SelectQuestion,\n [ComponentType.YesNoField]: YesNoQuestion,\n [ComponentType.FileUploadField]: SupportingEvidenceQuestion\n}\n\n/**\n * @param {QuestionRenderer} questionRenderer\n * @param {FormDefinition} definition\n * @returns {(component: ComponentDef) => Question}\n */\nexport function mapComponentToPreviewQuestion(questionRenderer, definition) {\n return /** @type {(component: ComponentDef) => Question} */ (\n (component) => {\n /**\n * @type {QuestionElements}\n */\n let questionElements\n\n if (\n component.type === ComponentType.AutocompleteField ||\n component.type === ComponentType.SelectField\n ) {\n const list = findDefinitionListFromComponent(component, definition)\n questionElements = new SelectComponentElements(component, list)\n } else if (component.type === ComponentType.UkAddressField) {\n questionElements = new UkAddressComponentPreviewElements(component)\n } else if (component.type === ComponentType.NumberField) {\n questionElements = new NumberComponentPreviewElements(component)\n } else if (hasSelectionFields(component) && hasListField(component)) {\n const list = findDefinitionListFromComponent(component, definition)\n questionElements = new ListComponentElements(component, list)\n } else if (\n hasInputField(component) ||\n component.type === ComponentType.YesNoField\n ) {\n questionElements = new QuestionComponentElements(component)\n } else if (hasContentField(component)) {\n questionElements = new ContentElements(component)\n } else {\n questionElements = new ComponentElements(component)\n }\n\n const QuestionConstructor = InputFieldComponentDictionary[component.type]\n\n const previewComponent = new QuestionConstructor(\n questionElements,\n questionRenderer\n )\n previewComponent.id = component.id\n return previewComponent\n }\n )\n}\n\n/**\n * @import { QuestionElements, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { Question } from '~/src/form/form-editor/preview/question.js'\n * @import { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n * @import { FormDefinition } from '~/src/form/form-definition/types.js'\n * @import { ComponentDef } from '~/src/components/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SACEC,eAAe,EACfC,aAAa,EACbC,YAAY,EACZC,kBAAkB;AAEpB,SAASC,wBAAwB;AACjC,SAASC,gBAAgB;AACzB,SAASC,iBAAiB;AAC1B,SAASC,eAAe;AACxB,SAASC,iBAAiB;AAC1B,SAASC,oBAAoB;AAC7B,SACEC,qBAAqB,EACrBC,YAAY,EACZC,uBAAuB;AAEzB,SAASC,kBAAkB;AAC3B,SAASC,QAAQ;AACjB,SAASC,iBAAiB;AAC1B,SACEC,8BAA8B,EAC9BC,kBAAkB;AAEpB,SAASC,mBAAmB;AAC5B,SAASC,yBAAyB;AAClC,SAASC,aAAa;AACtB,SAASC,cAAc;AACvB,SAASC,mBAAmB;AAC5B,SAASC,0BAA0B;AACnC,SACEC,iCAAiC,EACjC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