@defra/forms-model 3.0.579 → 3.0.581
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/__stubs__/components.js +46 -0
- package/dist/module/__stubs__/components.js.map +1 -1
- package/dist/module/components/component-types.js +1 -1
- package/dist/module/components/component-types.js.map +1 -1
- package/dist/module/form/form-editor/__stubs__/preview.js +27 -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/easting-northing.js +42 -0
- package/dist/module/form/form-editor/preview/easting-northing.js.map +1 -0
- package/dist/module/form/form-editor/preview/helpers.js +26 -5
- package/dist/module/form/form-editor/preview/helpers.js.map +1 -1
- package/dist/module/form/form-editor/preview/index.js +4 -0
- package/dist/module/form/form-editor/preview/index.js.map +1 -1
- package/dist/module/form/form-editor/preview/lat-long.js +42 -0
- package/dist/module/form/form-editor/preview/lat-long.js.map +1 -0
- package/dist/module/form/form-editor/preview/location-helpers.js +44 -0
- package/dist/module/form/form-editor/preview/location-helpers.js.map +1 -0
- package/dist/module/form/form-editor/preview/location-question-base.js +62 -0
- package/dist/module/form/form-editor/preview/location-question-base.js.map +1 -0
- package/dist/module/form/form-editor/preview/national-grid.js +46 -0
- package/dist/module/form/form-editor/preview/national-grid.js.map +1 -0
- package/dist/module/form/form-editor/preview/os-grid-ref.js +46 -0
- package/dist/module/form/form-editor/preview/os-grid-ref.js.map +1 -0
- package/dist/module/form/form-editor/preview/types.js.map +1 -1
- package/dist/module/pages/helpers.js +11 -3
- package/dist/module/pages/helpers.js.map +1 -1
- package/dist/types/__stubs__/components.d.ts +5 -1
- package/dist/types/__stubs__/components.d.ts.map +1 -1
- package/dist/types/form/form-editor/__stubs__/preview.d.ts +18 -0
- 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 +50 -0
- package/dist/types/form/form-editor/macros/types.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/easting-northing.d.ts +17 -0
- package/dist/types/form/form-editor/preview/easting-northing.d.ts.map +1 -0
- package/dist/types/form/form-editor/preview/helpers.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/index.d.ts +4 -0
- package/dist/types/form/form-editor/preview/lat-long.d.ts +17 -0
- package/dist/types/form/form-editor/preview/lat-long.d.ts.map +1 -0
- package/dist/types/form/form-editor/preview/location-helpers.d.ts +23 -0
- package/dist/types/form/form-editor/preview/location-helpers.d.ts.map +1 -0
- package/dist/types/form/form-editor/preview/location-question-base.d.ts +43 -0
- package/dist/types/form/form-editor/preview/location-question-base.d.ts.map +1 -0
- package/dist/types/form/form-editor/preview/national-grid.d.ts +17 -0
- package/dist/types/form/form-editor/preview/national-grid.d.ts.map +1 -0
- package/dist/types/form/form-editor/preview/os-grid-ref.d.ts +17 -0
- package/dist/types/form/form-editor/preview/os-grid-ref.d.ts.map +1 -0
- package/dist/types/form/form-editor/preview/types.d.ts +21 -2
- package/dist/types/form/form-editor/preview/types.d.ts.map +1 -1
- package/dist/types/pages/helpers.d.ts +1 -0
- package/dist/types/pages/helpers.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/__stubs__/components.ts +62 -0
- package/src/components/component-types.ts +1 -1
- package/src/form/form-editor/__stubs__/preview.js +24 -1
- package/src/form/form-editor/index.ts +1 -0
- package/src/form/form-editor/macros/types.ts +54 -0
- package/src/form/form-editor/preview/easting-northing.js +55 -0
- package/src/form/form-editor/preview/helpers.js +40 -5
- package/src/form/form-editor/preview/index.js +4 -0
- package/src/form/form-editor/preview/lat-long.js +55 -0
- package/src/form/form-editor/preview/location-helpers.js +49 -0
- package/src/form/form-editor/preview/location-question-base.js +65 -0
- package/src/form/form-editor/preview/national-grid.js +56 -0
- package/src/form/form-editor/preview/os-grid-ref.js +56 -0
- package/src/form/form-editor/preview/types.ts +24 -2
- package/src/pages/helpers.ts +14 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"easting-northing.js","names":["ComponentType","createFieldClasses","createLocationFieldModel","LocationQuestion","LocationQuestionComponentPreviewElements","PreviewComponent","EastingNorthingComponentPreviewElements","EastingNorthingQuestion","componentType","EastingNorthingField","_questionTemplate","PATH","_fieldName","_renderInput","baseModel","locationModel","_htmlElements","_highlight","_instructionText","titleText","easting","northing"],"sources":["../../../../../src/form/form-editor/preview/easting-northing.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport {\n createFieldClasses,\n createLocationFieldModel\n} from '~/src/form/form-editor/preview/location-helpers.js'\nimport {\n LocationQuestion,\n LocationQuestionComponentPreviewElements\n} from '~/src/form/form-editor/preview/location-question-base.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n\n/**\n * @implements {QuestionElements}\n */\nexport class EastingNorthingComponentPreviewElements extends LocationQuestionComponentPreviewElements {}\n\nexport class EastingNorthingQuestion extends LocationQuestion {\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.EastingNorthingField\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = PreviewComponent.PATH + 'eastingnorthingfield.njk'\n _fieldName = 'EastingNorthingField'\n\n /**\n * @protected\n * @returns {EastingNorthingModel}\n */\n _renderInput() {\n const baseModel = super._renderInput()\n const locationModel = createLocationFieldModel(\n baseModel,\n /** @type {LocationElements} */ (this._htmlElements),\n this._highlight,\n this._instructionText,\n this.titleText\n )\n\n return {\n ...locationModel,\n easting: createFieldClasses('easting', this._highlight),\n northing: createFieldClasses('northing', this._highlight)\n }\n }\n}\n\n/**\n * @import { LocationSettings, LocationElements, QuestionElements, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { EastingNorthingModel } from '~/src/form/form-editor/macros/types.js'\n * @import { EastingNorthingFieldComponent } from '~/src/components/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SACEC,kBAAkB,EAClBC,wBAAwB;AAE1B,SACEC,gBAAgB,EAChBC,wCAAwC;AAE1C,SAASC,gBAAgB;;AAEzB;AACA;AACA;AACA,OAAO,MAAMC,uCAAuC,SAASF,wCAAwC,CAAC;AAEtG,OAAO,MAAMG,uBAAuB,SAASJ,gBAAgB,CAAC;EAC5D;AACF;AACA;EACEK,aAAa,GAAGR,aAAa,CAACS,oBAAoB;EAClD;AACF;AACA;AACA;EACEC,iBAAiB,GAAGL,gBAAgB,CAACM,IAAI,GAAG,0BAA0B;EACtEC,UAAU,GAAG,sBAAsB;;EAEnC;AACF;AACA;AACA;EACEC,YAAYA,CAAA,EAAG;IACb,MAAMC,SAAS,GAAG,KAAK,CAACD,YAAY,CAAC,CAAC;IACtC,MAAME,aAAa,GAAGb,wBAAwB,CAC5CY,SAAS,EACT,+BAAiC,IAAI,CAACE,aAAa,EACnD,IAAI,CAACC,UAAU,EACf,IAAI,CAACC,gBAAgB,EACrB,IAAI,CAACC,SACP,CAAC;IAED,OAAO;MACL,GAAGJ,aAAa;MAChBK,OAAO,EAAEnB,kBAAkB,CAAC,SAAS,EAAE,IAAI,CAACgB,UAAU,CAAC;MACvDI,QAAQ,EAAEpB,kBAAkB,CAAC,UAAU,EAAE,IAAI,CAACgB,UAAU;IAC1D,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -6,12 +6,16 @@ import { ComponentElements } from "./component-elements.js";
|
|
|
6
6
|
import { ContentElements } from "./content.js";
|
|
7
7
|
import { DateInputQuestion } from "./date-input.js";
|
|
8
8
|
import { DeclarationComponentPreviewElements, DeclarationQuestion } from "./declaration.js";
|
|
9
|
+
import { EastingNorthingComponentPreviewElements, EastingNorthingQuestion } from "./easting-northing.js";
|
|
9
10
|
import { EmailAddressQuestion } from "./email-address.js";
|
|
11
|
+
import { LatLongComponentPreviewElements, LatLongQuestion } from "./lat-long.js";
|
|
10
12
|
import { ListComponentElements, ListQuestion, SelectComponentElements } from "./list.js";
|
|
11
13
|
import { LongAnswerQuestion } from "./long-answer.js";
|
|
12
14
|
import { Markdown } from "./markdown.js";
|
|
13
15
|
import { MonthYearQuestion } from "./month-year.js";
|
|
16
|
+
import { NationalGridComponentPreviewElements, NationalGridQuestion } from "./national-grid.js";
|
|
14
17
|
import { NumberComponentPreviewElements, NumberOnlyQuestion } from "./number-only.js";
|
|
18
|
+
import { OsGridRefComponentPreviewElements, OsGridRefQuestion } from "./os-grid-ref.js";
|
|
15
19
|
import { PhoneNumberQuestion } from "./phone-number.js";
|
|
16
20
|
import { QuestionComponentElements } from "./question.js";
|
|
17
21
|
import { RadioQuestion } from "./radio.js";
|
|
@@ -45,10 +49,10 @@ const InputFieldComponentDictionary = {
|
|
|
45
49
|
[ComponentType.YesNoField]: YesNoQuestion,
|
|
46
50
|
[ComponentType.DeclarationField]: DeclarationQuestion,
|
|
47
51
|
[ComponentType.FileUploadField]: SupportingEvidenceQuestion,
|
|
48
|
-
[ComponentType.EastingNorthingField]:
|
|
49
|
-
[ComponentType.OsGridRefField]:
|
|
50
|
-
[ComponentType.NationalGridFieldNumberField]:
|
|
51
|
-
[ComponentType.LatLongField]:
|
|
52
|
+
[ComponentType.EastingNorthingField]: EastingNorthingQuestion,
|
|
53
|
+
[ComponentType.OsGridRefField]: OsGridRefQuestion,
|
|
54
|
+
[ComponentType.NationalGridFieldNumberField]: NationalGridQuestion,
|
|
55
|
+
[ComponentType.LatLongField]: LatLongQuestion
|
|
52
56
|
};
|
|
53
57
|
|
|
54
58
|
/**
|
|
@@ -82,6 +86,23 @@ const ComponentToPreviewQuestion = {
|
|
|
82
86
|
[ComponentType.YesNoField]: (component, _definition) => {
|
|
83
87
|
const componentCoerced = /** @type {YesNoFieldComponent} */component;
|
|
84
88
|
return new QuestionComponentElements(componentCoerced);
|
|
89
|
+
},
|
|
90
|
+
[ComponentType.EastingNorthingField]: (component, _definition) => {
|
|
91
|
+
const componentCoerced = /** @type {EastingNorthingFieldComponent} */
|
|
92
|
+
component;
|
|
93
|
+
return new EastingNorthingComponentPreviewElements(componentCoerced);
|
|
94
|
+
},
|
|
95
|
+
[ComponentType.OsGridRefField]: (component, _definition) => {
|
|
96
|
+
const componentCoerced = /** @type {OsGridRefFieldComponent} */component;
|
|
97
|
+
return new OsGridRefComponentPreviewElements(componentCoerced);
|
|
98
|
+
},
|
|
99
|
+
[ComponentType.NationalGridFieldNumberField]: (component, _definition) => {
|
|
100
|
+
const componentCoerced = /** @type {NationalGridFieldNumberFieldComponent} */component;
|
|
101
|
+
return new NationalGridComponentPreviewElements(componentCoerced);
|
|
102
|
+
},
|
|
103
|
+
[ComponentType.LatLongField]: (component, _definition) => {
|
|
104
|
+
const componentCoerced = /** @type {LatLongFieldComponent} */component;
|
|
105
|
+
return new LatLongComponentPreviewElements(componentCoerced);
|
|
85
106
|
}
|
|
86
107
|
};
|
|
87
108
|
|
|
@@ -123,6 +144,6 @@ export function mapComponentToPreviewQuestion(questionRenderer, definition) {
|
|
|
123
144
|
* @import { Question } from '~/src/form/form-editor/preview/question.js'
|
|
124
145
|
* @import { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'
|
|
125
146
|
* @import { FormDefinition } from '~/src/form/form-definition/types.js'
|
|
126
|
-
* @import { AutocompleteFieldComponent, ComponentDef, DeclarationFieldComponent, NumberFieldComponent, SelectFieldComponent, UkAddressFieldComponent, YesNoFieldComponent } from '~/src/components/types.js'
|
|
147
|
+
* @import { AutocompleteFieldComponent, ComponentDef, DeclarationFieldComponent, EastingNorthingFieldComponent, LatLongFieldComponent, NationalGridFieldNumberFieldComponent, NumberFieldComponent, OsGridRefFieldComponent, SelectFieldComponent, UkAddressFieldComponent, YesNoFieldComponent } from '~/src/components/types.js'
|
|
127
148
|
*/
|
|
128
149
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","names":["ComponentType","hasContentField","hasInputField","hasListField","hasSelectionFields","AutocompleteListQuestion","CheckboxQuestion","ComponentElements","ContentElements","DateInputQuestion","DeclarationComponentPreviewElements","DeclarationQuestion","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","DeclarationField","FileUploadField","EastingNorthingField","OsGridRefField","NationalGridFieldNumberField","LatLongField","ComponentToPreviewQuestion","component","definition","componentCoerced","list","_definition","mapComponentToPreviewQuestion","questionRenderer","questionElements","getQuestionElementsFunc","type","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 {\n DeclarationComponentPreviewElements,\n DeclarationQuestion\n} from '~/src/form/form-editor/preview/declaration.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.DeclarationField]: DeclarationQuestion,\n [ComponentType.FileUploadField]: SupportingEvidenceQuestion,\n [ComponentType.EastingNorthingField]: ShortAnswerQuestion,\n [ComponentType.OsGridRefField]: ShortAnswerQuestion,\n [ComponentType.NationalGridFieldNumberField]: ShortAnswerQuestion,\n [ComponentType.LatLongField]: ShortAnswerQuestion\n}\n\n/**\n * @type {Partial<Record<ComponentType, (component: ComponentDef, definition: FormDefinition ) => QuestionElements>>}\n */\nconst ComponentToPreviewQuestion = {\n [ComponentType.AutocompleteField]: (component, definition) => {\n const componentCoerced = /** @type {AutocompleteFieldComponent} */ (\n component\n )\n const list = findDefinitionListFromComponent(componentCoerced, definition)\n return new SelectComponentElements(componentCoerced, list)\n },\n [ComponentType.SelectField]: (component, definition) => {\n const componentCoerced = /** @type {SelectFieldComponent} */ (component)\n const list = findDefinitionListFromComponent(componentCoerced, definition)\n return new SelectComponentElements(componentCoerced, list)\n },\n [ComponentType.UkAddressField]: (component, _definition) => {\n const componentCoerced = /** @type {UkAddressFieldComponent} */ (component)\n return new UkAddressComponentPreviewElements(componentCoerced)\n },\n [ComponentType.NumberField]: (component, _definition) => {\n const componentCoerced = /** @type {NumberFieldComponent} */ (component)\n return new NumberComponentPreviewElements(componentCoerced)\n },\n [ComponentType.DeclarationField]: (component, _definition) => {\n const componentCoerced = /** @type {DeclarationFieldComponent} */ (\n component\n )\n return new DeclarationComponentPreviewElements(componentCoerced)\n },\n [ComponentType.YesNoField]: (component, _definition) => {\n const componentCoerced = /** @type {YesNoFieldComponent} */ (component)\n return new QuestionComponentElements(componentCoerced)\n }\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 // Look for one-to-one mapping first, then fallback if not found\n const getQuestionElementsFunc = ComponentToPreviewQuestion[component.type]\n if (getQuestionElementsFunc) {\n questionElements = getQuestionElementsFunc(component, definition)\n } else if (hasSelectionFields(component) && hasListField(component)) {\n const list = findDefinitionListFromComponent(component, definition)\n questionElements = new ListComponentElements(component, list)\n } else if (hasInputField(component)) {\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 { AutocompleteFieldComponent, ComponentDef, DeclarationFieldComponent, NumberFieldComponent, SelectFieldComponent, UkAddressFieldComponent, YesNoFieldComponent } 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,SACEC,mCAAmC,EACnCC,mBAAmB;AAErB,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,EACjCC,iBAAiB;AAEnB,SAASC,aAAa;AACtB,SAASC,+BAA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
|
+
{"version":3,"file":"helpers.js","names":["ComponentType","hasContentField","hasInputField","hasListField","hasSelectionFields","AutocompleteListQuestion","CheckboxQuestion","ComponentElements","ContentElements","DateInputQuestion","DeclarationComponentPreviewElements","DeclarationQuestion","EastingNorthingComponentPreviewElements","EastingNorthingQuestion","EmailAddressQuestion","LatLongComponentPreviewElements","LatLongQuestion","ListComponentElements","ListQuestion","SelectComponentElements","LongAnswerQuestion","Markdown","MonthYearQuestion","NationalGridComponentPreviewElements","NationalGridQuestion","NumberComponentPreviewElements","NumberOnlyQuestion","OsGridRefComponentPreviewElements","OsGridRefQuestion","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","DeclarationField","FileUploadField","EastingNorthingField","OsGridRefField","NationalGridFieldNumberField","LatLongField","ComponentToPreviewQuestion","component","definition","componentCoerced","list","_definition","mapComponentToPreviewQuestion","questionRenderer","questionElements","getQuestionElementsFunc","type","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 {\n DeclarationComponentPreviewElements,\n DeclarationQuestion\n} from '~/src/form/form-editor/preview/declaration.js'\nimport {\n EastingNorthingComponentPreviewElements,\n EastingNorthingQuestion\n} from '~/src/form/form-editor/preview/easting-northing.js'\nimport { EmailAddressQuestion } from '~/src/form/form-editor/preview/email-address.js'\nimport {\n LatLongComponentPreviewElements,\n LatLongQuestion\n} from '~/src/form/form-editor/preview/lat-long.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 NationalGridComponentPreviewElements,\n NationalGridQuestion\n} from '~/src/form/form-editor/preview/national-grid.js'\nimport {\n NumberComponentPreviewElements,\n NumberOnlyQuestion\n} from '~/src/form/form-editor/preview/number-only.js'\nimport {\n OsGridRefComponentPreviewElements,\n OsGridRefQuestion\n} from '~/src/form/form-editor/preview/os-grid-ref.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.DeclarationField]: DeclarationQuestion,\n [ComponentType.FileUploadField]: SupportingEvidenceQuestion,\n [ComponentType.EastingNorthingField]: EastingNorthingQuestion,\n [ComponentType.OsGridRefField]: OsGridRefQuestion,\n [ComponentType.NationalGridFieldNumberField]: NationalGridQuestion,\n [ComponentType.LatLongField]: LatLongQuestion\n}\n\n/**\n * @type {Partial<Record<ComponentType, (component: ComponentDef, definition: FormDefinition ) => QuestionElements>>}\n */\nconst ComponentToPreviewQuestion = {\n [ComponentType.AutocompleteField]: (component, definition) => {\n const componentCoerced = /** @type {AutocompleteFieldComponent} */ (\n component\n )\n const list = findDefinitionListFromComponent(componentCoerced, definition)\n return new SelectComponentElements(componentCoerced, list)\n },\n [ComponentType.SelectField]: (component, definition) => {\n const componentCoerced = /** @type {SelectFieldComponent} */ (component)\n const list = findDefinitionListFromComponent(componentCoerced, definition)\n return new SelectComponentElements(componentCoerced, list)\n },\n [ComponentType.UkAddressField]: (component, _definition) => {\n const componentCoerced = /** @type {UkAddressFieldComponent} */ (component)\n return new UkAddressComponentPreviewElements(componentCoerced)\n },\n [ComponentType.NumberField]: (component, _definition) => {\n const componentCoerced = /** @type {NumberFieldComponent} */ (component)\n return new NumberComponentPreviewElements(componentCoerced)\n },\n [ComponentType.DeclarationField]: (component, _definition) => {\n const componentCoerced = /** @type {DeclarationFieldComponent} */ (\n component\n )\n return new DeclarationComponentPreviewElements(componentCoerced)\n },\n [ComponentType.YesNoField]: (component, _definition) => {\n const componentCoerced = /** @type {YesNoFieldComponent} */ (component)\n return new QuestionComponentElements(componentCoerced)\n },\n [ComponentType.EastingNorthingField]: (component, _definition) => {\n const componentCoerced = /** @type {EastingNorthingFieldComponent} */ (\n component\n )\n return new EastingNorthingComponentPreviewElements(componentCoerced)\n },\n [ComponentType.OsGridRefField]: (component, _definition) => {\n const componentCoerced = /** @type {OsGridRefFieldComponent} */ (component)\n return new OsGridRefComponentPreviewElements(componentCoerced)\n },\n [ComponentType.NationalGridFieldNumberField]: (component, _definition) => {\n const componentCoerced =\n /** @type {NationalGridFieldNumberFieldComponent} */ (component)\n return new NationalGridComponentPreviewElements(componentCoerced)\n },\n [ComponentType.LatLongField]: (component, _definition) => {\n const componentCoerced = /** @type {LatLongFieldComponent} */ (component)\n return new LatLongComponentPreviewElements(componentCoerced)\n }\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 // Look for one-to-one mapping first, then fallback if not found\n const getQuestionElementsFunc = ComponentToPreviewQuestion[component.type]\n if (getQuestionElementsFunc) {\n questionElements = getQuestionElementsFunc(component, definition)\n } else if (hasSelectionFields(component) && hasListField(component)) {\n const list = findDefinitionListFromComponent(component, definition)\n questionElements = new ListComponentElements(component, list)\n } else if (hasInputField(component)) {\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 { AutocompleteFieldComponent, ComponentDef, DeclarationFieldComponent, EastingNorthingFieldComponent, LatLongFieldComponent, NationalGridFieldNumberFieldComponent, NumberFieldComponent, OsGridRefFieldComponent, SelectFieldComponent, UkAddressFieldComponent, YesNoFieldComponent } 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,SACEC,mCAAmC,EACnCC,mBAAmB;AAErB,SACEC,uCAAuC,EACvCC,uBAAuB;AAEzB,SAASC,oBAAoB;AAC7B,SACEC,+BAA+B,EAC/BC,eAAe;AAEjB,SACEC,qBAAqB,EACrBC,YAAY,EACZC,uBAAuB;AAEzB,SAASC,kBAAkB;AAC3B,SAASC,QAAQ;AACjB,SAASC,iBAAiB;AAC1B,SACEC,oCAAoC,EACpCC,oBAAoB;AAEtB,SACEC,8BAA8B,EAC9BC,kBAAkB;AAEpB,SACEC,iCAAiC,EACjCC,iBAAiB;AAEnB,SAASC,mBAAmB;AAC5B,SAASC,yBAAyB;AAClC,SAASC,aAAa;AACtB,SAASC,cAAc;AACvB,SAASC,mBAAmB;AAC5B,SAASC,0BAA0B;AACnC,SACEC,iCAAiC,EACjCC,iBAAiB;AAEnB,SAASC,aAAa;AACtB,SAASC,+BAA+B;AACxC;AACA;AACA;AACA,MAAMC,6BAA6B,GAAG;EACpC,CAACvC,aAAa,CAACwC,SAAS,GAAGP,mBAAmB;EAC9C,C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C/D,CAAC,MAAM,IAAIjE,aAAa,CAAC8D,SAAS,CAAC,EAAE;MACnCO,gBAAgB,GAAG,IAAIzC,yBAAyB,CAACkC,SAAS,CAAC;IAC7D,CAAC,MAAM,IAAI/D,eAAe,CAAC+D,SAAS,CAAC,EAAE;MACrCO,gBAAgB,GAAG,IAAI/D,eAAe,CAACwD,SAAS,CAAC;IACnD,CAAC,MAAM;MACLO,gBAAgB,GAAG,IAAIhE,iBAAiB,CAACyD,SAAS,CAAC;IACrD;IAEA,MAAMU,mBAAmB,GAAGnC,6BAA6B,CAACyB,SAAS,CAACS,IAAI,CAAC;IAEzE,MAAME,gBAAgB,GAAG,IAAID,mBAAmB,CAC9CH,gBAAgB,EAChBD,gBACF,CAAC;IACDK,gBAAgB,CAACC,EAAE,GAAGZ,SAAS,CAACY,EAAE;IAClC,OAAOD,gBAAgB;EACzB,CAAC;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -3,12 +3,16 @@ export * from "./checkbox.js";
|
|
|
3
3
|
export * from "./checkbox-sortable.js";
|
|
4
4
|
export * from "./date-input.js";
|
|
5
5
|
export * from "./declaration.js";
|
|
6
|
+
export * from "./easting-northing.js";
|
|
6
7
|
export * from "./email-address.js";
|
|
8
|
+
export * from "./lat-long.js";
|
|
7
9
|
export * from "./list.js";
|
|
8
10
|
export * from "./list-sortable.js";
|
|
9
11
|
export * from "./markdown.js";
|
|
10
12
|
export * from "./month-year.js";
|
|
13
|
+
export * from "./national-grid.js";
|
|
11
14
|
export * from "./number-only.js";
|
|
15
|
+
export * from "./os-grid-ref.js";
|
|
12
16
|
export * from "./phone-number.js";
|
|
13
17
|
export * from "./question.js";
|
|
14
18
|
export * from "./radio.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../../src/form/form-editor/preview/index.js"],"sourcesContent":["export * from '~/src/form/form-editor/preview/autocomplete.js'\nexport * from '~/src/form/form-editor/preview/checkbox.js'\nexport * from '~/src/form/form-editor/preview/checkbox-sortable.js'\nexport * from '~/src/form/form-editor/preview/date-input.js'\nexport * from '~/src/form/form-editor/preview/declaration.js'\nexport * from '~/src/form/form-editor/preview/email-address.js'\nexport * from '~/src/form/form-editor/preview/list.js'\nexport * from '~/src/form/form-editor/preview/list-sortable.js'\nexport * from '~/src/form/form-editor/preview/markdown.js'\nexport * from '~/src/form/form-editor/preview/month-year.js'\nexport * from '~/src/form/form-editor/preview/number-only.js'\nexport * from '~/src/form/form-editor/preview/phone-number.js'\nexport * from '~/src/form/form-editor/preview/question.js'\nexport * from '~/src/form/form-editor/preview/radio.js'\nexport * from '~/src/form/form-editor/preview/radio-sortable.js'\nexport * from '~/src/form/form-editor/preview/select-sortable.js'\nexport * from '~/src/form/form-editor/preview/short-answer.js'\nexport * from '~/src/form/form-editor/preview/select.js'\nexport * from '~/src/form/form-editor/preview/select-sortable.js'\nexport * from '~/src/form/form-editor/preview/supporting-evidence.js'\nexport * from '~/src/form/form-editor/preview/long-answer.js'\nexport * from '~/src/form/form-editor/preview/uk-address.js'\nexport * from '~/src/form/form-editor/preview/yes-no.js'\nexport * from '~/src/form/form-editor/preview/controller/page-controller-base.js'\nexport * from '~/src/form/form-editor/preview/controller/page-controller.js'\nexport * from '~/src/form/form-editor/preview/controller/guidance-page-controller.js'\nexport * from '~/src/form/form-editor/preview/controller/summary-page-controller.js'\nexport * from '~/src/form/form-editor/preview/controller/reorder-questions-page-controller.js'\nexport * from '~/src/form/form-editor/preview/controller/page-controller-base.js'\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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/form/form-editor/preview/index.js"],"sourcesContent":["export * from '~/src/form/form-editor/preview/autocomplete.js'\nexport * from '~/src/form/form-editor/preview/checkbox.js'\nexport * from '~/src/form/form-editor/preview/checkbox-sortable.js'\nexport * from '~/src/form/form-editor/preview/date-input.js'\nexport * from '~/src/form/form-editor/preview/declaration.js'\nexport * from '~/src/form/form-editor/preview/easting-northing.js'\nexport * from '~/src/form/form-editor/preview/email-address.js'\nexport * from '~/src/form/form-editor/preview/lat-long.js'\nexport * from '~/src/form/form-editor/preview/list.js'\nexport * from '~/src/form/form-editor/preview/list-sortable.js'\nexport * from '~/src/form/form-editor/preview/markdown.js'\nexport * from '~/src/form/form-editor/preview/month-year.js'\nexport * from '~/src/form/form-editor/preview/national-grid.js'\nexport * from '~/src/form/form-editor/preview/number-only.js'\nexport * from '~/src/form/form-editor/preview/os-grid-ref.js'\nexport * from '~/src/form/form-editor/preview/phone-number.js'\nexport * from '~/src/form/form-editor/preview/question.js'\nexport * from '~/src/form/form-editor/preview/radio.js'\nexport * from '~/src/form/form-editor/preview/radio-sortable.js'\nexport * from '~/src/form/form-editor/preview/select-sortable.js'\nexport * from '~/src/form/form-editor/preview/short-answer.js'\nexport * from '~/src/form/form-editor/preview/select.js'\nexport * from '~/src/form/form-editor/preview/select-sortable.js'\nexport * from '~/src/form/form-editor/preview/supporting-evidence.js'\nexport * from '~/src/form/form-editor/preview/long-answer.js'\nexport * from '~/src/form/form-editor/preview/uk-address.js'\nexport * from '~/src/form/form-editor/preview/yes-no.js'\nexport * from '~/src/form/form-editor/preview/controller/page-controller-base.js'\nexport * from '~/src/form/form-editor/preview/controller/page-controller.js'\nexport * from '~/src/form/form-editor/preview/controller/guidance-page-controller.js'\nexport * from '~/src/form/form-editor/preview/controller/summary-page-controller.js'\nexport * from '~/src/form/form-editor/preview/controller/reorder-questions-page-controller.js'\nexport * from '~/src/form/form-editor/preview/controller/page-controller-base.js'\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ComponentType } from "../../../components/enums.js";
|
|
2
|
+
import { createFieldClasses, createLocationFieldModel } from "./location-helpers.js";
|
|
3
|
+
import { LocationQuestion, LocationQuestionComponentPreviewElements } from "./location-question-base.js";
|
|
4
|
+
import { PreviewComponent } from "./preview.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @implements {QuestionElements}
|
|
8
|
+
*/
|
|
9
|
+
export class LatLongComponentPreviewElements extends LocationQuestionComponentPreviewElements {}
|
|
10
|
+
export class LatLongQuestion extends LocationQuestion {
|
|
11
|
+
/**
|
|
12
|
+
* @type {ComponentType}
|
|
13
|
+
*/
|
|
14
|
+
componentType = ComponentType.LatLongField;
|
|
15
|
+
/**
|
|
16
|
+
* @type {string}
|
|
17
|
+
* @protected
|
|
18
|
+
*/
|
|
19
|
+
_questionTemplate = PreviewComponent.PATH + 'latlongfield.njk';
|
|
20
|
+
_fieldName = 'LatLongField';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @protected
|
|
24
|
+
* @returns {LatLongModel}
|
|
25
|
+
*/
|
|
26
|
+
_renderInput() {
|
|
27
|
+
const baseModel = super._renderInput();
|
|
28
|
+
const locationModel = createLocationFieldModel(baseModel, /** @type {LocationElements} */this._htmlElements, this._highlight, this._instructionText, this.titleText);
|
|
29
|
+
return {
|
|
30
|
+
...locationModel,
|
|
31
|
+
latitude: createFieldClasses('latitude', this._highlight),
|
|
32
|
+
longitude: createFieldClasses('longitude', this._highlight)
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @import { LocationSettings, LocationElements, QuestionElements, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'
|
|
39
|
+
* @import { LatLongModel } from '~/src/form/form-editor/macros/types.js'
|
|
40
|
+
* @import { LatLongFieldComponent } from '~/src/components/types.js'
|
|
41
|
+
*/
|
|
42
|
+
//# sourceMappingURL=lat-long.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lat-long.js","names":["ComponentType","createFieldClasses","createLocationFieldModel","LocationQuestion","LocationQuestionComponentPreviewElements","PreviewComponent","LatLongComponentPreviewElements","LatLongQuestion","componentType","LatLongField","_questionTemplate","PATH","_fieldName","_renderInput","baseModel","locationModel","_htmlElements","_highlight","_instructionText","titleText","latitude","longitude"],"sources":["../../../../../src/form/form-editor/preview/lat-long.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport {\n createFieldClasses,\n createLocationFieldModel\n} from '~/src/form/form-editor/preview/location-helpers.js'\nimport {\n LocationQuestion,\n LocationQuestionComponentPreviewElements\n} from '~/src/form/form-editor/preview/location-question-base.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n\n/**\n * @implements {QuestionElements}\n */\nexport class LatLongComponentPreviewElements extends LocationQuestionComponentPreviewElements {}\n\nexport class LatLongQuestion extends LocationQuestion {\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.LatLongField\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = PreviewComponent.PATH + 'latlongfield.njk'\n _fieldName = 'LatLongField'\n\n /**\n * @protected\n * @returns {LatLongModel}\n */\n _renderInput() {\n const baseModel = super._renderInput()\n const locationModel = createLocationFieldModel(\n baseModel,\n /** @type {LocationElements} */ (this._htmlElements),\n this._highlight,\n this._instructionText,\n this.titleText\n )\n\n return {\n ...locationModel,\n latitude: createFieldClasses('latitude', this._highlight),\n longitude: createFieldClasses('longitude', this._highlight)\n }\n }\n}\n\n/**\n * @import { LocationSettings, LocationElements, QuestionElements, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { LatLongModel } from '~/src/form/form-editor/macros/types.js'\n * @import { LatLongFieldComponent } from '~/src/components/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SACEC,kBAAkB,EAClBC,wBAAwB;AAE1B,SACEC,gBAAgB,EAChBC,wCAAwC;AAE1C,SAASC,gBAAgB;;AAEzB;AACA;AACA;AACA,OAAO,MAAMC,+BAA+B,SAASF,wCAAwC,CAAC;AAE9F,OAAO,MAAMG,eAAe,SAASJ,gBAAgB,CAAC;EACpD;AACF;AACA;EACEK,aAAa,GAAGR,aAAa,CAACS,YAAY;EAC1C;AACF;AACA;AACA;EACEC,iBAAiB,GAAGL,gBAAgB,CAACM,IAAI,GAAG,kBAAkB;EAC9DC,UAAU,GAAG,cAAc;;EAE3B;AACF;AACA;AACA;EACEC,YAAYA,CAAA,EAAG;IACb,MAAMC,SAAS,GAAG,KAAK,CAACD,YAAY,CAAC,CAAC;IACtC,MAAME,aAAa,GAAGb,wBAAwB,CAC5CY,SAAS,EACT,+BAAiC,IAAI,CAACE,aAAa,EACnD,IAAI,CAACC,UAAU,EACf,IAAI,CAACC,gBAAgB,EACrB,IAAI,CAACC,SACP,CAAC;IAED,OAAO;MACL,GAAGJ,aAAa;MAChBK,QAAQ,EAAEnB,kBAAkB,CAAC,UAAU,EAAE,IAAI,CAACgB,UAAU,CAAC;MACzDI,SAAS,EAAEpB,kBAAkB,CAAC,WAAW,EAAE,IAAI,CAACgB,UAAU;IAC5D,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { HIGHLIGHT_CLASS } from "./constants.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates the standard location field model with common properties
|
|
5
|
+
* @param {QuestionBaseModel} baseModel - The base model from super._renderInput()
|
|
6
|
+
* @param {LocationElements} htmlElements - The HTML elements containing values
|
|
7
|
+
* @param {string | null} highlight - The currently highlighted element
|
|
8
|
+
* @param {string} instructionText - The instruction text to display
|
|
9
|
+
* @param {string} titleText - The title text including optional suffix
|
|
10
|
+
* @returns {LocationFieldModel}
|
|
11
|
+
*/
|
|
12
|
+
export function createLocationFieldModel(baseModel, htmlElements, highlight, instructionText, titleText) {
|
|
13
|
+
return {
|
|
14
|
+
...baseModel,
|
|
15
|
+
userClasses: htmlElements.values.userClasses,
|
|
16
|
+
fieldset: {
|
|
17
|
+
legend: {
|
|
18
|
+
text: titleText,
|
|
19
|
+
classes: highlight === 'question' ? HIGHLIGHT_CLASS : ''
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
instructionText,
|
|
23
|
+
details: {
|
|
24
|
+
classes: highlight === 'instructionText' ? HIGHLIGHT_CLASS : ''
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Creates field classes with highlight if needed
|
|
31
|
+
* @param {string} fieldName - The name of the field
|
|
32
|
+
* @param {string | null} highlight - The currently highlighted element
|
|
33
|
+
* @returns {{classes: string}}
|
|
34
|
+
*/
|
|
35
|
+
export function createFieldClasses(fieldName, highlight) {
|
|
36
|
+
return {
|
|
37
|
+
classes: highlight === fieldName ? HIGHLIGHT_CLASS : ''
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @import { LocationElements, QuestionBaseModel, LocationFieldModel } from '~/src/form/form-editor/preview/types.js'
|
|
43
|
+
*/
|
|
44
|
+
//# sourceMappingURL=location-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"location-helpers.js","names":["HIGHLIGHT_CLASS","createLocationFieldModel","baseModel","htmlElements","highlight","instructionText","titleText","userClasses","values","fieldset","legend","text","classes","details","createFieldClasses","fieldName"],"sources":["../../../../../src/form/form-editor/preview/location-helpers.js"],"sourcesContent":["import { HIGHLIGHT_CLASS } from '~/src/form/form-editor/preview/constants.js'\n\n/**\n * Creates the standard location field model with common properties\n * @param {QuestionBaseModel} baseModel - The base model from super._renderInput()\n * @param {LocationElements} htmlElements - The HTML elements containing values\n * @param {string | null} highlight - The currently highlighted element\n * @param {string} instructionText - The instruction text to display\n * @param {string} titleText - The title text including optional suffix\n * @returns {LocationFieldModel}\n */\nexport function createLocationFieldModel(\n baseModel,\n htmlElements,\n highlight,\n instructionText,\n titleText\n) {\n return {\n ...baseModel,\n userClasses: htmlElements.values.userClasses,\n fieldset: {\n legend: {\n text: titleText,\n classes: highlight === 'question' ? HIGHLIGHT_CLASS : ''\n }\n },\n instructionText,\n details: {\n classes: highlight === 'instructionText' ? HIGHLIGHT_CLASS : ''\n }\n }\n}\n\n/**\n * Creates field classes with highlight if needed\n * @param {string} fieldName - The name of the field\n * @param {string | null} highlight - The currently highlighted element\n * @returns {{classes: string}}\n */\nexport function createFieldClasses(fieldName, highlight) {\n return {\n classes: highlight === fieldName ? HIGHLIGHT_CLASS : ''\n }\n}\n\n/**\n * @import { LocationElements, QuestionBaseModel, LocationFieldModel } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SAASA,eAAe;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,wBAAwBA,CACtCC,SAAS,EACTC,YAAY,EACZC,SAAS,EACTC,eAAe,EACfC,SAAS,EACT;EACA,OAAO;IACL,GAAGJ,SAAS;IACZK,WAAW,EAAEJ,YAAY,CAACK,MAAM,CAACD,WAAW;IAC5CE,QAAQ,EAAE;MACRC,MAAM,EAAE;QACNC,IAAI,EAAEL,SAAS;QACfM,OAAO,EAAER,SAAS,KAAK,UAAU,GAAGJ,eAAe,GAAG;MACxD;IACF,CAAC;IACDK,eAAe;IACfQ,OAAO,EAAE;MACPD,OAAO,EAAER,SAAS,KAAK,iBAAiB,GAAGJ,eAAe,GAAG;IAC/D;EACF,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASc,kBAAkBA,CAACC,SAAS,EAAEX,SAAS,EAAE;EACvD,OAAO;IACLQ,OAAO,EAAER,SAAS,KAAKW,SAAS,GAAGf,eAAe,GAAG;EACvD,CAAC;AACH;;AAEA;AACA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Question, QuestionComponentElements } from "./question.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Base class for location question component preview elements with instruction text support
|
|
5
|
+
* @implements {QuestionElements}
|
|
6
|
+
*/
|
|
7
|
+
export class LocationQuestionComponentPreviewElements extends QuestionComponentElements {
|
|
8
|
+
/**
|
|
9
|
+
* @param {any} component - Component with options.instructionText
|
|
10
|
+
*/
|
|
11
|
+
constructor(component) {
|
|
12
|
+
super(component);
|
|
13
|
+
this._instructionText = component.options.instructionText ?? '';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @protected
|
|
18
|
+
* @returns {LocationSettings}
|
|
19
|
+
*/
|
|
20
|
+
_getValues() {
|
|
21
|
+
return {
|
|
22
|
+
...super._getValues(),
|
|
23
|
+
instructionText: this._instructionText
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Base class for location questions with instruction text support
|
|
30
|
+
*/
|
|
31
|
+
export class LocationQuestion extends Question {
|
|
32
|
+
/**
|
|
33
|
+
* @type {string}
|
|
34
|
+
* @protected
|
|
35
|
+
*/
|
|
36
|
+
_instructionText = '';
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @param {LocationElements} htmlElements
|
|
40
|
+
* @param {QuestionRenderer} questionRenderer
|
|
41
|
+
*/
|
|
42
|
+
constructor(htmlElements, questionRenderer) {
|
|
43
|
+
super(htmlElements, questionRenderer);
|
|
44
|
+
this._instructionText = htmlElements.values.instructionText;
|
|
45
|
+
}
|
|
46
|
+
get instructionText() {
|
|
47
|
+
return this._instructionText;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @param {string} val
|
|
52
|
+
*/
|
|
53
|
+
set instructionText(val) {
|
|
54
|
+
this._instructionText = val;
|
|
55
|
+
this.render();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @import { LocationSettings, LocationElements, QuestionElements, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'
|
|
61
|
+
*/
|
|
62
|
+
//# sourceMappingURL=location-question-base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"location-question-base.js","names":["Question","QuestionComponentElements","LocationQuestionComponentPreviewElements","constructor","component","_instructionText","options","instructionText","_getValues","LocationQuestion","htmlElements","questionRenderer","values","val","render"],"sources":["../../../../../src/form/form-editor/preview/location-question-base.js"],"sourcesContent":["import {\n Question,\n QuestionComponentElements\n} from '~/src/form/form-editor/preview/question.js'\n\n/**\n * Base class for location question component preview elements with instruction text support\n * @implements {QuestionElements}\n */\nexport class LocationQuestionComponentPreviewElements extends QuestionComponentElements {\n /**\n * @param {any} component - Component with options.instructionText\n */\n constructor(component) {\n super(component)\n this._instructionText = component.options.instructionText ?? ''\n }\n\n /**\n * @protected\n * @returns {LocationSettings}\n */\n _getValues() {\n return {\n ...super._getValues(),\n instructionText: this._instructionText\n }\n }\n}\n\n/**\n * Base class for location questions with instruction text support\n */\nexport class LocationQuestion extends Question {\n /**\n * @type {string}\n * @protected\n */\n _instructionText = ''\n\n /**\n * @param {LocationElements} htmlElements\n * @param {QuestionRenderer} questionRenderer\n */\n constructor(htmlElements, questionRenderer) {\n super(htmlElements, questionRenderer)\n this._instructionText = htmlElements.values.instructionText\n }\n\n get instructionText() {\n return this._instructionText\n }\n\n /**\n * @param {string} val\n */\n set instructionText(val) {\n this._instructionText = val\n this.render()\n }\n}\n\n/**\n * @import { LocationSettings, LocationElements, QuestionElements, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SACEA,QAAQ,EACRC,yBAAyB;;AAG3B;AACA;AACA;AACA;AACA,OAAO,MAAMC,wCAAwC,SAASD,yBAAyB,CAAC;EACtF;AACF;AACA;EACEE,WAAWA,CAACC,SAAS,EAAE;IACrB,KAAK,CAACA,SAAS,CAAC;IAChB,IAAI,CAACC,gBAAgB,GAAGD,SAAS,CAACE,OAAO,CAACC,eAAe,IAAI,EAAE;EACjE;;EAEA;AACF;AACA;AACA;EACEC,UAAUA,CAAA,EAAG;IACX,OAAO;MACL,GAAG,KAAK,CAACA,UAAU,CAAC,CAAC;MACrBD,eAAe,EAAE,IAAI,CAACF;IACxB,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA,OAAO,MAAMI,gBAAgB,SAAST,QAAQ,CAAC;EAC7C;AACF;AACA;AACA;EACEK,gBAAgB,GAAG,EAAE;;EAErB;AACF;AACA;AACA;EACEF,WAAWA,CAACO,YAAY,EAAEC,gBAAgB,EAAE;IAC1C,KAAK,CAACD,YAAY,EAAEC,gBAAgB,CAAC;IACrC,IAAI,CAACN,gBAAgB,GAAGK,YAAY,CAACE,MAAM,CAACL,eAAe;EAC7D;EAEA,IAAIA,eAAeA,CAAA,EAAG;IACpB,OAAO,IAAI,CAACF,gBAAgB;EAC9B;;EAEA;AACF;AACA;EACE,IAAIE,eAAeA,CAACM,GAAG,EAAE;IACvB,IAAI,CAACR,gBAAgB,GAAGQ,GAAG;IAC3B,IAAI,CAACC,MAAM,CAAC,CAAC;EACf;AACF;;AAEA;AACA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ComponentType } from "../../../components/enums.js";
|
|
2
|
+
import { HIGHLIGHT_CLASS } from "./constants.js";
|
|
3
|
+
import { createLocationFieldModel } from "./location-helpers.js";
|
|
4
|
+
import { LocationQuestion, LocationQuestionComponentPreviewElements } from "./location-question-base.js";
|
|
5
|
+
import { PreviewComponent } from "./preview.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @implements {QuestionElements}
|
|
9
|
+
*/
|
|
10
|
+
export class NationalGridComponentPreviewElements extends LocationQuestionComponentPreviewElements {}
|
|
11
|
+
export class NationalGridQuestion extends LocationQuestion {
|
|
12
|
+
/**
|
|
13
|
+
* @type {ComponentType}
|
|
14
|
+
*/
|
|
15
|
+
componentType = ComponentType.NationalGridFieldNumberField;
|
|
16
|
+
/**
|
|
17
|
+
* @type {string}
|
|
18
|
+
* @protected
|
|
19
|
+
*/
|
|
20
|
+
_questionTemplate = PreviewComponent.PATH + 'nationalgridfieldnumberfield.njk';
|
|
21
|
+
_fieldName = 'NationalGridFieldNumberField';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @protected
|
|
25
|
+
* @returns {NationalGridModel}
|
|
26
|
+
*/
|
|
27
|
+
_renderInput() {
|
|
28
|
+
const baseModel = super._renderInput();
|
|
29
|
+
const locationModel = createLocationFieldModel(baseModel, /** @type {LocationElements} */this._htmlElements, this._highlight, this._instructionText, this.titleText);
|
|
30
|
+
return {
|
|
31
|
+
...locationModel,
|
|
32
|
+
label: {
|
|
33
|
+
text: this.titleText,
|
|
34
|
+
classes: this._highlight === 'question' ? HIGHLIGHT_CLASS : ''
|
|
35
|
+
},
|
|
36
|
+
inputClasses: this._highlight === 'input' ? HIGHLIGHT_CLASS : ''
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @import { LocationSettings, LocationElements, QuestionElements, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'
|
|
43
|
+
* @import { NationalGridModel } from '~/src/form/form-editor/macros/types.js'
|
|
44
|
+
* @import { NationalGridFieldNumberFieldComponent } from '~/src/components/types.js'
|
|
45
|
+
*/
|
|
46
|
+
//# sourceMappingURL=national-grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"national-grid.js","names":["ComponentType","HIGHLIGHT_CLASS","createLocationFieldModel","LocationQuestion","LocationQuestionComponentPreviewElements","PreviewComponent","NationalGridComponentPreviewElements","NationalGridQuestion","componentType","NationalGridFieldNumberField","_questionTemplate","PATH","_fieldName","_renderInput","baseModel","locationModel","_htmlElements","_highlight","_instructionText","titleText","label","text","classes","inputClasses"],"sources":["../../../../../src/form/form-editor/preview/national-grid.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { HIGHLIGHT_CLASS } from '~/src/form/form-editor/preview/constants.js'\nimport { createLocationFieldModel } from '~/src/form/form-editor/preview/location-helpers.js'\nimport {\n LocationQuestion,\n LocationQuestionComponentPreviewElements\n} from '~/src/form/form-editor/preview/location-question-base.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n\n/**\n * @implements {QuestionElements}\n */\nexport class NationalGridComponentPreviewElements extends LocationQuestionComponentPreviewElements {}\n\nexport class NationalGridQuestion extends LocationQuestion {\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.NationalGridFieldNumberField\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = PreviewComponent.PATH + 'nationalgridfieldnumberfield.njk'\n _fieldName = 'NationalGridFieldNumberField'\n\n /**\n * @protected\n * @returns {NationalGridModel}\n */\n _renderInput() {\n const baseModel = super._renderInput()\n const locationModel = createLocationFieldModel(\n baseModel,\n /** @type {LocationElements} */ (this._htmlElements),\n this._highlight,\n this._instructionText,\n this.titleText\n )\n\n return {\n ...locationModel,\n label: {\n text: this.titleText,\n classes: this._highlight === 'question' ? HIGHLIGHT_CLASS : ''\n },\n inputClasses: this._highlight === 'input' ? HIGHLIGHT_CLASS : ''\n }\n }\n}\n\n/**\n * @import { LocationSettings, LocationElements, QuestionElements, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { NationalGridModel } from '~/src/form/form-editor/macros/types.js'\n * @import { NationalGridFieldNumberFieldComponent } from '~/src/components/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,eAAe;AACxB,SAASC,wBAAwB;AACjC,SACEC,gBAAgB,EAChBC,wCAAwC;AAE1C,SAASC,gBAAgB;;AAEzB;AACA;AACA;AACA,OAAO,MAAMC,oCAAoC,SAASF,wCAAwC,CAAC;AAEnG,OAAO,MAAMG,oBAAoB,SAASJ,gBAAgB,CAAC;EACzD;AACF;AACA;EACEK,aAAa,GAAGR,aAAa,CAACS,4BAA4B;EAC1D;AACF;AACA;AACA;EACEC,iBAAiB,GAAGL,gBAAgB,CAACM,IAAI,GAAG,kCAAkC;EAC9EC,UAAU,GAAG,8BAA8B;;EAE3C;AACF;AACA;AACA;EACEC,YAAYA,CAAA,EAAG;IACb,MAAMC,SAAS,GAAG,KAAK,CAACD,YAAY,CAAC,CAAC;IACtC,MAAME,aAAa,GAAGb,wBAAwB,CAC5CY,SAAS,EACT,+BAAiC,IAAI,CAACE,aAAa,EACnD,IAAI,CAACC,UAAU,EACf,IAAI,CAACC,gBAAgB,EACrB,IAAI,CAACC,SACP,CAAC;IAED,OAAO;MACL,GAAGJ,aAAa;MAChBK,KAAK,EAAE;QACLC,IAAI,EAAE,IAAI,CAACF,SAAS;QACpBG,OAAO,EAAE,IAAI,CAACL,UAAU,KAAK,UAAU,GAAGhB,eAAe,GAAG;MAC9D,CAAC;MACDsB,YAAY,EAAE,IAAI,CAACN,UAAU,KAAK,OAAO,GAAGhB,eAAe,GAAG;IAChE,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ComponentType } from "../../../components/enums.js";
|
|
2
|
+
import { HIGHLIGHT_CLASS } from "./constants.js";
|
|
3
|
+
import { createLocationFieldModel } from "./location-helpers.js";
|
|
4
|
+
import { LocationQuestion, LocationQuestionComponentPreviewElements } from "./location-question-base.js";
|
|
5
|
+
import { PreviewComponent } from "./preview.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @implements {QuestionElements}
|
|
9
|
+
*/
|
|
10
|
+
export class OsGridRefComponentPreviewElements extends LocationQuestionComponentPreviewElements {}
|
|
11
|
+
export class OsGridRefQuestion extends LocationQuestion {
|
|
12
|
+
/**
|
|
13
|
+
* @type {ComponentType}
|
|
14
|
+
*/
|
|
15
|
+
componentType = ComponentType.OsGridRefField;
|
|
16
|
+
/**
|
|
17
|
+
* @type {string}
|
|
18
|
+
* @protected
|
|
19
|
+
*/
|
|
20
|
+
_questionTemplate = PreviewComponent.PATH + 'osgridreffield.njk';
|
|
21
|
+
_fieldName = 'OsGridRefField';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @protected
|
|
25
|
+
* @returns {OsGridRefModel}
|
|
26
|
+
*/
|
|
27
|
+
_renderInput() {
|
|
28
|
+
const baseModel = super._renderInput();
|
|
29
|
+
const locationModel = createLocationFieldModel(baseModel, /** @type {LocationElements} */this._htmlElements, this._highlight, this._instructionText, this.titleText);
|
|
30
|
+
return {
|
|
31
|
+
...locationModel,
|
|
32
|
+
label: {
|
|
33
|
+
text: this.titleText,
|
|
34
|
+
classes: this._highlight === 'question' ? HIGHLIGHT_CLASS : ''
|
|
35
|
+
},
|
|
36
|
+
inputClasses: this._highlight === 'input' ? HIGHLIGHT_CLASS : ''
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @import { LocationSettings, LocationElements, QuestionElements, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'
|
|
43
|
+
* @import { OsGridRefModel } from '~/src/form/form-editor/macros/types.js'
|
|
44
|
+
* @import { OsGridRefFieldComponent } from '~/src/components/types.js'
|
|
45
|
+
*/
|
|
46
|
+
//# sourceMappingURL=os-grid-ref.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"os-grid-ref.js","names":["ComponentType","HIGHLIGHT_CLASS","createLocationFieldModel","LocationQuestion","LocationQuestionComponentPreviewElements","PreviewComponent","OsGridRefComponentPreviewElements","OsGridRefQuestion","componentType","OsGridRefField","_questionTemplate","PATH","_fieldName","_renderInput","baseModel","locationModel","_htmlElements","_highlight","_instructionText","titleText","label","text","classes","inputClasses"],"sources":["../../../../../src/form/form-editor/preview/os-grid-ref.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { HIGHLIGHT_CLASS } from '~/src/form/form-editor/preview/constants.js'\nimport { createLocationFieldModel } from '~/src/form/form-editor/preview/location-helpers.js'\nimport {\n LocationQuestion,\n LocationQuestionComponentPreviewElements\n} from '~/src/form/form-editor/preview/location-question-base.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n\n/**\n * @implements {QuestionElements}\n */\nexport class OsGridRefComponentPreviewElements extends LocationQuestionComponentPreviewElements {}\n\nexport class OsGridRefQuestion extends LocationQuestion {\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.OsGridRefField\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = PreviewComponent.PATH + 'osgridreffield.njk'\n _fieldName = 'OsGridRefField'\n\n /**\n * @protected\n * @returns {OsGridRefModel}\n */\n _renderInput() {\n const baseModel = super._renderInput()\n const locationModel = createLocationFieldModel(\n baseModel,\n /** @type {LocationElements} */ (this._htmlElements),\n this._highlight,\n this._instructionText,\n this.titleText\n )\n\n return {\n ...locationModel,\n label: {\n text: this.titleText,\n classes: this._highlight === 'question' ? HIGHLIGHT_CLASS : ''\n },\n inputClasses: this._highlight === 'input' ? HIGHLIGHT_CLASS : ''\n }\n }\n}\n\n/**\n * @import { LocationSettings, LocationElements, QuestionElements, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { OsGridRefModel } from '~/src/form/form-editor/macros/types.js'\n * @import { OsGridRefFieldComponent } from '~/src/components/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,eAAe;AACxB,SAASC,wBAAwB;AACjC,SACEC,gBAAgB,EAChBC,wCAAwC;AAE1C,SAASC,gBAAgB;;AAEzB;AACA;AACA;AACA,OAAO,MAAMC,iCAAiC,SAASF,wCAAwC,CAAC;AAEhG,OAAO,MAAMG,iBAAiB,SAASJ,gBAAgB,CAAC;EACtD;AACF;AACA;EACEK,aAAa,GAAGR,aAAa,CAACS,cAAc;EAC5C;AACF;AACA;AACA;EACEC,iBAAiB,GAAGL,gBAAgB,CAACM,IAAI,GAAG,oBAAoB;EAChEC,UAAU,GAAG,gBAAgB;;EAE7B;AACF;AACA;AACA;EACEC,YAAYA,CAAA,EAAG;IACb,MAAMC,SAAS,GAAG,KAAK,CAACD,YAAY,CAAC,CAAC;IACtC,MAAME,aAAa,GAAGb,wBAAwB,CAC5CY,SAAS,EACT,+BAAiC,IAAI,CAACE,aAAa,EACnD,IAAI,CAACC,UAAU,EACf,IAAI,CAACC,gBAAgB,EACrB,IAAI,CAACC,SACP,CAAC;IAED,OAAO;MACL,GAAGJ,aAAa;MAChBK,KAAK,EAAE;QACLC,IAAI,EAAE,IAAI,CAACF,SAAS;QACpBG,OAAO,EAAE,IAAI,CAACL,UAAU,KAAK,UAAU,GAAGhB,eAAe,GAAG;MAC9D,CAAC;MACDsB,YAAY,EAAE,IAAI,CAACN,UAAU,KAAK,OAAO,GAAGhB,eAAe,GAAG;IAChE,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
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 userClasses: string\n items: ListElement[]\n content: string\n attributes?: Record<string, string>\n}\n\nexport interface DefaultComponent {\n id?: string\n text: string\n classes: string\n isPageHeading?: boolean\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 DomElementsBase {\n readonly values?: BaseSettings\n autocompleteOptions?: string\n setPreviewHTML(value: string): void\n setPreviewDOM(element: HTMLElement): void\n}\n\nexport interface QuestionElements extends DomElementsBase {\n readonly values: BaseSettings\n}\n\nexport interface AutocompleteElements extends QuestionElements {\n autocompleteOptions: string\n}\n\nexport interface NumberSettings extends BaseSettings {\n prefix: string\n suffix: string\n}\n\nexport interface DeclarationSettings extends BaseSettings {\n declarationText: string\n}\n\nexport interface DeclarationElements extends DomElementsBase {\n readonly values: DeclarationSettings\n}\n\nexport interface UkAddressSettings extends BaseSettings {\n usePostcodeLookup?: boolean\n}\n\nexport interface UkAddressElements extends DomElementsBase {\n readonly values: UkAddressSettings\n}\n\nexport interface NumberElements extends DomElementsBase {\n readonly values: NumberSettings\n}\n\nexport interface RenderBase {\n render(questionTemplate: string, renderContext: RenderContext): void\n}\n\nexport interface QuestionRenderContext {\n model: QuestionBaseModel\n}\n\nexport interface PageRenderContext {\n params: PagePreviewPanelMacro\n}\n\nexport type RenderContext = QuestionRenderContext | PageRenderContext\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 type Renderer = QuestionRenderer | PageRenderer\n\nexport interface ListElements extends QuestionElements {\n afterInputsHTML: string\n}\n\nexport interface PagePreviewBaseElements {\n heading: string\n guidance: string\n}\n\nexport interface PageOverviewElements extends PagePreviewBaseElements {\n addHeading: boolean\n repeatQuestion: string | undefined\n hasRepeater: boolean\n}\n\nexport interface SummaryPageElements extends PagePreviewBaseElements {\n declaration: boolean\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
|
+
{"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 userClasses: string\n items: ListElement[]\n content: string\n attributes?: Record<string, string>\n}\n\nexport interface DefaultComponent {\n id?: string\n text: string\n classes: string\n isPageHeading?: boolean\n}\n\nexport interface GovukFieldset {\n legend: DefaultComponent\n}\n\nexport type ListenerRow = [\n HTMLInputElement | HTMLTextAreaElement | null,\n (target: HTMLInputElement | HTMLTextAreaElement, e: Event) => void,\n keyof HTMLElementEventMap\n]\n\nexport interface DomElementsBase {\n readonly values?: BaseSettings\n autocompleteOptions?: string\n setPreviewHTML(value: string): void\n setPreviewDOM(element: HTMLElement): void\n}\n\nexport interface QuestionElements extends DomElementsBase {\n readonly values: BaseSettings\n}\n\nexport interface AutocompleteElements extends QuestionElements {\n autocompleteOptions: string\n}\n\nexport interface NumberSettings extends BaseSettings {\n prefix: string\n suffix: string\n}\n\nexport interface DeclarationSettings extends BaseSettings {\n declarationText: string\n}\n\nexport interface DeclarationElements extends DomElementsBase {\n readonly values: DeclarationSettings\n}\n\nexport interface UkAddressSettings extends BaseSettings {\n usePostcodeLookup?: boolean\n}\n\nexport interface UkAddressElements extends DomElementsBase {\n readonly values: UkAddressSettings\n}\n\nexport interface NumberElements extends DomElementsBase {\n readonly values: NumberSettings\n}\n\nexport interface LocationSettings extends BaseSettings {\n instructionText: string\n}\n\nexport interface LocationElements extends DomElementsBase {\n readonly values: LocationSettings\n}\n\nexport interface LocationFieldModel extends QuestionBaseModel {\n userClasses: string\n fieldset: {\n legend: {\n text: string\n classes: string\n }\n }\n instructionText: string\n details: {\n classes: string\n }\n}\n\nexport interface RenderBase {\n render(questionTemplate: string, renderContext: RenderContext): void\n}\n\nexport interface QuestionRenderContext {\n model: QuestionBaseModel\n}\n\nexport interface PageRenderContext {\n params: PagePreviewPanelMacro\n}\n\nexport type RenderContext = QuestionRenderContext | PageRenderContext\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 type Renderer = QuestionRenderer | PageRenderer\n\nexport interface ListElements extends QuestionElements {\n afterInputsHTML: string\n}\n\nexport interface PagePreviewBaseElements {\n heading: string\n guidance: string\n}\n\nexport interface PageOverviewElements extends PagePreviewBaseElements {\n addHeading: boolean\n repeatQuestion: string | undefined\n hasRepeater: boolean\n}\n\nexport interface SummaryPageElements extends PagePreviewBaseElements {\n declaration: boolean\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,5 +1,5 @@
|
|
|
1
1
|
import { ComponentType } from "../components/enums.js";
|
|
2
|
-
import { hasFormField } from "../components/helpers.js";
|
|
2
|
+
import { hasFormField, isFormType } from "../components/helpers.js";
|
|
3
3
|
import { ControllerNames, ControllerTypes } from "./controller-types.js";
|
|
4
4
|
import { ControllerType } from "./enums.js";
|
|
5
5
|
import { PageTypes } from "./page-types.js";
|
|
@@ -80,13 +80,21 @@ export function controllerNameFromPath(nameOrPath) {
|
|
|
80
80
|
export function includesFileUploadField(components) {
|
|
81
81
|
return components.some(component => component.type === ComponentType.FileUploadField);
|
|
82
82
|
}
|
|
83
|
+
export function onlyDeclarationComponents(components) {
|
|
84
|
+
return components.filter(comp => isFormType(comp.type)).every(component => component.type === ComponentType.DeclarationField);
|
|
85
|
+
}
|
|
83
86
|
const SHOW_REPEATER_CONTROLLERS = [ControllerType.Page, ControllerType.Repeat];
|
|
84
87
|
export function showRepeaterSettings(page) {
|
|
85
88
|
if (page.controller && !SHOW_REPEATER_CONTROLLERS.includes(page.controller)) {
|
|
86
89
|
return false;
|
|
87
90
|
}
|
|
88
|
-
if (hasComponents(page)
|
|
89
|
-
|
|
91
|
+
if (hasComponents(page)) {
|
|
92
|
+
if (includesFileUploadField(page.components)) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
if (onlyDeclarationComponents(page.components)) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
90
98
|
}
|
|
91
99
|
return true;
|
|
92
100
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","names":["ComponentType","hasFormField","ControllerNames","ControllerTypes","ControllerType","PageTypes","getPageDefaults","page","nameOrPath","controller","Page","controllerNameFromPath","defaults","find","pageType","Error","structuredClone","hasComponents","hasNext","Array","isArray","components","hasComponentsEvenIfNoNext","undefined","hasFormComponents","Start","hasRepeater","Repeat","isControllerName","map","String","includes","Terminal","FileUpload","options","path","name","includesFileUploadField","some","component","type","FileUploadField","SHOW_REPEATER_CONTROLLERS","showRepeaterSettings","getPageTitle","title","firstComp","getPageFromDefinition","definition","pageId","pages","x","id","summaryPageControllers","Summary","SummaryWithConfirmationEmail","isSummaryPage"],"sources":["../../../src/pages/helpers.ts"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { hasFormField } from '~/src/components/helpers.js'\nimport { type ComponentDef } from '~/src/components/types.js'\nimport {\n type Link,\n type Page,\n type PageFileUpload,\n type PageQuestion,\n type PageRepeat\n} from '~/src/form/form-definition/types.js'\nimport { type FormDefinition } from '~/src/index.js'\nimport {\n ControllerNames,\n ControllerTypes\n} from '~/src/pages/controller-types.js'\nimport { ControllerType } from '~/src/pages/enums.js'\nimport { PageTypes } from '~/src/pages/page-types.js'\n\n/**\n * Return component defaults by type\n */\nexport function getPageDefaults<PageType extends Page>(\n page?: Pick<PageType, 'controller'>\n) {\n const nameOrPath = page?.controller ?? ControllerType.Page\n const controller = controllerNameFromPath(nameOrPath)\n\n const defaults = PageTypes.find(\n (pageType) => pageType.controller === controller\n )\n\n if (!defaults) {\n throw new Error(`Defaults not found for page type '${nameOrPath}'`)\n }\n\n return structuredClone(defaults) as PageType\n}\n\n/**\n * Check page has components\n */\nexport function hasComponents(\n page?: Partial<Page>\n): page is Extract<Page, { components: ComponentDef[] }> {\n return hasNext(page) && Array.isArray(page.components)\n}\n\n/**\n * Check if the page has components (the page can be any page type e.g. SummaryPage)\n */\nexport function hasComponentsEvenIfNoNext(\n page?: Partial<Page>\n): page is Extract<Page, { components: ComponentDef[] }> {\n return (\n page !== undefined && 'components' in page && Array.isArray(page.components)\n )\n}\n\n/**\n * Check page has form components\n */\nexport function hasFormComponents(\n page?: Partial<Page>\n): page is PageQuestion | PageFileUpload {\n const controller = controllerNameFromPath(page?.controller)\n return hasComponents(page) && controller !== ControllerType.Start\n}\n\n/**\n * Check page has repeater\n */\nexport function hasRepeater(page?: Partial<Page>): page is PageRepeat {\n return controllerNameFromPath(page?.controller) === ControllerType.Repeat\n}\n\n/**\n * Check for known page controller names\n */\nexport function isControllerName(\n nameOrPath?: ControllerType | string\n): nameOrPath is ControllerType {\n return !!nameOrPath && ControllerNames.map(String).includes(nameOrPath)\n}\n\n/**\n * Check page has next link\n */\nexport function hasNext(\n page?: Partial<Page>\n): page is Extract<Page, { next: Link[] }> {\n if (!page || !('next' in page)) {\n return false\n }\n\n const controller = controllerNameFromPath(page.controller)\n\n return (\n !controller ||\n controller === ControllerType.Start ||\n controller === ControllerType.Page ||\n controller === ControllerType.Terminal ||\n controller === ControllerType.FileUpload ||\n controller === ControllerType.Repeat\n )\n}\n\n/**\n * Check and optionally replace legacy path with controller name\n * @param {string} [nameOrPath] - Controller name or legacy controller path\n */\nexport function controllerNameFromPath(nameOrPath?: ControllerType | string) {\n if (isControllerName(nameOrPath)) {\n return nameOrPath\n }\n\n const options = ControllerTypes.find(({ path }) => path === nameOrPath)\n return options?.name\n}\n\nexport function includesFileUploadField(components: ComponentDef[]): boolean {\n return components.some(\n (component) => component.type === ComponentType.FileUploadField\n )\n}\n\nconst SHOW_REPEATER_CONTROLLERS = [ControllerType.Page, ControllerType.Repeat]\n\nexport function showRepeaterSettings(page: Page): boolean {\n if (page.controller && !SHOW_REPEATER_CONTROLLERS.includes(page.controller)) {\n return false\n }\n if (hasComponents(page)
|
|
1
|
+
{"version":3,"file":"helpers.js","names":["ComponentType","hasFormField","isFormType","ControllerNames","ControllerTypes","ControllerType","PageTypes","getPageDefaults","page","nameOrPath","controller","Page","controllerNameFromPath","defaults","find","pageType","Error","structuredClone","hasComponents","hasNext","Array","isArray","components","hasComponentsEvenIfNoNext","undefined","hasFormComponents","Start","hasRepeater","Repeat","isControllerName","map","String","includes","Terminal","FileUpload","options","path","name","includesFileUploadField","some","component","type","FileUploadField","onlyDeclarationComponents","filter","comp","every","DeclarationField","SHOW_REPEATER_CONTROLLERS","showRepeaterSettings","getPageTitle","title","firstComp","getPageFromDefinition","definition","pageId","pages","x","id","summaryPageControllers","Summary","SummaryWithConfirmationEmail","isSummaryPage"],"sources":["../../../src/pages/helpers.ts"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { hasFormField, isFormType } from '~/src/components/helpers.js'\nimport { type ComponentDef } from '~/src/components/types.js'\nimport {\n type Link,\n type Page,\n type PageFileUpload,\n type PageQuestion,\n type PageRepeat\n} from '~/src/form/form-definition/types.js'\nimport { type FormDefinition } from '~/src/index.js'\nimport {\n ControllerNames,\n ControllerTypes\n} from '~/src/pages/controller-types.js'\nimport { ControllerType } from '~/src/pages/enums.js'\nimport { PageTypes } from '~/src/pages/page-types.js'\n\n/**\n * Return component defaults by type\n */\nexport function getPageDefaults<PageType extends Page>(\n page?: Pick<PageType, 'controller'>\n) {\n const nameOrPath = page?.controller ?? ControllerType.Page\n const controller = controllerNameFromPath(nameOrPath)\n\n const defaults = PageTypes.find(\n (pageType) => pageType.controller === controller\n )\n\n if (!defaults) {\n throw new Error(`Defaults not found for page type '${nameOrPath}'`)\n }\n\n return structuredClone(defaults) as PageType\n}\n\n/**\n * Check page has components\n */\nexport function hasComponents(\n page?: Partial<Page>\n): page is Extract<Page, { components: ComponentDef[] }> {\n return hasNext(page) && Array.isArray(page.components)\n}\n\n/**\n * Check if the page has components (the page can be any page type e.g. SummaryPage)\n */\nexport function hasComponentsEvenIfNoNext(\n page?: Partial<Page>\n): page is Extract<Page, { components: ComponentDef[] }> {\n return (\n page !== undefined && 'components' in page && Array.isArray(page.components)\n )\n}\n\n/**\n * Check page has form components\n */\nexport function hasFormComponents(\n page?: Partial<Page>\n): page is PageQuestion | PageFileUpload {\n const controller = controllerNameFromPath(page?.controller)\n return hasComponents(page) && controller !== ControllerType.Start\n}\n\n/**\n * Check page has repeater\n */\nexport function hasRepeater(page?: Partial<Page>): page is PageRepeat {\n return controllerNameFromPath(page?.controller) === ControllerType.Repeat\n}\n\n/**\n * Check for known page controller names\n */\nexport function isControllerName(\n nameOrPath?: ControllerType | string\n): nameOrPath is ControllerType {\n return !!nameOrPath && ControllerNames.map(String).includes(nameOrPath)\n}\n\n/**\n * Check page has next link\n */\nexport function hasNext(\n page?: Partial<Page>\n): page is Extract<Page, { next: Link[] }> {\n if (!page || !('next' in page)) {\n return false\n }\n\n const controller = controllerNameFromPath(page.controller)\n\n return (\n !controller ||\n controller === ControllerType.Start ||\n controller === ControllerType.Page ||\n controller === ControllerType.Terminal ||\n controller === ControllerType.FileUpload ||\n controller === ControllerType.Repeat\n )\n}\n\n/**\n * Check and optionally replace legacy path with controller name\n * @param {string} [nameOrPath] - Controller name or legacy controller path\n */\nexport function controllerNameFromPath(nameOrPath?: ControllerType | string) {\n if (isControllerName(nameOrPath)) {\n return nameOrPath\n }\n\n const options = ControllerTypes.find(({ path }) => path === nameOrPath)\n return options?.name\n}\n\nexport function includesFileUploadField(components: ComponentDef[]): boolean {\n return components.some(\n (component) => component.type === ComponentType.FileUploadField\n )\n}\n\nexport function onlyDeclarationComponents(components: ComponentDef[]): boolean {\n return components\n .filter((comp) => isFormType(comp.type))\n .every((component) => component.type === ComponentType.DeclarationField)\n}\n\nconst SHOW_REPEATER_CONTROLLERS = [ControllerType.Page, ControllerType.Repeat]\n\nexport function showRepeaterSettings(page: Page): boolean {\n if (page.controller && !SHOW_REPEATER_CONTROLLERS.includes(page.controller)) {\n return false\n }\n if (hasComponents(page)) {\n if (includesFileUploadField(page.components)) {\n return false\n }\n if (onlyDeclarationComponents(page.components)) {\n return false\n }\n }\n return true\n}\n\n/**\n * Gets page title, or title of first question (if no page title set)\n * @param {Page} page\n * @returns {string}\n */\nexport function getPageTitle(page: Page) {\n if (page.title !== '') {\n return page.title\n }\n\n if (hasComponentsEvenIfNoNext(page)) {\n const firstComp = page.components.find(hasFormField)\n if (firstComp) {\n return firstComp.title\n }\n }\n return 'Page title unknown'\n}\n\n/**\n *\n * @param {FormDefinition} definition\n * @param {string} pageId\n * @returns { Page | undefined }\n */\nexport function getPageFromDefinition(\n definition: FormDefinition,\n pageId: string\n): Page | undefined {\n return definition.pages.find((x) => x.id === pageId)\n}\n\nexport const summaryPageControllers = [\n ControllerType.Summary,\n ControllerType.SummaryWithConfirmationEmail\n]\n\nexport function isSummaryPage(page: Page | undefined) {\n return summaryPageControllers.includes(\n page?.controller ?? ControllerType.Page\n )\n}\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,YAAY,EAAEC,UAAU;AAUjC,SACEC,eAAe,EACfC,eAAe;AAEjB,SAASC,cAAc;AACvB,SAASC,SAAS;;AAElB;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAC7BC,IAAmC,EACnC;EACA,MAAMC,UAAU,GAAGD,IAAI,EAAEE,UAAU,IAAIL,cAAc,CAACM,IAAI;EAC1D,MAAMD,UAAU,GAAGE,sBAAsB,CAACH,UAAU,CAAC;EAErD,MAAMI,QAAQ,GAAGP,SAAS,CAACQ,IAAI,CAC5BC,QAAQ,IAAKA,QAAQ,CAACL,UAAU,KAAKA,UACxC,CAAC;EAED,IAAI,CAACG,QAAQ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C,EAAE;IACvB,IAAI8B,uBAAuB,CAAC9B,IAAI,CAACc,UAAU,CAAC,EAAE;MAC5C,OAAO,KAAK;IACd;IACA,IAAIqB,yBAAyB,CAACnC,IAAI,CAACc,UAAU,CAAC,EAAE;MAC9C,OAAO,KAAK;IACd;EACF;EACA,OAAO,IAAI;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS4B,YAAYA,CAAC1C,IAAU,EAAE;EACvC,IAAIA,IAAI,CAAC2C,KAAK,KAAK,EAAE,EAAE;IACrB,OAAO3C,IAAI,CAAC2C,KAAK;EACnB;EAEA,IAAI5B,yBAAyB,CAACf,IAAI,CAAC,EAAE;IACnC,MAAM4C,SAAS,GAAG5C,IAAI,CAACc,UAAU,CAACR,IAAI,CAACb,YAAY,CAAC;IACpD,IAAImD,SAAS,EAAE;MACb,OAAOA,SAAS,CAACD,KAAK;IACxB;EACF;EACA,OAAO,oBAAoB;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,qBAAqBA,CACnCC,UAA0B,EAC1BC,MAAc,EACI;EAClB,OAAOD,UAAU,CAACE,KAAK,CAAC1C,IAAI,CAAE2C,CAAC,IAAKA,CAAC,CAACC,EAAE,KAAKH,MAAM,CAAC;AACtD;AAEA,OAAO,MAAMI,sBAAsB,GAAG,CACpCtD,cAAc,CAACuD,OAAO,EACtBvD,cAAc,CAACwD,4BAA4B,CAC5C;AAED,OAAO,SAASC,aAAaA,CAACtD,IAAsB,EAAE;EACpD,OAAOmD,sBAAsB,CAAC3B,QAAQ,CACpCxB,IAAI,EAAEE,UAAU,IAAIL,cAAc,CAACM,IACrC,CAAC;AACH","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AutocompleteFieldComponent, type CheckboxesFieldComponent, type DatePartsFieldComponent, type DeclarationFieldComponent, type DetailsComponent, type EmailAddressFieldComponent, type FileUploadFieldComponent, type HtmlComponent, type InsetTextComponent, type ListComponent, type MarkdownComponent, type MonthYearFieldComponent, type MultilineTextFieldComponent, type NumberFieldComponent, type RadiosFieldComponent, type SelectFieldComponent, type TelephoneNumberFieldComponent, type TextFieldComponent, type UkAddressFieldComponent, type YesNoFieldComponent } from '../components/types.js';
|
|
1
|
+
import { type AutocompleteFieldComponent, type CheckboxesFieldComponent, type DatePartsFieldComponent, type DeclarationFieldComponent, type DetailsComponent, type EastingNorthingFieldComponent, type EmailAddressFieldComponent, type FileUploadFieldComponent, type HtmlComponent, type InsetTextComponent, type LatLongFieldComponent, type ListComponent, type MarkdownComponent, type MonthYearFieldComponent, type MultilineTextFieldComponent, type NationalGridFieldNumberFieldComponent, type NumberFieldComponent, type OsGridRefFieldComponent, type RadiosFieldComponent, type SelectFieldComponent, type TelephoneNumberFieldComponent, type TextFieldComponent, type UkAddressFieldComponent, type YesNoFieldComponent } from '../components/types.js';
|
|
2
2
|
import { type Item, type List } from '../form/form-definition/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @param {Partial<TextFieldComponent>} partialTextField
|
|
@@ -53,4 +53,8 @@ export declare function buildList(partialList?: Partial<List>): List;
|
|
|
53
53
|
export declare function buildNumberFieldComponent(partialComponent?: Partial<NumberFieldComponent>): NumberFieldComponent;
|
|
54
54
|
export declare function buildDateComponent(partialComponent?: Partial<DatePartsFieldComponent>): DatePartsFieldComponent;
|
|
55
55
|
export declare function buildRadiosComponent(partialComponent?: Partial<RadiosFieldComponent>): RadiosFieldComponent;
|
|
56
|
+
export declare function buildEastingNorthingFieldComponent(partialComponent?: Partial<EastingNorthingFieldComponent>): EastingNorthingFieldComponent;
|
|
57
|
+
export declare function buildLatLongFieldComponent(partialComponent?: Partial<LatLongFieldComponent>): LatLongFieldComponent;
|
|
58
|
+
export declare function buildNationalGridFieldNumberFieldComponent(partialComponent?: Partial<NationalGridFieldNumberFieldComponent>): NationalGridFieldNumberFieldComponent;
|
|
59
|
+
export declare function buildOsGridRefFieldComponent(partialComponent?: Partial<OsGridRefFieldComponent>): OsGridRefFieldComponent;
|
|
56
60
|
//# sourceMappingURL=components.d.ts.map
|