@defra/forms-model 3.0.481 → 3.0.482
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-definition/index.js +0 -1
- package/dist/module/form/form-definition/index.js.map +1 -1
- package/dist/module/form/form-editor/__stubs__/preview.js +83 -4
- package/dist/module/form/form-editor/__stubs__/preview.js.map +1 -1
- package/dist/module/form/form-editor/index.js +2 -2
- package/dist/module/form/form-editor/index.js.map +1 -1
- package/dist/module/form/form-editor/macros/types.js +2 -0
- package/dist/module/form/form-editor/macros/types.js.map +1 -0
- package/dist/module/form/form-editor/preview/autocomplete.js +20 -4
- package/dist/module/form/form-editor/preview/autocomplete.js.map +1 -1
- package/dist/module/form/form-editor/preview/checkbox-sortable.js +7 -2
- package/dist/module/form/form-editor/preview/checkbox-sortable.js.map +1 -1
- package/dist/module/form/form-editor/preview/checkbox.js +17 -0
- package/dist/module/form/form-editor/preview/checkbox.js.map +1 -0
- package/dist/module/form/form-editor/preview/component-elements.js +61 -0
- package/dist/module/form/form-editor/preview/component-elements.js.map +1 -0
- package/dist/module/form/form-editor/preview/constants.js +2 -0
- package/dist/module/form/form-editor/preview/constants.js.map +1 -0
- package/dist/module/form/form-editor/preview/content.js +94 -0
- package/dist/module/form/form-editor/preview/content.js.map +1 -0
- package/dist/module/form/form-editor/preview/controller/page-controller.js +260 -0
- package/dist/module/form/form-editor/preview/controller/page-controller.js.map +1 -0
- package/dist/module/form/form-editor/preview/date-input.js +7 -2
- package/dist/module/form/form-editor/preview/date-input.js.map +1 -1
- package/dist/module/form/form-editor/preview/email-address.js +7 -1
- package/dist/module/form/form-editor/preview/email-address.js.map +1 -1
- package/dist/module/form/form-editor/preview/fieldset-question.js +5 -0
- package/dist/module/form/form-editor/preview/fieldset-question.js.map +1 -1
- package/dist/module/form/form-editor/preview/helpers.js +81 -0
- package/dist/module/form/form-editor/preview/helpers.js.map +1 -0
- package/dist/module/form/form-editor/preview/index.js +6 -0
- package/dist/module/form/form-editor/preview/index.js.map +1 -1
- package/dist/module/form/form-editor/preview/list.js +59 -3
- package/dist/module/form/form-editor/preview/list.js.map +1 -1
- package/dist/module/form/form-editor/preview/long-answer.js +7 -1
- package/dist/module/form/form-editor/preview/long-answer.js.map +1 -1
- package/dist/module/form/form-editor/preview/markdown.js +53 -0
- package/dist/module/form/form-editor/preview/markdown.js.map +1 -0
- package/dist/module/form/form-editor/preview/month-year.js +7 -2
- package/dist/module/form/form-editor/preview/month-year.js.map +1 -1
- package/dist/module/form/form-editor/preview/number-only.js +5 -0
- package/dist/module/form/form-editor/preview/number-only.js.map +1 -1
- package/dist/module/form/form-editor/preview/phone-number.js +7 -1
- package/dist/module/form/form-editor/preview/phone-number.js.map +1 -1
- package/dist/module/form/form-editor/preview/preview.js +212 -0
- package/dist/module/form/form-editor/preview/preview.js.map +1 -0
- package/dist/module/form/form-editor/preview/question.js +48 -138
- package/dist/module/form/form-editor/preview/question.js.map +1 -1
- package/dist/module/form/form-editor/preview/radio-sortable.js +7 -2
- package/dist/module/form/form-editor/preview/radio-sortable.js.map +1 -1
- package/dist/module/form/form-editor/preview/radio.js +7 -2
- package/dist/module/form/form-editor/preview/radio.js.map +1 -1
- package/dist/module/form/form-editor/preview/select-sortable.js +38 -0
- package/dist/module/form/form-editor/preview/select-sortable.js.map +1 -0
- package/dist/module/form/form-editor/preview/select.js +11 -0
- package/dist/module/form/form-editor/preview/select.js.map +1 -0
- package/dist/module/form/form-editor/preview/short-answer.js +7 -1
- package/dist/module/form/form-editor/preview/short-answer.js.map +1 -1
- package/dist/module/form/form-editor/preview/supporting-evidence.js +7 -1
- package/dist/module/form/form-editor/preview/supporting-evidence.js.map +1 -1
- package/dist/module/form/form-editor/preview/types.js.map +1 -1
- package/dist/module/form/form-editor/preview/uk-address.js +7 -2
- package/dist/module/form/form-editor/preview/uk-address.js.map +1 -1
- package/dist/module/form/form-editor/preview/yes-no.js +7 -2
- package/dist/module/form/form-editor/preview/yes-no.js.map +1 -1
- package/dist/module/form/form-editor/types.js.map +1 -1
- package/dist/module/form/form-metadata/index.js +1 -5
- package/dist/module/form/form-metadata/index.js.map +1 -1
- package/dist/module/form/utils/index.js +1 -0
- package/dist/module/form/utils/index.js.map +1 -1
- package/dist/module/form/utils/list.js +15 -0
- package/dist/module/form/utils/list.js.map +1 -0
- package/dist/module/index.js.map +1 -1
- package/dist/module/stubs.js +1 -0
- package/dist/module/stubs.js.map +1 -1
- package/dist/types/form/form-definition/index.d.ts.map +1 -1
- package/dist/types/form/form-editor/__stubs__/preview.d.ts +58 -11
- 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 +62 -0
- package/dist/types/form/form-editor/macros/types.d.ts.map +1 -0
- package/dist/types/form/form-editor/preview/autocomplete.d.ts +3 -1
- package/dist/types/form/form-editor/preview/autocomplete.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/checkbox-sortable.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/checkbox.d.ts +4 -0
- package/dist/types/form/form-editor/preview/checkbox.d.ts.map +1 -0
- package/dist/types/form/form-editor/preview/component-elements.d.ts +35 -0
- package/dist/types/form/form-editor/preview/component-elements.d.ts.map +1 -0
- package/dist/types/form/form-editor/preview/constants.d.ts +2 -0
- package/dist/types/form/form-editor/preview/constants.d.ts.map +1 -0
- package/dist/types/form/form-editor/preview/content.d.ts +43 -0
- package/dist/types/form/form-editor/preview/content.d.ts.map +1 -0
- package/dist/types/form/form-editor/preview/controller/page-controller.d.ts +132 -0
- package/dist/types/form/form-editor/preview/controller/page-controller.d.ts.map +1 -0
- package/dist/types/form/form-editor/preview/date-input.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/email-address.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/fieldset-question.d.ts +2 -0
- package/dist/types/form/form-editor/preview/fieldset-question.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/helpers.d.ts +11 -0
- package/dist/types/form/form-editor/preview/helpers.d.ts.map +1 -0
- package/dist/types/form/form-editor/preview/index.d.ts +6 -0
- package/dist/types/form/form-editor/preview/list-sortable.d.ts +1 -1
- package/dist/types/form/form-editor/preview/list.d.ts +25 -0
- package/dist/types/form/form-editor/preview/list.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/long-answer.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/markdown.d.ts +9 -0
- package/dist/types/form/form-editor/preview/markdown.d.ts.map +1 -0
- package/dist/types/form/form-editor/preview/month-year.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/number-only.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/phone-number.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/preview.d.ts +126 -0
- package/dist/types/form/form-editor/preview/preview.d.ts.map +1 -0
- package/dist/types/form/form-editor/preview/question.d.ts +19 -93
- package/dist/types/form/form-editor/preview/question.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/radio-sortable.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/radio.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/select-sortable.d.ts +18 -0
- package/dist/types/form/form-editor/preview/select-sortable.d.ts.map +1 -0
- package/dist/types/form/form-editor/preview/select.d.ts +4 -0
- package/dist/types/form/form-editor/preview/select.d.ts.map +1 -0
- package/dist/types/form/form-editor/preview/short-answer.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/supporting-evidence.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/types.d.ts +13 -17
- package/dist/types/form/form-editor/preview/types.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/uk-address.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/yes-no.d.ts.map +1 -1
- package/dist/types/form/form-editor/types.d.ts +6 -4
- package/dist/types/form/form-editor/types.d.ts.map +1 -1
- package/dist/types/form/form-metadata/index.d.ts.map +1 -1
- package/dist/types/form/utils/index.d.ts +1 -0
- package/dist/types/form/utils/index.d.ts.map +1 -1
- package/dist/types/form/utils/list.d.ts +10 -0
- package/dist/types/form/utils/list.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/stubs.d.ts +1 -0
- package/dist/types/stubs.d.ts.map +1 -1
- package/package.json +1 -1
- package/schemas/form-definition-schema.json +0 -12
- package/schemas/form-metadata-input-schema.json +1 -2
- package/schemas/form-metadata-schema.json +1 -2
- package/schemas/question-type-full-schema.json +2 -1
- package/src/form/form-definition/index.ts +0 -5
- package/src/form/form-editor/__stubs__/preview.js +84 -4
- package/src/form/form-editor/index.ts +4 -2
- package/src/form/form-editor/macros/types.ts +65 -0
- package/src/form/form-editor/preview/autocomplete.js +21 -4
- package/src/form/form-editor/preview/checkbox-sortable.js +7 -2
- package/src/form/form-editor/preview/checkbox.js +17 -0
- package/src/form/form-editor/preview/component-elements.js +61 -0
- package/src/form/form-editor/preview/constants.js +1 -0
- package/src/form/form-editor/preview/content.js +93 -0
- package/src/form/form-editor/preview/controller/page-controller.js +284 -0
- package/src/form/form-editor/preview/date-input.js +8 -2
- package/src/form/form-editor/preview/email-address.js +7 -1
- package/src/form/form-editor/preview/fieldset-question.js +6 -0
- package/src/form/form-editor/preview/helpers.js +95 -0
- package/src/form/form-editor/preview/index.js +6 -0
- package/src/form/form-editor/preview/list.js +62 -3
- package/src/form/form-editor/preview/long-answer.js +7 -1
- package/src/form/form-editor/preview/markdown.js +50 -0
- package/src/form/form-editor/preview/month-year.js +7 -2
- package/src/form/form-editor/preview/number-only.js +5 -0
- package/src/form/form-editor/preview/phone-number.js +7 -1
- package/src/form/form-editor/preview/preview.js +211 -0
- package/src/form/form-editor/preview/question.js +47 -142
- package/src/form/form-editor/preview/radio-sortable.js +7 -2
- package/src/form/form-editor/preview/radio.js +7 -2
- package/src/form/form-editor/preview/select-sortable.js +43 -0
- package/src/form/form-editor/preview/select.js +11 -0
- package/src/form/form-editor/preview/short-answer.js +7 -1
- package/src/form/form-editor/preview/supporting-evidence.js +7 -1
- package/src/form/form-editor/preview/types.ts +18 -18
- package/src/form/form-editor/preview/uk-address.js +7 -2
- package/src/form/form-editor/preview/yes-no.js +7 -2
- package/src/form/form-editor/types.ts +6 -4
- package/src/form/form-metadata/index.ts +2 -5
- package/src/form/utils/index.ts +1 -0
- package/src/form/utils/list.ts +25 -0
- package/src/index.ts +1 -0
- package/src/stubs.ts +1 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"question.js","names":["
|
1
|
+
{"version":3,"file":"question.js","names":["ComponentType","ComponentElements","PreviewComponent","QuestionComponentElements","_component","constructor","component","_getValues","hintText","hint","shortDesc","shortDescription","Question","componentType","TextField","_questionTemplate","PATH","_fieldName","htmlElements","questionRenderer","values","_hintText","text","_highlight","length","classes","getHighlight","_renderInput","label","value","render"],"sources":["../../../../../src/form/form-editor/preview/question.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { ComponentElements } from '~/src/form/form-editor/preview/component-elements.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n\n/**\n * @implements {QuestionElements}\n */\nexport class QuestionComponentElements extends ComponentElements {\n /**\n * @type {FormComponentsDef}\n * @protected\n */\n _component\n /**\n * @param {FormComponentsDef} component\n */\n constructor(component) {\n super(component)\n this._component = component\n }\n\n /**\n * @protected\n * @returns {BaseSettings}\n */\n _getValues() {\n return {\n ...super._getValues(),\n hintText: this._component.hint ?? '',\n shortDesc: this._component.shortDescription ?? ''\n }\n }\n}\n\n/**\n * @class Question\n * @classdesc\n * A data object that has access to the underlying data via the QuestionElements object interface\n * and the templating mechanism to render the HTML for the data.\n *\n * It does not have access to the DOM, but has access to QuestionElements.setPreviewHTML to update\n * the HTML. Question classes should only be responsible for data and rendering as are reused in the\n * server side.\n */\nexport class Question extends PreviewComponent {\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.TextField\n\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = PreviewComponent.PATH + 'textfield.njk'\n /**\n * @type {string}\n * @protected\n */\n _fieldName = 'inputField'\n\n /**\n * @param {QuestionElements} htmlElements\n * @param {QuestionRenderer} questionRenderer\n */\n constructor(htmlElements, questionRenderer) {\n super(htmlElements, questionRenderer)\n const { hintText } = htmlElements.values\n /**\n * @type {string}\n * @private\n */\n this._hintText = hintText\n }\n\n /**\n * @type {DefaultComponent}\n * @protected\n */\n get hint() {\n const text =\n this._highlight === 'hintText' && !this._hintText.length\n ? 'Hint text'\n : this._hintText\n\n return {\n text,\n classes: this.getHighlight('hintText')\n }\n }\n\n /**\n * @returns {QuestionBaseModel}\n * @protected\n */\n _renderInput() {\n return { ...super._renderInput(), label: this.label, hint: this.hint }\n }\n\n /**\n * @type {string}\n */\n get hintText() {\n return this._hintText\n }\n\n /**\n * @param {string} value\n */\n set hintText(value) {\n this._hintText = value\n this.render()\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,SAASA,aAAa;AACtB,SAASC,iBAAiB;AAC1B,SAASC,gBAAgB;;AAEzB;AACA;AACA;AACA,OAAO,MAAMC,yBAAyB,SAASF,iBAAiB,CAAC;EAC/D;AACF;AACA;AACA;EACEG,UAAU;EACV;AACF;AACA;EACEC,WAAWA,CAACC,SAAS,EAAE;IACrB,KAAK,CAACA,SAAS,CAAC;IAChB,IAAI,CAACF,UAAU,GAAGE,SAAS;EAC7B;;EAEA;AACF;AACA;AACA;EACEC,UAAUA,CAAA,EAAG;IACX,OAAO;MACL,GAAG,KAAK,CAACA,UAAU,CAAC,CAAC;MACrBC,QAAQ,EAAE,IAAI,CAACJ,UAAU,CAACK,IAAI,IAAI,EAAE;MACpCC,SAAS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ACC,MAAM,CAAC,CAAC;EACf;AACF;;AAEA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
@@ -1,6 +1,11 @@
|
|
1
|
+
import { ComponentType } from "../../../components/enums.js";
|
1
2
|
import { ListSortableQuestion } from "./list-sortable.js";
|
2
|
-
import {
|
3
|
+
import { PreviewComponent } from "./preview.js";
|
3
4
|
export class RadioSortableQuestion extends ListSortableQuestion {
|
4
|
-
_questionTemplate =
|
5
|
+
_questionTemplate = PreviewComponent.PATH + 'radios.njk';
|
6
|
+
/**
|
7
|
+
* @type {ComponentType}
|
8
|
+
*/
|
9
|
+
componentType = ComponentType.RadiosField;
|
5
10
|
}
|
6
11
|
//# sourceMappingURL=radio-sortable.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"radio-sortable.js","names":["ListSortableQuestion","
|
1
|
+
{"version":3,"file":"radio-sortable.js","names":["ComponentType","ListSortableQuestion","PreviewComponent","RadioSortableQuestion","_questionTemplate","PATH","componentType","RadiosField"],"sources":["../../../../../src/form/form-editor/preview/radio-sortable.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { ListSortableQuestion } from '~/src/form/form-editor/preview/list-sortable.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n\nexport class RadioSortableQuestion extends ListSortableQuestion {\n _questionTemplate = PreviewComponent.PATH + 'radios.njk'\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.RadiosField\n}\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,oBAAoB;AAC7B,SAASC,gBAAgB;AAEzB,OAAO,MAAMC,qBAAqB,SAASF,oBAAoB,CAAC;EAC9DG,iBAAiB,GAAGF,gBAAgB,CAACG,IAAI,GAAG,YAAY;EACxD;AACF;AACA;EACEC,aAAa,GAAGN,aAAa,CAACO,WAAW;AAC3C","ignoreList":[]}
|
@@ -1,6 +1,11 @@
|
|
1
|
+
import { ComponentType } from "../../../components/enums.js";
|
1
2
|
import { ListQuestion } from "./list.js";
|
2
|
-
import {
|
3
|
+
import { PreviewComponent } from "./preview.js";
|
3
4
|
export class RadioQuestion extends ListQuestion {
|
4
|
-
|
5
|
+
/**
|
6
|
+
* @type {ComponentType}
|
7
|
+
*/
|
8
|
+
componentType = ComponentType.RadiosField;
|
9
|
+
_questionTemplate = PreviewComponent.PATH + 'radios.njk';
|
5
10
|
}
|
6
11
|
//# sourceMappingURL=radio.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"radio.js","names":["ListQuestion","
|
1
|
+
{"version":3,"file":"radio.js","names":["ComponentType","ListQuestion","PreviewComponent","RadioQuestion","componentType","RadiosField","_questionTemplate","PATH"],"sources":["../../../../../src/form/form-editor/preview/radio.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { ListQuestion } from '~/src/form/form-editor/preview/list.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n\nexport class RadioQuestion extends ListQuestion {\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.RadiosField\n _questionTemplate = PreviewComponent.PATH + 'radios.njk'\n}\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,YAAY;AACrB,SAASC,gBAAgB;AAEzB,OAAO,MAAMC,aAAa,SAASF,YAAY,CAAC;EAC9C;AACF;AACA;EACEG,aAAa,GAAGJ,aAAa,CAACK,WAAW;EACzCC,iBAAiB,GAAGJ,gBAAgB,CAACK,IAAI,GAAG,YAAY;AAC1D","ignoreList":[]}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import { ListSortableQuestion } from "./list-sortable.js";
|
2
|
+
import { PreviewComponent } from "./preview.js";
|
3
|
+
import { ComponentType } from "../../../index.js";
|
4
|
+
export class SelectSortableQuestion extends ListSortableQuestion {
|
5
|
+
_questionTemplate = PreviewComponent.PATH + 'selectfield.njk';
|
6
|
+
get selectList() {
|
7
|
+
return this.list.length ? [{
|
8
|
+
id: '',
|
9
|
+
value: '',
|
10
|
+
text: ' '
|
11
|
+
}, ...this.list] : this.list;
|
12
|
+
}
|
13
|
+
|
14
|
+
/**
|
15
|
+
* @type {ComponentType}
|
16
|
+
*/
|
17
|
+
componentType = ComponentType.SelectField;
|
18
|
+
get renderInput() {
|
19
|
+
const afterInput = /** @type {{ formGroup?: { afterInputs: { html: string } } }} */
|
20
|
+
this.list.length ? {} : {
|
21
|
+
formGroup: {
|
22
|
+
afterInput: {
|
23
|
+
html: this._listElements.afterInputsHTML
|
24
|
+
}
|
25
|
+
}
|
26
|
+
};
|
27
|
+
return {
|
28
|
+
id: this._fieldName,
|
29
|
+
name: this._fieldName,
|
30
|
+
hint: this.hint,
|
31
|
+
label: this.label,
|
32
|
+
items: this.selectList,
|
33
|
+
classes: this.list.length ? '' : 'govuk-visually-hidden',
|
34
|
+
...afterInput
|
35
|
+
};
|
36
|
+
}
|
37
|
+
}
|
38
|
+
//# sourceMappingURL=select-sortable.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"select-sortable.js","names":["ListSortableQuestion","PreviewComponent","ComponentType","SelectSortableQuestion","_questionTemplate","PATH","selectList","list","length","id","value","text","componentType","SelectField","renderInput","afterInput","formGroup","html","_listElements","afterInputsHTML","_fieldName","name","hint","label","items","classes"],"sources":["../../../../../src/form/form-editor/preview/select-sortable.js"],"sourcesContent":["import { ListSortableQuestion } from '~/src/form/form-editor/preview/list-sortable.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\nimport { ComponentType } from '~/src/index.js'\n\nexport class SelectSortableQuestion extends ListSortableQuestion {\n _questionTemplate = PreviewComponent.PATH + 'selectfield.njk'\n\n get selectList() {\n return this.list.length\n ? [{ id: '', value: '', text: ' ' }, ...this.list]\n : this.list\n }\n\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.SelectField\n\n get renderInput() {\n const afterInput =\n /** @type {{ formGroup?: { afterInputs: { html: string } } }} */ (\n this.list.length\n ? {}\n : {\n formGroup: {\n afterInput: {\n html: this._listElements.afterInputsHTML\n }\n }\n }\n )\n\n return {\n id: this._fieldName,\n name: this._fieldName,\n hint: this.hint,\n label: this.label,\n items: this.selectList,\n classes: this.list.length ? '' : 'govuk-visually-hidden',\n ...afterInput\n }\n }\n}\n"],"mappings":"AAAA,SAASA,oBAAoB;AAC7B,SAASC,gBAAgB;AACzB,SAASC,aAAa;AAEtB,OAAO,MAAMC,sBAAsB,SAASH,oBAAoB,CAAC;EAC/DI,iBAAiB,GAAGH,gBAAgB,CAACI,IAAI,GAAG,iBAAiB;EAE7D,IAAIC,UAAUA,CAAA,EAAG;IACf,OAAO,IAAI,CAACC,IAAI,CAACC,MAAM,GACnB,CAAC;MAAEC,EAAE,EAAE,EAAE;MAAEC,KAAK,EAAE,EAAE;MAAEC,IAAI,EAAE;IAAI,CAAC,EAAE,GAAG,IAAI,CAACJ,IAAI,CAAC,GAChD,IAAI,CAACA,IAAI;EACf;;EAEA;AACF;AACA;EACEK,aAAa,GAAGV,aAAa,CAACW,WAAW;EAEzC,IAAIC,WAAWA,CAAA,EAAG;IAChB,MAAMC,UAAU,GACd;IACE,IAAI,CAACR,IAAI,CAACC,MAAM,GACZ,CAAC,CAAC,GACF;MACEQ,SAAS,EAAE;QACTD,UAAU,EAAE;UACVE,IAAI,EAAE,IAAI,CAACC,aAAa,CAACC;QAC3B;MACF;IACF,CACL;IAEH,OAAO;MACLV,EAAE,EAAE,IAAI,CAACW,UAAU;MACnBC,IAAI,EAAE,IAAI,CAACD,UAAU;MACrBE,IAAI,EAAE,IAAI,CAACA,IAAI;MACfC,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBC,KAAK,EAAE,IAAI,CAAClB,UAAU;MACtBmB,OAAO,EAAE,IAAI,CAAClB,IAAI,CAACC,MAAM,GAAG,EAAE,GAAG,uBAAuB;MACxD,GAAGO;IACL,CAAC;EACH;AACF","ignoreList":[]}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { ComponentType } from "../../../components/enums.js";
|
2
|
+
import { ListQuestion } from "./list.js";
|
3
|
+
import { PreviewComponent } from "./preview.js";
|
4
|
+
export class SelectQuestion extends ListQuestion {
|
5
|
+
_questionTemplate = PreviewComponent.PATH + 'selectfield.njk';
|
6
|
+
/**
|
7
|
+
* @type {ComponentType}
|
8
|
+
*/
|
9
|
+
componentType = ComponentType.SelectField;
|
10
|
+
}
|
11
|
+
//# sourceMappingURL=select.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"select.js","names":["ComponentType","ListQuestion","PreviewComponent","SelectQuestion","_questionTemplate","PATH","componentType","SelectField"],"sources":["../../../../../src/form/form-editor/preview/select.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { ListQuestion } from '~/src/form/form-editor/preview/list.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n\nexport class SelectQuestion extends ListQuestion {\n _questionTemplate = PreviewComponent.PATH + 'selectfield.njk'\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.SelectField\n}\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,YAAY;AACrB,SAASC,gBAAgB;AAEzB,OAAO,MAAMC,cAAc,SAASF,YAAY,CAAC;EAC/CG,iBAAiB,GAAGF,gBAAgB,CAACG,IAAI,GAAG,iBAAiB;EAC7D;AACF;AACA;EACEC,aAAa,GAAGN,aAAa,CAACO,WAAW;AAC3C","ignoreList":[]}
|
@@ -1,3 +1,9 @@
|
|
1
|
+
import { ComponentType } from "../../../components/enums.js";
|
1
2
|
import { Question } from "./question.js";
|
2
|
-
export class ShortAnswerQuestion extends Question {
|
3
|
+
export class ShortAnswerQuestion extends Question {
|
4
|
+
/**
|
5
|
+
* @type {ComponentType}
|
6
|
+
*/
|
7
|
+
componentType = ComponentType.TextField;
|
8
|
+
}
|
3
9
|
//# sourceMappingURL=short-answer.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"short-answer.js","names":["Question","ShortAnswerQuestion"],"sources":["../../../../../src/form/form-editor/preview/short-answer.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class ShortAnswerQuestion extends Question {}\n"],"mappings":"AAAA,SAASA,QAAQ;AAEjB,OAAO,MAAMC,mBAAmB,SAASD,QAAQ,CAAC","ignoreList":[]}
|
1
|
+
{"version":3,"file":"short-answer.js","names":["ComponentType","Question","ShortAnswerQuestion","componentType","TextField"],"sources":["../../../../../src/form/form-editor/preview/short-answer.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class ShortAnswerQuestion extends Question {\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.TextField\n}\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,QAAQ;AAEjB,OAAO,MAAMC,mBAAmB,SAASD,QAAQ,CAAC;EAChD;AACF;AACA;EACEE,aAAa,GAAGH,aAAa,CAACI,SAAS;AACzC","ignoreList":[]}
|
@@ -1,10 +1,16 @@
|
|
1
|
+
import { ComponentType } from "../../../components/enums.js";
|
2
|
+
import { PreviewComponent } from "./preview.js";
|
1
3
|
import { Question } from "./question.js";
|
2
4
|
export class SupportingEvidenceQuestion extends Question {
|
5
|
+
/**
|
6
|
+
* @type {ComponentType}
|
7
|
+
*/
|
8
|
+
componentType = ComponentType.FileUploadField;
|
3
9
|
/**
|
4
10
|
* @type {string}
|
5
11
|
* @protected
|
6
12
|
*/
|
7
|
-
_questionTemplate =
|
13
|
+
_questionTemplate = PreviewComponent.PATH + 'fileuploadfield.njk';
|
8
14
|
/**
|
9
15
|
* @type {string}
|
10
16
|
* @protected
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"supporting-evidence.js","names":["Question","SupportingEvidenceQuestion","_questionTemplate","PATH","_fieldName"],"sources":["../../../../../src/form/form-editor/preview/supporting-evidence.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class SupportingEvidenceQuestion extends Question {\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate =
|
1
|
+
{"version":3,"file":"supporting-evidence.js","names":["ComponentType","PreviewComponent","Question","SupportingEvidenceQuestion","componentType","FileUploadField","_questionTemplate","PATH","_fieldName"],"sources":["../../../../../src/form/form-editor/preview/supporting-evidence.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\nimport { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class SupportingEvidenceQuestion extends Question {\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.FileUploadField\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = PreviewComponent.PATH + 'fileuploadfield.njk'\n /**\n * @type {string}\n * @protected\n */\n _fieldName = 'supportingEvidence'\n}\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,gBAAgB;AACzB,SAASC,QAAQ;AAEjB,OAAO,MAAMC,0BAA0B,SAASD,QAAQ,CAAC;EACvD;AACF;AACA;EACEE,aAAa,GAAGJ,aAAa,CAACK,eAAe;EAC7C;AACF;AACA;AACA;EACEC,iBAAiB,GAAGL,gBAAgB,CAACM,IAAI,GAAG,qBAAqB;EACjE;AACF;AACA;AACA;EACEC,UAAU,GAAG,oBAAoB;AACnC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/form/form-editor/preview/types.ts"],"sourcesContent":["import { type AutocompleteQuestion } from '~/src/form/form-editor/preview/autocomplete.js'\nimport { type DateInputQuestion } from '~/src/form/form-editor/preview/date-input.js'\nimport { type EmailAddressQuestion } from '~/src/form/form-editor/preview/email-address.js'\nimport { type ListSortableQuestion } from '~/src/form/form-editor/preview/list-sortable.js'\nimport { type LongAnswerQuestion } from '~/src/form/form-editor/preview/long-answer.js'\nimport { type PhoneNumberQuestion } from '~/src/form/form-editor/preview/phone-number.js'\nimport { type Question } from '~/src/form/form-editor/preview/question.js'\nimport { type RadioSortableQuestion } from '~/src/form/form-editor/preview/radio-sortable.js'\nimport { type ShortAnswerQuestion } from '~/src/form/form-editor/preview/short-answer.js'\nimport { type UkAddressQuestion } from '~/src/form/form-editor/preview/uk-address.js'\nimport {
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/form/form-editor/preview/types.ts"],"sourcesContent":["import {\n type PagePreviewPanelMacro,\n type QuestionBaseModel\n} from '~/src/form/form-editor/macros/types.js'\nimport { type AutocompleteQuestion } from '~/src/form/form-editor/preview/autocomplete.js'\nimport { type DateInputQuestion } from '~/src/form/form-editor/preview/date-input.js'\nimport { type EmailAddressQuestion } from '~/src/form/form-editor/preview/email-address.js'\nimport { type ListSortableQuestion } from '~/src/form/form-editor/preview/list-sortable.js'\nimport { type LongAnswerQuestion } from '~/src/form/form-editor/preview/long-answer.js'\nimport { type PhoneNumberQuestion } from '~/src/form/form-editor/preview/phone-number.js'\nimport { type Question } from '~/src/form/form-editor/preview/question.js'\nimport { type RadioSortableQuestion } from '~/src/form/form-editor/preview/radio-sortable.js'\nimport { type SelectSortableQuestion } from '~/src/form/form-editor/preview/select-sortable.js'\nimport { type ShortAnswerQuestion } from '~/src/form/form-editor/preview/short-answer.js'\nimport { type UkAddressQuestion } from '~/src/form/form-editor/preview/uk-address.js'\nimport { type ListElement } from '~/src/form/form-editor/types.js'\nexport { type QuestionBaseModel } from '~/src/form/form-editor/macros/types.js'\nexport interface BaseSettings {\n question: string\n hintText: string\n optional: boolean\n shortDesc: string\n items: ListElement[]\n content: string\n}\n\nexport interface DefaultComponent {\n id?: string\n text: string\n classes: string\n}\n\nexport interface GovukFieldset {\n legend: DefaultComponent\n}\n\nexport type ListenerRow = [\n HTMLInputElement | null,\n (target: HTMLInputElement, e: Event) => void,\n keyof HTMLElementEventMap\n]\n\nexport interface QuestionElements {\n readonly values: BaseSettings\n setPreviewHTML(value: string): void\n setPreviewDOM(element: HTMLElement): void\n}\nexport interface AutocompleteElements extends QuestionElements {\n autocompleteOptions: string\n}\n\nexport interface RenderContext {\n model: QuestionBaseModel\n}\n\nexport interface HTMLBuilder {\n buildHTML(questionTemplate: string, renderContext: RenderContext): string\n}\n\nexport interface QuestionRenderer {\n render(questionTemplate: string, questionBaseModel: QuestionBaseModel): void\n}\n\nexport interface PageRenderer {\n render(pageTemplate: string, pagePreview: PagePreviewPanelMacro): void\n}\n\nexport interface ListElements extends QuestionElements {\n afterInputsHTML: string\n}\n\nexport interface PageOverviewElements {\n heading: string\n guidance: string\n}\n\nexport type PreviewQuestion =\n | DateInputQuestion\n | EmailAddressQuestion\n | ListSortableQuestion\n | LongAnswerQuestion\n | PhoneNumberQuestion\n | Question\n | RadioSortableQuestion\n | SelectSortableQuestion\n | ShortAnswerQuestion\n | UkAddressQuestion\n | AutocompleteQuestion\n"],"mappings":"","ignoreList":[]}
|
@@ -1,7 +1,12 @@
|
|
1
|
+
import { ComponentType } from "../../../components/enums.js";
|
1
2
|
import { FieldsetQuestion } from "./fieldset-question.js";
|
2
|
-
import {
|
3
|
+
import { PreviewComponent } from "./preview.js";
|
3
4
|
export class UkAddressQuestion extends FieldsetQuestion {
|
4
|
-
|
5
|
+
/**
|
6
|
+
* @type {ComponentType}
|
7
|
+
*/
|
8
|
+
componentType = ComponentType.UkAddressField;
|
9
|
+
_questionTemplate = PreviewComponent.PATH + 'ukaddressfield.njk';
|
5
10
|
_fieldName = 'addressField';
|
6
11
|
}
|
7
12
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"uk-address.js","names":["FieldsetQuestion","
|
1
|
+
{"version":3,"file":"uk-address.js","names":["ComponentType","FieldsetQuestion","PreviewComponent","UkAddressQuestion","componentType","UkAddressField","_questionTemplate","PATH","_fieldName"],"sources":["../../../../../src/form/form-editor/preview/uk-address.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { FieldsetQuestion } from '~/src/form/form-editor/preview/fieldset-question.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n\nexport class UkAddressQuestion extends FieldsetQuestion {\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.UkAddressField\n _questionTemplate = PreviewComponent.PATH + 'ukaddressfield.njk'\n _fieldName = 'addressField'\n}\n\n/**\n * @import { QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,gBAAgB;AACzB,SAASC,gBAAgB;AAEzB,OAAO,MAAMC,iBAAiB,SAASF,gBAAgB,CAAC;EACtD;AACF;AACA;EACEG,aAAa,GAAGJ,aAAa,CAACK,cAAc;EAC5CC,iBAAiB,GAAGJ,gBAAgB,CAACK,IAAI,GAAG,oBAAoB;EAChEC,UAAU,GAAG,cAAc;AAC7B;;AAEA;AACA;AACA","ignoreList":[]}
|
@@ -1,11 +1,16 @@
|
|
1
|
+
import { ComponentType } from "../../../components/enums.js";
|
1
2
|
import { FieldsetQuestion } from "./fieldset-question.js";
|
2
|
-
import {
|
3
|
+
import { PreviewComponent } from "./preview.js";
|
3
4
|
export class YesNoQuestion extends FieldsetQuestion {
|
5
|
+
/**
|
6
|
+
* @type {ComponentType}
|
7
|
+
*/
|
8
|
+
componentType = ComponentType.YesNoField;
|
4
9
|
/**
|
5
10
|
* @type {string}
|
6
11
|
* @protected
|
7
12
|
*/
|
8
|
-
_questionTemplate =
|
13
|
+
_questionTemplate = PreviewComponent.PATH + 'radios.njk';
|
9
14
|
_fieldName = 'yesNo';
|
10
15
|
|
11
16
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"yes-no.js","names":["FieldsetQuestion","
|
1
|
+
{"version":3,"file":"yes-no.js","names":["ComponentType","FieldsetQuestion","PreviewComponent","YesNoQuestion","componentType","YesNoField","_questionTemplate","PATH","_fieldName","customRenderFields","type","items","id","text","value","label","classes"],"sources":["../../../../../src/form/form-editor/preview/yes-no.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { FieldsetQuestion } from '~/src/form/form-editor/preview/fieldset-question.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n\nexport class YesNoQuestion extends FieldsetQuestion {\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.YesNoField\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = PreviewComponent.PATH + 'radios.njk'\n _fieldName = 'yesNo'\n\n /**\n * @returns {Partial<QuestionBaseModel>}\n */\n get customRenderFields() {\n /**\n *\n */\n return {\n type: 'boolean',\n items: /** @type {ListElement[]} */ ([\n {\n id: 'yesNo-yes',\n text: 'Yes',\n value: true,\n label: {\n text: 'Yes',\n classes: ''\n }\n },\n {\n id: 'yesNo-no',\n text: 'No',\n value: false,\n label: {\n text: 'No',\n classes: ''\n }\n }\n ])\n }\n }\n}\n\n/**\n * @import { QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'\n * @import { ListElement } from '~/src/form/form-editor/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,gBAAgB;AACzB,SAASC,gBAAgB;AAEzB,OAAO,MAAMC,aAAa,SAASF,gBAAgB,CAAC;EAClD;AACF;AACA;EACEG,aAAa,GAAGJ,aAAa,CAACK,UAAU;EACxC;AACF;AACA;AACA;EACEC,iBAAiB,GAAGJ,gBAAgB,CAACK,IAAI,GAAG,YAAY;EACxDC,UAAU,GAAG,OAAO;;EAEpB;AACF;AACA;EACE,IAAIC,kBAAkBA,CAAA,EAAG;IACvB;AACJ;AACA;IACI,OAAO;MACLC,IAAI,EAAE,SAAS;MACfC,KAAK,GAAE,4BAA8B,CACnC;QACEC,EAAE,EAAE,WAAW;QACfC,IAAI,EAAE,KAAK;QACXC,KAAK,EAAE,IAAI;QACXC,KAAK,EAAE;UACLF,IAAI,EAAE,KAAK;UACXG,OAAO,EAAE;QACX;MACF,CAAC,EACD;QACEJ,EAAE,EAAE,UAAU;QACdC,IAAI,EAAE,IAAI;QACVC,KAAK,EAAE,KAAK;QACZC,KAAK,EAAE;UACLF,IAAI,EAAE,IAAI;UACVG,OAAO,EAAE;QACX;MACF,CAAC,CACF;IACH,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../src/form/form-editor/types.ts"],"sourcesContent":["import { type ComponentType } from '~/src/components/enums.js'\nimport { type ComponentDef } from '~/src/components/types.js'\nimport {\n type ConditionWrapperV2,\n type DateDirections,\n type DateUnits,\n type Item\n} from '~/src/index.js'\n\n/**\n * Interface for `FormEditor` Joi schema\n */\nexport interface FormEditor {\n /**\n * The type of the page\n */\n pageType: string\n\n /**\n * The type of the question\n */\n questionType: string | undefined\n\n /**\n * The sub-type of written answer\n */\n writtenAnswerSub: string\n\n /**\n * The sub-type of date\n */\n dateSub: string\n\n /**\n * The sub-type of lists\n */\n listSub: string\n\n /**\n * The name of the question (unique id)\n */\n name: string\n\n /**\n * The text of the question\n */\n question: string\n\n /**\n * The hint text of the question\n */\n hintText: string\n\n /**\n * Denotes if the question is optional\n */\n questionOptional: string\n\n /**\n * The short description of the question\n */\n shortDescription: string\n\n /**\n * The value of checkbox to reveal heading and guidance section\n */\n pageHeadingAndGuidance: string\n\n /**\n * The page heading\n */\n pageHeading: string\n\n /**\n * The page guidance text\n */\n guidanceText: string\n\n /**\n * The value of checkbox to reveal repeater section\n */\n repeater: string\n\n /**\n * The maximum number of repeater items\n */\n minItems: number\n\n /**\n * The minimum number of repeater items\n */\n maxItems: number\n\n /**\n * The repeater question set name\n */\n questionSetName: string\n\n /**\n * The value of radio to reveal declaration text field\n */\n needDeclaration: string\n\n /**\n * The check answers declaration text\n */\n declarationText: string\n\n /**\n * The min length a field can have\n */\n minLength: string\n\n /**\n * The max length a field can have\n */\n maxLength: string\n\n /**\n * The regex value of a field\n */\n regex: string\n\n /**\n * The number of rows of a textarea\n */\n rows: string\n\n /**\n * The classes to be applied to a field\n */\n classes: string\n\n /**\n * The prefix to be applied to a field\n */\n prefix: string\n\n /**\n * The suffix to be applied to a field\n */\n suffix: string\n\n /**\n * The decimal precision of a number field\n */\n precision: string\n\n /**\n * The lowest number allowed in a field\n */\n min: string\n\n /**\n * The highest number allowed in a field\n */\n max: string\n\n /**\n * The maximum days in the future to allow for a date\n */\n maxFuture: string\n\n /**\n * The maximum days in the past to allow for a date\n */\n maxPast: string\n\n /**\n * The exact number of files to upload\n */\n exactFiles: string\n\n /**\n * The minimum number of files to upload\n */\n minFiles: string\n\n /**\n * The maximum number of files to upload\n */\n maxFiles: string\n\n /**\n * The type of files for upload\n */\n fileTypes: string[]\n\n /**\n * The types of document files for upload\n */\n documentTypes: string[]\n\n /**\n * The types of image files for upload\n */\n imageTypes: string[]\n\n /**\n * The types of tabular data files for upload\n */\n tabularDataTypes: string[]\n\n /**\n * The action required from within a sub-section\n */\n enhancedAction: string\n\n /**\n * Placeholder for inserted section to handle adding/editing radios or checkboxes\n */\n radiosOrCheckboxes: string\n\n /**\n * The unique id of the radio item\n */\n radioId: string\n\n /**\n * The display text of the radio item\n */\n radioText?: string\n\n /**\n * The hint of the radio item\n */\n radioHint?: string\n\n /**\n * The value of the radio item\n */\n radioValue?: string\n\n /**\n * The list name to be applied to a field (if applicable)\n */\n list: string\n\n /**\n * List items in JSON format, such as for radios ro checkboxes\n */\n listItemsData: string\n\n /**\n * An array of options for autocomplete\n */\n autoCompleteOptions: Item[]\n\n /**\n * Set to 'true' is Javascript is enabled\n */\n jsEnabled: string\n\n /**\n * List item id for conditions\n */\n itemId: string\n\n /**\n * Relative date period for conditions\n */\n period: string\n\n /**\n * Relative date unit for conditions\n */\n unit: DateUnits\n\n /**\n * Relative date direction for conditions\n */\n direction: DateDirections\n}\n\nexport type FormEditorInputPage = Pick<\n FormEditor,\n 'pageType' | 'questionType' | 'writtenAnswerSub' | 'dateSub' | 'listSub'\n>\n\nexport type FormEditorInputCheckAnswersSettings = Pick<\n FormEditor,\n 'needDeclaration' | 'declarationText'\n>\n\nexport type FormEditorInputQuestion = Pick<\n FormEditor,\n | 'questionType'\n | 'name'\n | 'question'\n | 'shortDescription'\n | 'hintText'\n | 'questionOptional'\n | 'minLength'\n | 'maxLength'\n | 'regex'\n | 'rows'\n | 'classes'\n | 'prefix'\n | 'suffix'\n | 'precision'\n | 'min'\n | 'max'\n | 'maxFuture'\n | 'maxPast'\n | 'exactFiles'\n | 'minFiles'\n | 'maxFiles'\n | 'fileTypes'\n | 'documentTypes'\n | 'imageTypes'\n | 'tabularDataTypes'\n | 'autoCompleteOptions'\n | 'enhancedAction'\n | 'radioId'\n | 'radioText'\n | 'radioHint'\n | 'radioValue'\n | 'list'\n | 'listItemsData'\n | 'jsEnabled'\n>\n\nexport type FormEditorInputPageSettings = Pick<\n FormEditor,\n | 'pageHeadingAndGuidance'\n | 'pageHeading'\n | 'guidanceText'\n | 'repeater'\n | 'minItems'\n | 'maxItems'\n | 'questionSetName'\n>\n\nexport type FormEditorInputGuidancePage = Pick<\n FormEditor,\n 'pageHeading' | 'guidanceText'\n>\n\nexport type FormEditorInputQuestionDetails = Pick<\n FormEditorInputQuestion,\n | 'question'\n | 'hintText'\n | 'shortDescription'\n | 'questionOptional'\n | 'questionType'\n | 'fileTypes'\n | 'documentTypes'\n | 'imageTypes'\n | 'tabularDataTypes'\n | 'autoCompleteOptions'\n | 'enhancedAction'\n | 'radioId'\n | 'radioText'\n | 'radioHint'\n | 'radioValue'\n | 'listItemsData'\n | 'jsEnabled'\n>\n\nexport interface ListItem {\n id?: string\n text?: string\n hint?: {\n text: string\n }\n value?:
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../src/form/form-editor/types.ts"],"sourcesContent":["import { type ComponentType } from '~/src/components/enums.js'\nimport { type ComponentDef } from '~/src/components/types.js'\nimport {\n type ConditionWrapperV2,\n type DateDirections,\n type DateUnits,\n type Item\n} from '~/src/index.js'\n\n/**\n * Interface for `FormEditor` Joi schema\n */\nexport interface FormEditor {\n /**\n * The type of the page\n */\n pageType: string\n\n /**\n * The type of the question\n */\n questionType: string | undefined\n\n /**\n * The sub-type of written answer\n */\n writtenAnswerSub: string\n\n /**\n * The sub-type of date\n */\n dateSub: string\n\n /**\n * The sub-type of lists\n */\n listSub: string\n\n /**\n * The name of the question (unique id)\n */\n name: string\n\n /**\n * The text of the question\n */\n question: string\n\n /**\n * The hint text of the question\n */\n hintText: string\n\n /**\n * Denotes if the question is optional\n */\n questionOptional: string\n\n /**\n * The short description of the question\n */\n shortDescription: string\n\n /**\n * The value of checkbox to reveal heading and guidance section\n */\n pageHeadingAndGuidance: string\n\n /**\n * The page heading\n */\n pageHeading: string\n\n /**\n * The page guidance text\n */\n guidanceText: string\n\n /**\n * The value of checkbox to reveal repeater section\n */\n repeater: string\n\n /**\n * The maximum number of repeater items\n */\n minItems: number\n\n /**\n * The minimum number of repeater items\n */\n maxItems: number\n\n /**\n * The repeater question set name\n */\n questionSetName: string\n\n /**\n * The value of radio to reveal declaration text field\n */\n needDeclaration: string\n\n /**\n * The check answers declaration text\n */\n declarationText: string\n\n /**\n * The min length a field can have\n */\n minLength: string\n\n /**\n * The max length a field can have\n */\n maxLength: string\n\n /**\n * The regex value of a field\n */\n regex: string\n\n /**\n * The number of rows of a textarea\n */\n rows: string\n\n /**\n * The classes to be applied to a field\n */\n classes: string\n\n /**\n * The prefix to be applied to a field\n */\n prefix: string\n\n /**\n * The suffix to be applied to a field\n */\n suffix: string\n\n /**\n * The decimal precision of a number field\n */\n precision: string\n\n /**\n * The lowest number allowed in a field\n */\n min: string\n\n /**\n * The highest number allowed in a field\n */\n max: string\n\n /**\n * The maximum days in the future to allow for a date\n */\n maxFuture: string\n\n /**\n * The maximum days in the past to allow for a date\n */\n maxPast: string\n\n /**\n * The exact number of files to upload\n */\n exactFiles: string\n\n /**\n * The minimum number of files to upload\n */\n minFiles: string\n\n /**\n * The maximum number of files to upload\n */\n maxFiles: string\n\n /**\n * The type of files for upload\n */\n fileTypes: string[]\n\n /**\n * The types of document files for upload\n */\n documentTypes: string[]\n\n /**\n * The types of image files for upload\n */\n imageTypes: string[]\n\n /**\n * The types of tabular data files for upload\n */\n tabularDataTypes: string[]\n\n /**\n * The action required from within a sub-section\n */\n enhancedAction: string\n\n /**\n * Placeholder for inserted section to handle adding/editing radios or checkboxes\n */\n radiosOrCheckboxes: string\n\n /**\n * The unique id of the radio item\n */\n radioId: string\n\n /**\n * The display text of the radio item\n */\n radioText?: string\n\n /**\n * The hint of the radio item\n */\n radioHint?: string\n\n /**\n * The value of the radio item\n */\n radioValue?: string\n\n /**\n * The list name to be applied to a field (if applicable)\n */\n list: string\n\n /**\n * List items in JSON format, such as for radios ro checkboxes\n */\n listItemsData: string\n\n /**\n * An array of options for autocomplete\n */\n autoCompleteOptions: Item[]\n\n /**\n * Set to 'true' is Javascript is enabled\n */\n jsEnabled: string\n\n /**\n * List item id for conditions\n */\n itemId: string\n\n /**\n * Relative date period for conditions\n */\n period: string\n\n /**\n * Relative date unit for conditions\n */\n unit: DateUnits\n\n /**\n * Relative date direction for conditions\n */\n direction: DateDirections\n}\n\nexport type FormEditorInputPage = Pick<\n FormEditor,\n 'pageType' | 'questionType' | 'writtenAnswerSub' | 'dateSub' | 'listSub'\n>\n\nexport type FormEditorInputCheckAnswersSettings = Pick<\n FormEditor,\n 'needDeclaration' | 'declarationText'\n>\n\nexport type FormEditorInputQuestion = Pick<\n FormEditor,\n | 'questionType'\n | 'name'\n | 'question'\n | 'shortDescription'\n | 'hintText'\n | 'questionOptional'\n | 'minLength'\n | 'maxLength'\n | 'regex'\n | 'rows'\n | 'classes'\n | 'prefix'\n | 'suffix'\n | 'precision'\n | 'min'\n | 'max'\n | 'maxFuture'\n | 'maxPast'\n | 'exactFiles'\n | 'minFiles'\n | 'maxFiles'\n | 'fileTypes'\n | 'documentTypes'\n | 'imageTypes'\n | 'tabularDataTypes'\n | 'autoCompleteOptions'\n | 'enhancedAction'\n | 'radioId'\n | 'radioText'\n | 'radioHint'\n | 'radioValue'\n | 'list'\n | 'listItemsData'\n | 'jsEnabled'\n>\n\nexport type FormEditorInputPageSettings = Pick<\n FormEditor,\n | 'pageHeadingAndGuidance'\n | 'pageHeading'\n | 'guidanceText'\n | 'repeater'\n | 'minItems'\n | 'maxItems'\n | 'questionSetName'\n>\n\nexport type FormEditorInputGuidancePage = Pick<\n FormEditor,\n 'pageHeading' | 'guidanceText'\n>\n\nexport type FormEditorInputQuestionDetails = Pick<\n FormEditorInputQuestion,\n | 'question'\n | 'hintText'\n | 'shortDescription'\n | 'questionOptional'\n | 'questionType'\n | 'fileTypes'\n | 'documentTypes'\n | 'imageTypes'\n | 'tabularDataTypes'\n | 'autoCompleteOptions'\n | 'enhancedAction'\n | 'radioId'\n | 'radioText'\n | 'radioHint'\n | 'radioValue'\n | 'listItemsData'\n | 'jsEnabled'\n>\n\ntype ListValue = string | boolean | number\n\nexport interface ListItem {\n id?: string\n text?: string\n hint?: {\n text: string\n }\n value?: ListValue\n}\n\nexport interface ListLabel {\n text: string\n classes: string\n}\n\nexport interface ListElement extends ListItem {\n readonly id: string\n text: string\n value: ListValue\n label?: ListLabel\n}\n\nexport interface ReadonlyHint {\n readonly text: string\n}\n\nexport interface ListItemReadonly extends ListElement {\n readonly text: string\n readonly hint?: ReadonlyHint\n readonly value: ListValue\n readonly label?: ListLabel\n}\n\nexport interface DateItem {\n name: string\n classes: string\n}\n\nexport interface QuestionSessionState {\n questionType?: ComponentType\n questionDetails?: Partial<ComponentDef>\n editRow?: {\n radioId?: string\n radioText?: string\n radioHint?: string\n radioValue?: ListValue\n expanded?: boolean\n }\n listItems?: ListItem[]\n isReordering?: boolean\n lastMovedId?: string\n lastMoveDirection?: string\n}\n\nexport interface ConditionSessionState {\n id?: string\n stateId?: string\n conditionWrapper?: ConditionWrapperV2\n originalConditionWrapper?: ConditionWrapperV2\n}\n\nexport interface GovukFieldItem {\n text?: string\n value?: string\n checked?: boolean\n}\n\nexport interface GovukField {\n id?: string\n name?: string\n idPrefix?: string\n fieldset?: {\n legend?: { text?: string; isPageHeading?: boolean; classes?: string }\n }\n value?: string | boolean | number | string[] | Item[]\n classes?: string\n label?: {\n text?: string\n html?: string\n classes?: string\n isPageHeading?: boolean\n }\n hint?: { text?: string; html?: string; classes?: string }\n items?: GovukFieldItem[]\n rows?: number\n type?: string\n customTemplate?: string\n}\n\nexport type GovukFieldQuestionOptional = Omit<GovukField, 'name' | 'items'> & {\n name: 'questionOptional'\n items: [\n {\n text?: string\n value?: string\n checked: boolean\n }\n ]\n}\n\nexport type GovukStringField = Omit<GovukField, 'value'> & { value: string }\n\nexport interface FormEditorGovukField {\n question?: GovukField\n hintText?: GovukField\n questionOptional?: GovukField\n shortDescription?: GovukField\n fileTypes?: GovukField\n documentTypes?: GovukField\n imageTypes?: GovukField\n tabularDataTypes?: GovukField\n radiosOrCheckboxes?: GovukField\n autoCompleteOptions?: GovukField\n errorMessage?: { text: string }\n}\n\nexport type FormEditorGovukFieldBase = Omit<\n FormEditorGovukField,\n 'errorMessage'\n>\n\nexport type FormEditorGovukFieldBaseKeys = keyof FormEditorGovukFieldBase\n\nexport interface FormEditorCheckbox {\n text?: string\n hint?: {\n text?: string\n }\n value?: string\n divider?: {\n text?: string\n hint?: string\n value?: string\n }\n}\n\nexport type AdvancedFieldMappingsType = Record<\n ComponentType,\n Record<string, string>\n>\n\nexport type HTMLElementOrNull = HTMLElement | null\n\nexport type HTMLInputElementOrNull = HTMLInputElement | null\n\nexport interface ErrorPreviewFieldMappingDef {\n min?: { fieldName: string; placeholder: string }\n max?: { fieldName: string; placeholder: string }\n}\n"],"mappings":"","ignoreList":[]}
|
@@ -36,11 +36,7 @@ export const submissionGuidanceSchema = Joi.string().trim().description('Guidanc
|
|
36
36
|
export const privacyNoticeUrlSchema = Joi.string().uri({
|
37
37
|
scheme: ['http', 'https']
|
38
38
|
}).trim().description('URL to the privacy notice for this form');
|
39
|
-
export const notificationEmailAddressSchema = Joi.string().email(
|
40
|
-
tlds: {
|
41
|
-
allow: ['uk']
|
42
|
-
}
|
43
|
-
}).trim().pattern(/\.gov\.uk$|\.org\.uk$/).description('Email address to receive form submission notifications, must be a .gov.uk or .org.uk address');
|
39
|
+
export const notificationEmailAddressSchema = Joi.string().email().trim().description('Email address to receive form submission notifications');
|
44
40
|
export const authoredAtSchema = Joi.date().iso().required().description('ISO format timestamp of when an action occurred');
|
45
41
|
export const authorIdSchema = Joi.string().trim().required().description('Unique identifier for the author');
|
46
42
|
export const authorDisplayNameSchema = Joi.string().trim().required().description('Human-readable name of the author');
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","names":["Joi","organisations","idSchema","string","hex","length","required","description","titleSchema","max","trim","slugSchema","pattern","name","organisationSchema","valid","teamNameSchema","teamEmailSchema","email","tlds","allow","phoneSchema","emailAddressSchema","emailResponseTimeSchema","emailSchema","object","keys","address","responseTime","onlineUrlSchema","uri","scheme","onlineTextSchema","onlineSchema","url","text","contactSchema","phone","online","submissionGuidanceSchema","privacyNoticeUrlSchema","notificationEmailAddressSchema","authoredAtSchema","date","iso","authorIdSchema","authorDisplayNameSchema","formMetadataInputKeys","title","organisation","teamName","teamEmail","contact","submissionGuidance","privacyNoticeUrl","notificationEmail","formMetadataInputSchema","formMetadataAuthorSchema","id","displayName","formMetadataStateSchema","createdAt","createdBy","updatedAt","updatedBy","formMetadataSchema","append","slug","draft","live"],"sources":["../../../../src/form/form-metadata/index.ts"],"sourcesContent":["import Joi from 'joi'\n\nimport {\n type FormMetadata,\n type FormMetadataAuthor,\n type FormMetadataContact,\n type FormMetadataContactEmail,\n type FormMetadataContactOnline,\n type FormMetadataInput,\n type FormMetadataState\n} from '~/src/form/form-metadata/types.js'\n\nexport const organisations = [\n 'Animal and Plant Health Agency – APHA',\n 'Centre for Environment, Fisheries and Aquaculture Science – Cefas',\n 'Defra',\n 'Environment Agency',\n 'Forestry Commission',\n 'Marine Management Organisation – MMO',\n 'Natural England',\n 'Rural Payments Agency – RPA',\n 'Veterinary Medicines Directorate – VMD'\n]\n\nexport const idSchema = Joi.string()\n .hex()\n .length(24)\n .required()\n .description(\n 'Unique identifier for the form, 24-character hexadecimal string'\n )\n\nexport const titleSchema = Joi.string()\n .max(250)\n .trim()\n .required()\n .description('Title of the form, displayed to users')\n\nexport const slugSchema = Joi.string()\n .pattern(/^[a-z0-9-]+$/, { name: 'letters, numbers and hyphens only' })\n .required()\n .description('URL-friendly identifier used in form paths')\n\nexport const organisationSchema = Joi.string()\n .valid(...organisations)\n .required()\n .description('Defra organisation responsible for the form')\n\nexport const teamNameSchema = Joi.string()\n .max(100)\n .trim()\n .required()\n .description('Name of the team responsible for the form')\n\nexport const teamEmailSchema = Joi.string()\n .email({ tlds: { allow: ['uk'] } })\n .trim()\n .required()\n .description('Contact email for the team responsible for the form')\n\nexport const phoneSchema = Joi.string()\n .trim()\n .description('Phone number for form-related inquiries')\n\nexport const emailAddressSchema = Joi.string()\n .email()\n .trim()\n .required()\n .description('Email address for form-related inquiries')\n\nexport const emailResponseTimeSchema = Joi.string()\n .trim()\n .required()\n .description('Expected response time for email inquiries')\n\nexport const emailSchema = Joi.object<FormMetadataContactEmail>()\n .keys({\n address: emailAddressSchema,\n responseTime: emailResponseTimeSchema\n })\n .description('Email contact details including response expectations')\n\nexport const onlineUrlSchema = Joi.string()\n .uri({\n scheme: ['http', 'https']\n })\n .trim()\n .required()\n .description('URL for online contact method')\n\nexport const onlineTextSchema = Joi.string()\n .trim()\n .required()\n .description('Descriptive text for the online contact link')\n\nexport const onlineSchema = Joi.object<FormMetadataContactOnline>()\n .keys({\n url: onlineUrlSchema,\n text: onlineTextSchema\n })\n .description('Online contact details with URL and descriptive text')\n\nexport const contactSchema = Joi.object<FormMetadataContact>()\n .keys({\n phone: phoneSchema,\n email: emailSchema,\n online: onlineSchema\n })\n .description('Complete contact information for form-related inquiries')\n\nexport const submissionGuidanceSchema = Joi.string()\n .trim()\n .description('Guidance text shown to users when submitting the form')\n\nexport const privacyNoticeUrlSchema = Joi.string()\n .uri({\n scheme: ['http', 'https']\n })\n .trim()\n .description('URL to the privacy notice for this form')\n\nexport const notificationEmailAddressSchema = Joi.string()\n .email({ tlds: { allow: ['uk'] } })\n .trim()\n .pattern(/\\.gov\\.uk$|\\.org\\.uk$/)\n .description(\n 'Email address to receive form submission notifications, must be a .gov.uk or .org.uk address'\n )\n\nexport const authoredAtSchema = Joi.date()\n .iso()\n .required()\n .description('ISO format timestamp of when an action occurred')\n\nexport const authorIdSchema = Joi.string()\n .trim()\n .required()\n .description('Unique identifier for the author')\n\nexport const authorDisplayNameSchema = Joi.string()\n .trim()\n .required()\n .description('Human-readable name of the author')\n\nexport const formMetadataInputKeys = {\n title: titleSchema,\n organisation: organisationSchema,\n teamName: teamNameSchema,\n teamEmail: teamEmailSchema,\n contact: contactSchema,\n submissionGuidance: submissionGuidanceSchema,\n privacyNoticeUrl: privacyNoticeUrlSchema,\n notificationEmail: notificationEmailAddressSchema\n}\n\n/**\n * Joi schema for `FormMetadataInput` interface\n * @see {@link FormMetadataInput}\n */\nexport const formMetadataInputSchema = Joi.object<FormMetadataInput>()\n .keys(formMetadataInputKeys)\n .required()\n .description('Input data for creating or updating form metadata')\n\n/**\n * Joi schema for `FormMetadataAuthor` interface\n * @see {@link FormMetadataAuthor}\n */\nexport const formMetadataAuthorSchema = Joi.object<FormMetadataAuthor>()\n .keys({\n id: authorIdSchema,\n displayName: authorDisplayNameSchema\n })\n .required()\n .description('Information about the author of a form or form change')\n\n/**\n * Joi schema for `FormMetadataState` interface\n * @see {@link FormMetadataState}\n */\nexport const formMetadataStateSchema = Joi.object<FormMetadataState>()\n .keys({\n createdAt: authoredAtSchema.description(\n 'When this version was first created'\n ),\n createdBy: formMetadataAuthorSchema.description('Who created this version'),\n updatedAt: authoredAtSchema.description(\n 'When this version was last updated'\n ),\n updatedBy: formMetadataAuthorSchema.description(\n 'Who last updated this version'\n )\n })\n .description('Metadata about a specific version state (draft or live)')\n\n/**\n * Joi schema for `FormMetadata` interface\n * @see {@link FormMetadata}\n */\nexport const formMetadataSchema = formMetadataInputSchema\n .append<FormMetadata>({\n id: idSchema,\n slug: slugSchema,\n draft: formMetadataStateSchema.description(\n 'Metadata for the draft version'\n ),\n live: formMetadataStateSchema.description(\n 'Metadata for the published version'\n ),\n createdAt: authoredAtSchema.description('When the form was first created'),\n createdBy: formMetadataAuthorSchema.description('Who created the form'),\n updatedAt: authoredAtSchema.description('When the form was last updated'),\n updatedBy: formMetadataAuthorSchema.description('Who last updated the form')\n })\n .description(\n 'Complete metadata for a form, including version information and authoring details'\n )\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,KAAK;AAYrB,OAAO,MAAMC,aAAa,GAAG,CAC3B,uCAAuC,EACvC,mEAAmE,EACnE,OAAO,EACP,oBAAoB,EACpB,qBAAqB,EACrB,sCAAsC,EACtC,iBAAiB,EACjB,6BAA6B,EAC7B,wCAAwC,CACzC;AAED,OAAO,MAAMC,QAAQ,GAAGF,GAAG,CAACG,MAAM,CAAC,CAAC,CACjCC,GAAG,CAAC,CAAC,CACLC,MAAM,CAAC,EAAE,CAAC,CACVC,QAAQ,CAAC,CAAC,CACVC,WAAW,CACV,iEACF,CAAC;AAEH,OAAO,MAAMC,WAAW,GAAGR,GAAG,CAACG,MAAM,CAAC,CAAC,CACpCM,GAAG,CAAC,GAAG,CAAC,CACRC,IAAI,CAAC,CAAC,CACNJ,QAAQ,CAAC,CAAC,CACVC,WAAW,CAAC,uCAAuC,CAAC;AAEvD,OAAO,MAAMI,UAAU,GAAGX,GAAG,CAACG,MAAM,CAAC,CAAC,CACnCS,OAAO,CAAC,cAAc,EAAE;EAAEC,IAAI,EAAE;AAAoC,CAAC,CAAC,CACtEP,QAAQ,CAAC,CAAC,CACVC,WAAW,CAAC,4CAA4C,CAAC;AAE5D,OAAO,MAAMO,kBAAkB,GAAGd,GAAG,CAACG,MAAM,CAAC,CAAC,CAC3CY,KAAK,CAAC,GAAGd,aAAa,CAAC,CACvBK,QAAQ,CAAC,CAAC,CACVC,WAAW,CAAC,6CAA6C,CAAC;AAE7D,OAAO,MAAMS,cAAc,GAAGhB,GAAG,CAACG,MAAM,CAAC,CAAC,CACvCM,GAAG,CA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EL,wBAAwB,CAAClD,WAAW,CAAC,0BAA0B,CAAC;EAC3EwD,SAAS,EAAErB,gBAAgB,CAACnC,WAAW,CACrC,oCACF,CAAC;EACDyD,SAAS,EAAEP,wBAAwB,CAAClD,WAAW,CAC7C,+BACF;AACF,CAAC,CAAC,CACDA,WAAW,CAAC,yDAAyD,CAAC;;AAEzE;AACA;AACA;AACA;AACA,OAAO,MAAM0D,kBAAkB,GAAGT,uBAAuB,CACtDU,MAAM,CAAe;EACpBR,EAAE,EAAExD,QAAQ;EACZiE,IAAI,EAAExD,UAAU;EAChByD,KAAK,EAAER,uBAAuB,CAACrD,WAAW,CACxC,gCACF,CAAC;EACD8D,IAAI,EAAET,uBAAuB,CAACrD,WAAW,CACvC,oCACF,CAAC;EACDsD,SAAS,EAAEnB,gBAAgB,CAACnC,WAAW,CAAC,iCAAiC,CAAC;EAC1EuD,SAAS,EAAEL,wBAAwB,CAAClD,WAAW,CAAC,sBAAsB,CAAC;EACvEwD,SAAS,EAAErB,gBAAgB,CAACnC,WAAW,CAAC,gCAAgC,CAAC;EACzEyD,SAAS,EAAEP,wBAAwB,CAAClD,WAAW,CAAC,2BAA2B;AAC7E,CAAC,CAAC,CACDA,WAAW,CACV,mFACF,CAAC","ignoreList":[]}
|
1
|
+
{"version":3,"file":"index.js","names":["Joi","organisations","idSchema","string","hex","length","required","description","titleSchema","max","trim","slugSchema","pattern","name","organisationSchema","valid","teamNameSchema","teamEmailSchema","email","tlds","allow","phoneSchema","emailAddressSchema","emailResponseTimeSchema","emailSchema","object","keys","address","responseTime","onlineUrlSchema","uri","scheme","onlineTextSchema","onlineSchema","url","text","contactSchema","phone","online","submissionGuidanceSchema","privacyNoticeUrlSchema","notificationEmailAddressSchema","authoredAtSchema","date","iso","authorIdSchema","authorDisplayNameSchema","formMetadataInputKeys","title","organisation","teamName","teamEmail","contact","submissionGuidance","privacyNoticeUrl","notificationEmail","formMetadataInputSchema","formMetadataAuthorSchema","id","displayName","formMetadataStateSchema","createdAt","createdBy","updatedAt","updatedBy","formMetadataSchema","append","slug","draft","live"],"sources":["../../../../src/form/form-metadata/index.ts"],"sourcesContent":["import Joi from 'joi'\n\nimport {\n type FormMetadata,\n type FormMetadataAuthor,\n type FormMetadataContact,\n type FormMetadataContactEmail,\n type FormMetadataContactOnline,\n type FormMetadataInput,\n type FormMetadataState\n} from '~/src/form/form-metadata/types.js'\n\nexport const organisations = [\n 'Animal and Plant Health Agency – APHA',\n 'Centre for Environment, Fisheries and Aquaculture Science – Cefas',\n 'Defra',\n 'Environment Agency',\n 'Forestry Commission',\n 'Marine Management Organisation – MMO',\n 'Natural England',\n 'Rural Payments Agency – RPA',\n 'Veterinary Medicines Directorate – VMD'\n]\n\nexport const idSchema = Joi.string()\n .hex()\n .length(24)\n .required()\n .description(\n 'Unique identifier for the form, 24-character hexadecimal string'\n )\n\nexport const titleSchema = Joi.string()\n .max(250)\n .trim()\n .required()\n .description('Title of the form, displayed to users')\n\nexport const slugSchema = Joi.string()\n .pattern(/^[a-z0-9-]+$/, { name: 'letters, numbers and hyphens only' })\n .required()\n .description('URL-friendly identifier used in form paths')\n\nexport const organisationSchema = Joi.string()\n .valid(...organisations)\n .required()\n .description('Defra organisation responsible for the form')\n\nexport const teamNameSchema = Joi.string()\n .max(100)\n .trim()\n .required()\n .description('Name of the team responsible for the form')\n\nexport const teamEmailSchema = Joi.string()\n .email({ tlds: { allow: ['uk'] } })\n .trim()\n .required()\n .description('Contact email for the team responsible for the form')\n\nexport const phoneSchema = Joi.string()\n .trim()\n .description('Phone number for form-related inquiries')\n\nexport const emailAddressSchema = Joi.string()\n .email()\n .trim()\n .required()\n .description('Email address for form-related inquiries')\n\nexport const emailResponseTimeSchema = Joi.string()\n .trim()\n .required()\n .description('Expected response time for email inquiries')\n\nexport const emailSchema = Joi.object<FormMetadataContactEmail>()\n .keys({\n address: emailAddressSchema,\n responseTime: emailResponseTimeSchema\n })\n .description('Email contact details including response expectations')\n\nexport const onlineUrlSchema = Joi.string()\n .uri({\n scheme: ['http', 'https']\n })\n .trim()\n .required()\n .description('URL for online contact method')\n\nexport const onlineTextSchema = Joi.string()\n .trim()\n .required()\n .description('Descriptive text for the online contact link')\n\nexport const onlineSchema = Joi.object<FormMetadataContactOnline>()\n .keys({\n url: onlineUrlSchema,\n text: onlineTextSchema\n })\n .description('Online contact details with URL and descriptive text')\n\nexport const contactSchema = Joi.object<FormMetadataContact>()\n .keys({\n phone: phoneSchema,\n email: emailSchema,\n online: onlineSchema\n })\n .description('Complete contact information for form-related inquiries')\n\nexport const submissionGuidanceSchema = Joi.string()\n .trim()\n .description('Guidance text shown to users when submitting the form')\n\nexport const privacyNoticeUrlSchema = Joi.string()\n .uri({\n scheme: ['http', 'https']\n })\n .trim()\n .description('URL to the privacy notice for this form')\n\nexport const notificationEmailAddressSchema = Joi.string()\n .email()\n .trim()\n .description('Email address to receive form submission notifications')\n\nexport const authoredAtSchema = Joi.date()\n .iso()\n .required()\n .description('ISO format timestamp of when an action occurred')\n\nexport const authorIdSchema = Joi.string()\n .trim()\n .required()\n .description('Unique identifier for the author')\n\nexport const authorDisplayNameSchema = Joi.string()\n .trim()\n .required()\n .description('Human-readable name of the author')\n\nexport const formMetadataInputKeys = {\n title: titleSchema,\n organisation: organisationSchema,\n teamName: teamNameSchema,\n teamEmail: teamEmailSchema,\n contact: contactSchema,\n submissionGuidance: submissionGuidanceSchema,\n privacyNoticeUrl: privacyNoticeUrlSchema,\n notificationEmail: notificationEmailAddressSchema\n}\n\n/**\n * Joi schema for `FormMetadataInput` interface\n * @see {@link FormMetadataInput}\n */\nexport const formMetadataInputSchema = Joi.object<FormMetadataInput>()\n .keys(formMetadataInputKeys)\n .required()\n .description('Input data for creating or updating form metadata')\n\n/**\n * Joi schema for `FormMetadataAuthor` interface\n * @see {@link FormMetadataAuthor}\n */\nexport const formMetadataAuthorSchema = Joi.object<FormMetadataAuthor>()\n .keys({\n id: authorIdSchema,\n displayName: authorDisplayNameSchema\n })\n .required()\n .description('Information about the author of a form or form change')\n\n/**\n * Joi schema for `FormMetadataState` interface\n * @see {@link FormMetadataState}\n */\nexport const formMetadataStateSchema = Joi.object<FormMetadataState>()\n .keys({\n createdAt: authoredAtSchema.description(\n 'When this version was first created'\n ),\n createdBy: formMetadataAuthorSchema.description('Who created this version'),\n updatedAt: authoredAtSchema.description(\n 'When this version was last updated'\n ),\n updatedBy: formMetadataAuthorSchema.description(\n 'Who last updated this version'\n )\n })\n .description('Metadata about a specific version state (draft or live)')\n\n/**\n * Joi schema for `FormMetadata` interface\n * @see {@link FormMetadata}\n */\nexport const formMetadataSchema = formMetadataInputSchema\n .append<FormMetadata>({\n id: idSchema,\n slug: slugSchema,\n draft: formMetadataStateSchema.description(\n 'Metadata for the draft version'\n ),\n live: formMetadataStateSchema.description(\n 'Metadata for the published version'\n ),\n createdAt: authoredAtSchema.description('When the form was first created'),\n createdBy: formMetadataAuthorSchema.description('Who created the form'),\n updatedAt: authoredAtSchema.description('When the form was last updated'),\n updatedBy: formMetadataAuthorSchema.description('Who last updated the form')\n })\n .description(\n 'Complete metadata for a form, including version information and authoring details'\n )\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,KAAK;AAYrB,OAAO,MAAMC,aAAa,GAAG,CAC3B,uCAAuC,EACvC,mEAAmE,EACnE,OAAO,EACP,oBAAoB,EACpB,qBAAqB,EACrB,sCAAsC,EACtC,iBAAiB,EACjB,6BAA6B,EAC7B,wCAAwC,CACzC;AAED,OAAO,MAAMC,QAAQ,GAAGF,GAAG,CAACG,MAAM,CAAC,CAAC,CACjCC,GAAG,CAAC,CAAC,CACLC,MAAM,CAAC,EAAE,CAAC,CACVC,QAAQ,CAAC,CAAC,CACVC,WAAW,CACV,iEACF,CAAC;AAEH,OAAO,MAAMC,WAAW,GAAGR,GAAG,CAACG,MAAM,CAAC,CAAC,CACpCM,GAAG,CAAC,GAAG,CAAC,CACRC,IAAI,CAAC,CAAC,CACNJ,QAAQ,CAAC,CAAC,CACVC,WAAW,CAAC,uCAAu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M,CAAqB,CAAC,CACrEC,IAAI,CAAC;EACJgC,EAAE,EAAEb,cAAc;EAClBc,WAAW,EAAEb;AACf,CAAC,CAAC,CACDxC,QAAQ,CAAC,CAAC,CACVC,WAAW,CAAC,uDAAuD,CAAC;;AAEvE;AACA;AACA;AACA;AACA,OAAO,MAAMqD,uBAAuB,GAAG5D,GAAG,CAACyB,MAAM,CAAoB,CAAC,CACnEC,IAAI,CAAC;EACJmC,SAAS,EAAEnB,gBAAgB,CAACnC,WAAW,CACrC,qCACF,CAAC;EACDuD,SAAS,EAAEL,wBAAwB,CAAClD,WAAW,CAAC,0BAA0B,CAAC;EAC3EwD,SAAS,EAAErB,gBAAgB,CAACnC,WAAW,CACrC,oCACF,CAAC;EACDyD,SAAS,EAAEP,wBAAwB,CAAClD,WAAW,CAC7C,+BACF;AACF,CAAC,CAAC,CACDA,WAAW,CAAC,yDAAyD,CAAC;;AAEzE;AACA;AACA;AACA;AACA,OAAO,MAAM0D,kBAAkB,GAAGT,uBAAuB,CACtDU,MAAM,CAAe;EACpBR,EAAE,EAAExD,QAAQ;EACZiE,IAAI,EAAExD,UAAU;EAChByD,KAAK,EAAER,uBAAuB,CAACrD,WAAW,CACxC,gCACF,CAAC;EACD8D,IAAI,EAAET,uBAAuB,CAACrD,WAAW,CACvC,oCACF,CAAC;EACDsD,SAAS,EAAEnB,gBAAgB,CAACnC,WAAW,CAAC,iCAAiC,CAAC;EAC1EuD,SAAS,EAAEL,wBAAwB,CAAClD,WAAW,CAAC,sBAAsB,CAAC;EACvEwD,SAAS,EAAErB,gBAAgB,CAACnC,WAAW,CAAC,gCAAgC,CAAC;EACzEyD,SAAS,EAAEP,wBAAwB,CAAClD,WAAW,CAAC,2BAA2B;AAC7E,CAAC,CAAC,CACDA,WAAW,CACV,mFACF,CAAC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","names":["findStartPage"],"sources":["../../../../src/form/utils/index.ts"],"sourcesContent":["export { findStartPage } from '~/src/form/utils/find-start-page.js'\n"],"mappings":"AAAA,SAASA,aAAa","ignoreList":[]}
|
1
|
+
{"version":3,"file":"index.js","names":["findStartPage","findDefinitionListFromComponent"],"sources":["../../../../src/form/utils/index.ts"],"sourcesContent":["export { findStartPage } from '~/src/form/utils/find-start-page.js'\nexport { findDefinitionListFromComponent } from '~/src/form/utils/list.js'\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,+BAA+B","ignoreList":[]}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/**
|
2
|
+
* Given a SelectionComponent finds the associated list
|
3
|
+
* @param {ListComponentsDef} selectionComponent
|
4
|
+
* @param {FormDefinition} definition
|
5
|
+
* @returns {List}
|
6
|
+
*/
|
7
|
+
export function findDefinitionListFromComponent(selectionComponent, definition) {
|
8
|
+
const listId = selectionComponent.list;
|
9
|
+
const list = definition.lists.find(list => list.id === listId);
|
10
|
+
if (list === undefined) {
|
11
|
+
throw new Error('List not found');
|
12
|
+
}
|
13
|
+
return list;
|
14
|
+
}
|
15
|
+
//# sourceMappingURL=list.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"list.js","names":["findDefinitionListFromComponent","selectionComponent","definition","listId","list","lists","find","id","undefined","Error"],"sources":["../../../../src/form/utils/list.ts"],"sourcesContent":["import { type ListComponentsDef } from '~/src/components/types.js'\nimport {\n type FormDefinition,\n type List\n} from '~/src/form/form-definition/types.js'\n\n/**\n * Given a SelectionComponent finds the associated list\n * @param {ListComponentsDef} selectionComponent\n * @param {FormDefinition} definition\n * @returns {List}\n */\nexport function findDefinitionListFromComponent(\n selectionComponent: ListComponentsDef,\n definition: FormDefinition\n): List {\n const listId = selectionComponent.list\n const list = definition.lists.find((list) => list.id === listId)\n\n if (list === undefined) {\n throw new Error('List not found')\n }\n\n return list\n}\n"],"mappings":"AAMA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,+BAA+BA,CAC7CC,kBAAqC,EACrCC,UAA0B,EACpB;EACN,MAAMC,MAAM,GAAGF,kBAAkB,CAACG,IAAI;EACtC,MAAMA,IAAI,GAAGF,UAAU,CAACG,KAAK,CAACC,IAAI,CAAEF,IAAI,IAAKA,IAAI,CAACG,EAAE,KAAKJ,MAAM,CAAC;EAEhE,IAAIC,IAAI,KAAKI,SAAS,EAAE;IACtB,MAAM,IAAIC,KAAK,CAAC,gBAAgB,CAAC;EACnC;EAEA,OAAOL,IAAI;AACb","ignoreList":[]}
|
package/dist/module/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from '~/src/common/enums.js'\nexport * from '~/src/common/random-id.js'\nexport * from '~/src/common/schema.js'\nexport * from '~/src/common/pagination/index.js'\nexport * from '~/src/common/search/index.js'\nexport * from '~/src/common/sorting/index.js'\nexport * from '~/src/components/index.js'\nexport * from '~/src/conditions/index.js'\nexport * from '~/src/form/form-definition/index.js'\nexport * from '~/src/form/form-definition/types.js'\nexport * from '~/src/form/form-metadata/index.js'\nexport * from '~/src/form/form-submission/index.js'\nexport * from '~/src/form/utils/index.js'\nexport * from '~/src/form/form-editor/index.js'\nexport * from '~/src/form/form-editor/preview/index.js'\nexport * from '~/src/form/form-manager/types.js'\nexport * from '~/src/pages/index.js'\nexport * from '~/src/utils/helpers.js'\nexport * from '~/src/utils/markdown.js'\n\nexport type * from '~/src/common/types.js'\nexport type * from '~/src/common/pagination/types.js'\nexport type * from '~/src/common/search/types.js'\nexport type * from '~/src/common/sorting/types.js'\nexport type * from '~/src/components/types.js'\nexport type * from '~/src/conditions/types.js'\nexport type * from '~/src/form/form-definition/types.js'\nexport type * from '~/src/form/form-metadata/types.js'\nexport type * from '~/src/form/form-submission/types.js'\nexport type * from '~/src/form/form-editor/preview/types.js'\nexport type * from '~/src/form/form-editor/types.js'\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from '~/src/common/enums.js'\nexport * from '~/src/common/random-id.js'\nexport * from '~/src/common/schema.js'\nexport * from '~/src/common/pagination/index.js'\nexport * from '~/src/common/search/index.js'\nexport * from '~/src/common/sorting/index.js'\nexport * from '~/src/components/index.js'\nexport * from '~/src/conditions/index.js'\nexport * from '~/src/form/form-definition/index.js'\nexport * from '~/src/form/form-definition/types.js'\nexport * from '~/src/form/form-metadata/index.js'\nexport * from '~/src/form/form-submission/index.js'\nexport * from '~/src/form/utils/index.js'\nexport * from '~/src/form/form-editor/index.js'\nexport * from '~/src/form/form-editor/preview/index.js'\nexport * from '~/src/form/form-manager/types.js'\nexport * from '~/src/pages/index.js'\nexport * from '~/src/utils/helpers.js'\nexport * from '~/src/utils/markdown.js'\n\nexport type * from '~/src/common/types.js'\nexport type * from '~/src/common/pagination/types.js'\nexport type * from '~/src/common/search/types.js'\nexport type * from '~/src/common/sorting/types.js'\nexport type * from '~/src/components/types.js'\nexport type * from '~/src/conditions/types.js'\nexport type * from '~/src/form/form-definition/types.js'\nexport type * from '~/src/form/form-metadata/types.js'\nexport type * from '~/src/form/form-submission/types.js'\nexport type * from '~/src/form/form-editor/preview/types.js'\nexport type * from '~/src/form/form-editor/types.js'\nexport type * from '~/src/form/form-editor/macros/types.js'\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
package/dist/module/stubs.js
CHANGED
@@ -10,4 +10,5 @@ export { buildRepeaterPage } from "./__stubs__/pages.js";
|
|
10
10
|
export { buildFileUploadPage } from "./__stubs__/pages.js";
|
11
11
|
export { buildSummaryPage } from "./__stubs__/pages.js";
|
12
12
|
export { buildQuestionPage } from "./__stubs__/pages.js";
|
13
|
+
export { buildMarkdownComponent } from "./__stubs__/components.js";
|
13
14
|
//# sourceMappingURL=stubs.js.map
|
package/dist/module/stubs.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"stubs.js","names":["buildList","buildListItem","buildCheckboxComponent","buildRadioComponent","buildAutoCompleteComponent","buildFileUploadComponent","buildTextFieldComponent","buildRepeaterPage","buildFileUploadPage","buildSummaryPage","buildQuestionPage"],"sources":["../../src/stubs.ts"],"sourcesContent":["export * from '~/src/__stubs__/form-definition.js'\nexport { buildList } from '~/src/__stubs__/components.js'\nexport { buildListItem } from '~/src/__stubs__/components.js'\nexport { buildCheckboxComponent } from '~/src/__stubs__/components.js'\nexport { buildRadioComponent } from '~/src/__stubs__/components.js'\nexport { buildAutoCompleteComponent } from '~/src/__stubs__/components.js'\nexport { buildFileUploadComponent } from '~/src/__stubs__/components.js'\nexport { buildTextFieldComponent } from '~/src/__stubs__/components.js'\nexport { buildRepeaterPage } from '~/src/__stubs__/pages.js'\nexport { buildFileUploadPage } from '~/src/__stubs__/pages.js'\nexport { buildSummaryPage } from '~/src/__stubs__/pages.js'\nexport { buildQuestionPage } from '~/src/__stubs__/pages.js'\n"],"mappings":"AAAA;AACA,SAASA,SAAS;AAClB,SAASC,aAAa;AACtB,SAASC,sBAAsB;AAC/B,SAASC,mBAAmB;AAC5B,SAASC,0BAA0B;AACnC,SAASC,wBAAwB;AACjC,SAASC,uBAAuB;AAChC,SAASC,iBAAiB;AAC1B,SAASC,mBAAmB;AAC5B,SAASC,gBAAgB;AACzB,SAASC,iBAAiB","ignoreList":[]}
|
1
|
+
{"version":3,"file":"stubs.js","names":["buildList","buildListItem","buildCheckboxComponent","buildRadioComponent","buildAutoCompleteComponent","buildFileUploadComponent","buildTextFieldComponent","buildRepeaterPage","buildFileUploadPage","buildSummaryPage","buildQuestionPage","buildMarkdownComponent"],"sources":["../../src/stubs.ts"],"sourcesContent":["export * from '~/src/__stubs__/form-definition.js'\nexport { buildList } from '~/src/__stubs__/components.js'\nexport { buildListItem } from '~/src/__stubs__/components.js'\nexport { buildCheckboxComponent } from '~/src/__stubs__/components.js'\nexport { buildRadioComponent } from '~/src/__stubs__/components.js'\nexport { buildAutoCompleteComponent } from '~/src/__stubs__/components.js'\nexport { buildFileUploadComponent } from '~/src/__stubs__/components.js'\nexport { buildTextFieldComponent } from '~/src/__stubs__/components.js'\nexport { buildRepeaterPage } from '~/src/__stubs__/pages.js'\nexport { buildFileUploadPage } from '~/src/__stubs__/pages.js'\nexport { buildSummaryPage } from '~/src/__stubs__/pages.js'\nexport { buildQuestionPage } from '~/src/__stubs__/pages.js'\nexport { buildMarkdownComponent } from '~/src/__stubs__/components.js'\n"],"mappings":"AAAA;AACA,SAASA,SAAS;AAClB,SAASC,aAAa;AACtB,SAASC,sBAAsB;AAC/B,SAASC,mBAAmB;AAC5B,SAASC,0BAA0B;AACnC,SAASC,wBAAwB;AACjC,SAASC,uBAAuB;AAChC,SAASC,iBAAiB;AAC1B,SAASC,mBAAmB;AAC5B,SAASC,gBAAgB;AACzB,SAASC,iBAAiB;AAC1B,SAASC,sBAAsB","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/form/form-definition/index.ts"],"names":[],"mappings":"AACA,OAAO,OAAkC,MAAM,KAAK,CAAA;AAIpD,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC9B,MAAM,2BAA2B,CAAA;AAElC,OAAO,EAEL,KAAK,eAAe,EAWrB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAGL,KAAK,kBAAkB,EAIvB,KAAK,cAAc,EAGnB,KAAK,IAAI,EACT,KAAK,IAAI,EAET,KAAK,MAAM,EAIZ,MAAM,qCAAqC,CAAA;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/form/form-definition/index.ts"],"names":[],"mappings":"AACA,OAAO,OAAkC,MAAM,KAAK,CAAA;AAIpD,OAAO,EACL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