@defra/forms-model 3.0.686 → 3.0.688
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__/examples.js +185 -0
- package/dist/module/__stubs__/examples.js.map +1 -0
- package/dist/module/components/helpers.js +4 -0
- package/dist/module/components/helpers.js.map +1 -1
- package/dist/module/components/types.js.map +1 -1
- package/dist/module/form/form-definition/index.js +6 -0
- package/dist/module/form/form-definition/index.js.map +1 -1
- package/dist/module/form/form-editor/index.js +2 -0
- package/dist/module/form/form-editor/index.js.map +1 -1
- package/dist/module/form/form-editor/translations/translations-config.js +168 -0
- package/dist/module/form/form-editor/translations/translations-config.js.map +1 -0
- package/dist/module/form/form-editor/translations/translations-overview.js +93 -0
- package/dist/module/form/form-editor/translations/translations-overview.js.map +1 -0
- package/dist/module/form/form-editor/translations/translations.js +214 -0
- package/dist/module/form/form-editor/translations/translations.js.map +1 -0
- package/dist/module/form/form-editor/types.js.map +1 -1
- package/dist/module/form/utils/list.js +23 -0
- package/dist/module/form/utils/list.js.map +1 -1
- package/dist/module/form/utils/numbering.js +43 -0
- package/dist/module/form/utils/numbering.js.map +1 -0
- package/dist/module/index.js +2 -0
- package/dist/module/index.js.map +1 -1
- package/dist/types/__stubs__/examples.d.ts +9 -0
- package/dist/types/__stubs__/examples.d.ts.map +1 -0
- package/dist/types/components/helpers.d.ts +2 -1
- package/dist/types/components/helpers.d.ts.map +1 -1
- package/dist/types/components/types.d.ts +8 -0
- package/dist/types/components/types.d.ts.map +1 -1
- package/dist/types/form/form-definition/index.d.ts.map +1 -1
- package/dist/types/form/form-editor/index.d.ts +2 -0
- package/dist/types/form/form-editor/index.d.ts.map +1 -1
- package/dist/types/form/form-editor/translations/translations-config.d.ts +95 -0
- package/dist/types/form/form-editor/translations/translations-config.d.ts.map +1 -0
- package/dist/types/form/form-editor/translations/translations-overview.d.ts +14 -0
- package/dist/types/form/form-editor/translations/translations-overview.d.ts.map +1 -0
- package/dist/types/form/form-editor/translations/translations.d.ts +16 -0
- package/dist/types/form/form-editor/translations/translations.d.ts.map +1 -0
- package/dist/types/form/form-editor/types.d.ts +5 -1
- package/dist/types/form/form-editor/types.d.ts.map +1 -1
- package/dist/types/form/utils/list.d.ts +8 -1
- package/dist/types/form/utils/list.d.ts.map +1 -1
- package/dist/types/form/utils/numbering.d.ts +18 -0
- package/dist/types/form/utils/numbering.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/schemas/component-schema-v2.json +13 -0
- package/schemas/component-schema.json +13 -0
- package/schemas/form-definition-schema.json +39 -0
- package/schemas/form-definition-v2-schema.json +65 -0
- package/schemas/list-schema-v2.json +26 -0
- package/schemas/list-schema.json +26 -0
- package/schemas/page-schema-v2.json +39 -0
- package/schemas/page-schema.json +13 -0
- package/src/__stubs__/examples.js +231 -0
- package/src/components/helpers.ts +14 -0
- package/src/components/types.ts +15 -0
- package/src/form/form-definition/index.ts +19 -0
- package/src/form/form-editor/index.ts +6 -0
- package/src/form/form-editor/translations/translations-config.js +186 -0
- package/src/form/form-editor/translations/translations-overview.js +137 -0
- package/src/form/form-editor/translations/translations.js +297 -0
- package/src/form/form-editor/types.ts +6 -0
- package/src/form/utils/list.ts +34 -1
- package/src/form/utils/numbering.js +47 -0
- package/src/index.ts +2 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { buildDeclarationFieldComponent, buildLatLongFieldComponent, buildMarkdownComponent, buildRadiosComponent, buildTextFieldComponent } from "./components.js";
|
|
2
|
+
import { buildDefinition } from "./form-definition.js";
|
|
3
|
+
import { buildQuestionPage, buildRepeaterPage, buildSummaryPage } from "./pages.js";
|
|
4
|
+
export const formDefinitionWithSinglePage = buildDefinition({
|
|
5
|
+
pages: [buildQuestionPage({
|
|
6
|
+
id: 'p1',
|
|
7
|
+
section: 'section',
|
|
8
|
+
components: [buildTextFieldComponent({
|
|
9
|
+
id: 'c1',
|
|
10
|
+
name: 'textField',
|
|
11
|
+
title: 'This is your first field',
|
|
12
|
+
hint: 'Help text'
|
|
13
|
+
})],
|
|
14
|
+
next: [{
|
|
15
|
+
path: '/summary'
|
|
16
|
+
}]
|
|
17
|
+
}), buildSummaryPage({
|
|
18
|
+
id: 'c2'
|
|
19
|
+
})]
|
|
20
|
+
});
|
|
21
|
+
export const formDefinitionWithoutSummary = buildDefinition({
|
|
22
|
+
pages: [buildQuestionPage({
|
|
23
|
+
id: 'p1',
|
|
24
|
+
section: 'section',
|
|
25
|
+
components: [buildTextFieldComponent({
|
|
26
|
+
id: 'c1',
|
|
27
|
+
name: 'textField',
|
|
28
|
+
title: 'This is your first field',
|
|
29
|
+
hint: 'Help text'
|
|
30
|
+
})],
|
|
31
|
+
next: [{
|
|
32
|
+
path: '/summary'
|
|
33
|
+
}]
|
|
34
|
+
})]
|
|
35
|
+
});
|
|
36
|
+
export const formDefinitionWithTwoQuestions = buildDefinition({
|
|
37
|
+
pages: [buildQuestionPage({
|
|
38
|
+
id: 'p1',
|
|
39
|
+
section: 'section',
|
|
40
|
+
components: [buildTextFieldComponent({
|
|
41
|
+
id: 'q1',
|
|
42
|
+
name: 'textField',
|
|
43
|
+
title: 'This is your first question',
|
|
44
|
+
hint: 'Help text'
|
|
45
|
+
}), buildTextFieldComponent({
|
|
46
|
+
id: 'q2',
|
|
47
|
+
name: 'textField',
|
|
48
|
+
title: 'This is your second question',
|
|
49
|
+
hint: 'Help text'
|
|
50
|
+
})],
|
|
51
|
+
next: [{
|
|
52
|
+
path: '/summary'
|
|
53
|
+
}]
|
|
54
|
+
}), buildSummaryPage({
|
|
55
|
+
id: 'p2'
|
|
56
|
+
})]
|
|
57
|
+
});
|
|
58
|
+
export const formDefinitionWithTwoQuestionsAndGuidance = buildDefinition({
|
|
59
|
+
pages: [buildQuestionPage({
|
|
60
|
+
id: 'p1',
|
|
61
|
+
section: 'section',
|
|
62
|
+
components: [buildMarkdownComponent({
|
|
63
|
+
content: 'My markdown text'
|
|
64
|
+
}), buildTextFieldComponent({
|
|
65
|
+
id: 'q1',
|
|
66
|
+
name: 'textField',
|
|
67
|
+
title: 'This is the first textfield question',
|
|
68
|
+
hint: 'Help text'
|
|
69
|
+
}), buildTextFieldComponent({
|
|
70
|
+
id: 'q2',
|
|
71
|
+
name: 'textField',
|
|
72
|
+
title: 'This is the second textfield question',
|
|
73
|
+
hint: 'Help text'
|
|
74
|
+
})],
|
|
75
|
+
next: [{
|
|
76
|
+
path: '/summary'
|
|
77
|
+
}]
|
|
78
|
+
}), buildSummaryPage({
|
|
79
|
+
id: 'p2'
|
|
80
|
+
})]
|
|
81
|
+
});
|
|
82
|
+
export const formDefinitionWithLocationAndDeclaration = buildDefinition({
|
|
83
|
+
pages: [buildQuestionPage({
|
|
84
|
+
id: 'p1',
|
|
85
|
+
section: 'section',
|
|
86
|
+
components: [buildLatLongFieldComponent({
|
|
87
|
+
id: 'q1',
|
|
88
|
+
name: 'latLongField',
|
|
89
|
+
title: 'This is the first lat long field question',
|
|
90
|
+
hint: 'Hint text',
|
|
91
|
+
options: {
|
|
92
|
+
instructionText: 'Some instruction text'
|
|
93
|
+
}
|
|
94
|
+
}), buildDeclarationFieldComponent({
|
|
95
|
+
id: 'q2',
|
|
96
|
+
name: 'declarationField',
|
|
97
|
+
title: 'This is a declaration question',
|
|
98
|
+
hint: 'Declaration hint text',
|
|
99
|
+
content: 'This is the declaration that needs agreeing to',
|
|
100
|
+
shortDescription: 'Declaration short desc'
|
|
101
|
+
})],
|
|
102
|
+
next: [{
|
|
103
|
+
path: '/summary'
|
|
104
|
+
}]
|
|
105
|
+
}), buildSummaryPage({
|
|
106
|
+
id: 'p2'
|
|
107
|
+
})]
|
|
108
|
+
});
|
|
109
|
+
export const formDefinitionWithRepeater = buildDefinition({
|
|
110
|
+
pages: [buildRepeaterPage({
|
|
111
|
+
id: 'p1',
|
|
112
|
+
section: 'section',
|
|
113
|
+
components: [buildTextFieldComponent({
|
|
114
|
+
id: 'q1',
|
|
115
|
+
name: 'TextField',
|
|
116
|
+
title: 'This is the first text field field question',
|
|
117
|
+
hint: 'Hint text',
|
|
118
|
+
shortDescription: 'Short desc'
|
|
119
|
+
})],
|
|
120
|
+
next: [{
|
|
121
|
+
path: '/summary'
|
|
122
|
+
}]
|
|
123
|
+
}), buildSummaryPage({
|
|
124
|
+
id: 'p2'
|
|
125
|
+
})]
|
|
126
|
+
});
|
|
127
|
+
export const formDefinitionWithNoQuestions = buildDefinition({
|
|
128
|
+
pages: [buildQuestionPage({
|
|
129
|
+
id: 'p1',
|
|
130
|
+
section: 'section',
|
|
131
|
+
components: [],
|
|
132
|
+
next: [{
|
|
133
|
+
path: '/summary'
|
|
134
|
+
}]
|
|
135
|
+
}), buildSummaryPage({
|
|
136
|
+
id: 'p2'
|
|
137
|
+
})]
|
|
138
|
+
});
|
|
139
|
+
export const formDefinitionWithRadioQuestion = buildDefinition({
|
|
140
|
+
pages: [buildQuestionPage({
|
|
141
|
+
id: 'p1',
|
|
142
|
+
section: 'section',
|
|
143
|
+
components: [buildRadiosComponent({
|
|
144
|
+
id: 'q1',
|
|
145
|
+
name: 'radioField',
|
|
146
|
+
title: 'This is a radio question',
|
|
147
|
+
hint: 'Help text',
|
|
148
|
+
list: 'my-list-id'
|
|
149
|
+
})],
|
|
150
|
+
next: [{
|
|
151
|
+
path: '/summary'
|
|
152
|
+
}]
|
|
153
|
+
}), buildSummaryPage({
|
|
154
|
+
id: 'p2'
|
|
155
|
+
})],
|
|
156
|
+
lists: [{
|
|
157
|
+
name: 'my-list',
|
|
158
|
+
id: 'my-list-id',
|
|
159
|
+
type: 'string',
|
|
160
|
+
title: 'list for radio',
|
|
161
|
+
items: [{
|
|
162
|
+
id: 'option-1',
|
|
163
|
+
text: 'Option 1',
|
|
164
|
+
hint: {
|
|
165
|
+
text: 'Option 1 hint'
|
|
166
|
+
},
|
|
167
|
+
value: 'Option1'
|
|
168
|
+
}, {
|
|
169
|
+
id: 'option-2',
|
|
170
|
+
text: 'Option 2',
|
|
171
|
+
hint: {
|
|
172
|
+
text: 'Option 2 hint'
|
|
173
|
+
},
|
|
174
|
+
value: 'Option2'
|
|
175
|
+
}, {
|
|
176
|
+
id: 'option-3',
|
|
177
|
+
text: 'Option 3',
|
|
178
|
+
hint: {
|
|
179
|
+
text: 'Option 3 hint'
|
|
180
|
+
},
|
|
181
|
+
value: 'Option3'
|
|
182
|
+
}]
|
|
183
|
+
}]
|
|
184
|
+
});
|
|
185
|
+
//# sourceMappingURL=examples.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"examples.js","names":["buildDeclarationFieldComponent","buildLatLongFieldComponent","buildMarkdownComponent","buildRadiosComponent","buildTextFieldComponent","buildDefinition","buildQuestionPage","buildRepeaterPage","buildSummaryPage","formDefinitionWithSinglePage","pages","id","section","components","name","title","hint","next","path","formDefinitionWithoutSummary","formDefinitionWithTwoQuestions","formDefinitionWithTwoQuestionsAndGuidance","content","formDefinitionWithLocationAndDeclaration","options","instructionText","shortDescription","formDefinitionWithRepeater","formDefinitionWithNoQuestions","formDefinitionWithRadioQuestion","list","lists","type","items","text","value"],"sources":["../../../src/__stubs__/examples.js"],"sourcesContent":["import {\n buildDeclarationFieldComponent,\n buildLatLongFieldComponent,\n buildMarkdownComponent,\n buildRadiosComponent,\n buildTextFieldComponent\n} from '~/src/__stubs__/components.js'\nimport { buildDefinition } from '~/src/__stubs__/form-definition.js'\nimport {\n buildQuestionPage,\n buildRepeaterPage,\n buildSummaryPage\n} from '~/src/__stubs__/pages.js'\n\nexport const formDefinitionWithSinglePage = buildDefinition({\n pages: [\n buildQuestionPage({\n id: 'p1',\n section: 'section',\n components: [\n buildTextFieldComponent({\n id: 'c1',\n name: 'textField',\n title: 'This is your first field',\n hint: 'Help text'\n })\n ],\n next: [{ path: '/summary' }]\n }),\n buildSummaryPage({\n id: 'c2'\n })\n ]\n})\n\nexport const formDefinitionWithoutSummary = buildDefinition({\n pages: [\n buildQuestionPage({\n id: 'p1',\n section: 'section',\n components: [\n buildTextFieldComponent({\n id: 'c1',\n name: 'textField',\n title: 'This is your first field',\n hint: 'Help text'\n })\n ],\n next: [{ path: '/summary' }]\n })\n ]\n})\n\nexport const formDefinitionWithTwoQuestions = buildDefinition({\n pages: [\n buildQuestionPage({\n id: 'p1',\n section: 'section',\n components: [\n buildTextFieldComponent({\n id: 'q1',\n name: 'textField',\n title: 'This is your first question',\n hint: 'Help text'\n }),\n buildTextFieldComponent({\n id: 'q2',\n name: 'textField',\n title: 'This is your second question',\n hint: 'Help text'\n })\n ],\n next: [{ path: '/summary' }]\n }),\n buildSummaryPage({\n id: 'p2'\n })\n ]\n})\n\nexport const formDefinitionWithTwoQuestionsAndGuidance = buildDefinition({\n pages: [\n buildQuestionPage({\n id: 'p1',\n section: 'section',\n components: [\n buildMarkdownComponent({ content: 'My markdown text' }),\n buildTextFieldComponent({\n id: 'q1',\n name: 'textField',\n title: 'This is the first textfield question',\n hint: 'Help text'\n }),\n buildTextFieldComponent({\n id: 'q2',\n name: 'textField',\n title: 'This is the second textfield question',\n hint: 'Help text'\n })\n ],\n next: [{ path: '/summary' }]\n }),\n buildSummaryPage({\n id: 'p2'\n })\n ]\n})\n\nexport const formDefinitionWithLocationAndDeclaration = buildDefinition({\n pages: [\n buildQuestionPage({\n id: 'p1',\n section: 'section',\n components: [\n buildLatLongFieldComponent({\n id: 'q1',\n name: 'latLongField',\n title: 'This is the first lat long field question',\n hint: 'Hint text',\n options: {\n instructionText: 'Some instruction text'\n }\n }),\n buildDeclarationFieldComponent({\n id: 'q2',\n name: 'declarationField',\n title: 'This is a declaration question',\n hint: 'Declaration hint text',\n content: 'This is the declaration that needs agreeing to',\n shortDescription: 'Declaration short desc'\n })\n ],\n next: [{ path: '/summary' }]\n }),\n buildSummaryPage({\n id: 'p2'\n })\n ]\n})\n\nexport const formDefinitionWithRepeater = buildDefinition({\n pages: [\n buildRepeaterPage({\n id: 'p1',\n section: 'section',\n components: [\n buildTextFieldComponent({\n id: 'q1',\n name: 'TextField',\n title: 'This is the first text field field question',\n hint: 'Hint text',\n shortDescription: 'Short desc'\n })\n ],\n next: [{ path: '/summary' }]\n }),\n buildSummaryPage({\n id: 'p2'\n })\n ]\n})\n\nexport const formDefinitionWithNoQuestions = buildDefinition({\n pages: [\n buildQuestionPage({\n id: 'p1',\n section: 'section',\n components: [],\n next: [{ path: '/summary' }]\n }),\n buildSummaryPage({\n id: 'p2'\n })\n ]\n})\n\nexport const formDefinitionWithRadioQuestion = buildDefinition({\n pages: [\n buildQuestionPage({\n id: 'p1',\n section: 'section',\n components: [\n buildRadiosComponent({\n id: 'q1',\n name: 'radioField',\n title: 'This is a radio question',\n hint: 'Help text',\n list: 'my-list-id'\n })\n ],\n next: [{ path: '/summary' }]\n }),\n buildSummaryPage({\n id: 'p2'\n })\n ],\n lists: [\n {\n name: 'my-list',\n id: 'my-list-id',\n type: 'string',\n title: 'list for radio',\n items: [\n {\n id: 'option-1',\n text: 'Option 1',\n hint: {\n text: 'Option 1 hint'\n },\n value: 'Option1'\n },\n {\n id: 'option-2',\n text: 'Option 2',\n hint: {\n text: 'Option 2 hint'\n },\n value: 'Option2'\n },\n {\n id: 'option-3',\n text: 'Option 3',\n hint: {\n text: 'Option 3 hint'\n },\n value: 'Option3'\n }\n ]\n }\n ]\n})\n"],"mappings":"AAAA,SACEA,8BAA8B,EAC9BC,0BAA0B,EAC1BC,sBAAsB,EACtBC,oBAAoB,EACpBC,uBAAuB;AAEzB,SAASC,eAAe;AACxB,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,gBAAgB;AAGlB,OAAO,MAAMC,4BAA4B,GAAGJ,eAAe,CAAC;EAC1DK,KAAK,EAAE,CACLJ,iBAAiB,CAAC;IAChBK,EAAE,EAAE,IAAI;IACRC,OAAO,EAAE,SAAS;IAClBC,UAAU,EAAE,CACVT,uBAAuB,CAAC;MACtBO,EAAE,EAAE,IAAI;MACRG,IAAI,EAAE,WAAW;MACjBC,KAAK,EA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V,gBAAgB,CAAC;IACfG,EAAE,EAAE;EACN,CAAC,CAAC,CACH;EACDoB,KAAK,EAAE,CACL;IACEjB,IAAI,EAAE,SAAS;IACfH,EAAE,EAAE,YAAY;IAChBqB,IAAI,EAAE,QAAQ;IACdjB,KAAK,EAAE,gBAAgB;IACvBkB,KAAK,EAAE,CACL;MACEtB,EAAE,EAAE,UAAU;MACduB,IAAI,EAAE,UAAU;MAChBlB,IAAI,EAAE;QACJkB,IAAI,EAAE;MACR,CAAC;MACDC,KAAK,EAAE;IACT,CAAC,EACD;MACExB,EAAE,EAAE,UAAU;MACduB,IAAI,EAAE,UAAU;MAChBlB,IAAI,EAAE;QACJkB,IAAI,EAAE;MACR,CAAC;MACDC,KAAK,EAAE;IACT,CAAC,EACD;MACExB,EAAE,EAAE,UAAU;MACduB,IAAI,EAAE,UAAU;MAChBlB,IAAI,EAAE;QACJkB,IAAI,EAAE;MACR,CAAC;MACDC,KAAK,EAAE;IACT,CAAC;EAEL,CAAC;AAEL,CAAC,CAAC","ignoreList":[]}
|
|
@@ -74,6 +74,10 @@ export function isListType(type) {
|
|
|
74
74
|
const allowedTypes = [ComponentType.AutocompleteField, ComponentType.List, ComponentType.RadiosField, ComponentType.SelectField, ComponentType.CheckboxesField];
|
|
75
75
|
return !!type && allowedTypes.includes(type);
|
|
76
76
|
}
|
|
77
|
+
export function isTypeWithInstructions(type) {
|
|
78
|
+
const allowedTypes = [ComponentType.EastingNorthingField, ComponentType.OsGridRefField, ComponentType.NationalGridFieldNumberField, ComponentType.LatLongField];
|
|
79
|
+
return !!type && allowedTypes.includes(type);
|
|
80
|
+
}
|
|
77
81
|
|
|
78
82
|
/**
|
|
79
83
|
* Filter known form components with input fields
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","names":["ComponentTypes","ComponentType","getComponentDefaults","component","defaults","find","type","Error","structuredClone","hasConditionSupport","isConditionalType","allowedTypes","AutocompleteField","RadiosField","CheckboxesField","DatePartsField","EmailAddressField","MultilineTextField","TelephoneNumberField","NumberField","SelectField","TextField","YesNoField","DeclarationField","includes","isConditionalRevealType","isContentType","hasContent","hasContentField","deniedTypes","List","Details","Html","Markdown","InsetText","NotificationBanner","hasFormField","isFormType","hasListField","isListType","hasInputField","hasSelectionFields","hasTitle","hasHint"],"sources":["../../../src/components/helpers.ts"],"sourcesContent":["import { ComponentTypes } from '~/src/components/component-types.js'\nimport { ComponentType } from '~/src/components/enums.js'\nimport {\n type ComponentDef,\n type ConditionalComponentType,\n type ConditionalComponentsDef,\n type ContentComponentsDef,\n type FormComponentsDef,\n type HtmlComponent,\n type InputFieldsComponentsDef,\n type InsetTextComponent,\n type ListComponent,\n type ListComponentsDef,\n type MarkdownComponent,\n type SelectionComponentsDef\n} from '~/src/components/types.js'\n\n/**\n * Return component defaults by type\n */\nexport function getComponentDefaults<FieldType extends ComponentDef>(\n component?: Pick<FieldType, 'type'>\n) {\n const defaults = ComponentTypes.find(({ type }) => type === component?.type)\n\n if (!defaults) {\n throw new Error(\n `Defaults not found for component type '${component?.type}'`\n )\n }\n\n return structuredClone(defaults) as FieldType\n}\n\n/**\n * Filter known components with support for conditions\n */\nexport function hasConditionSupport(\n component?: Partial<ComponentDef>\n): component is ConditionalComponentsDef {\n return isConditionalType(component?.type)\n}\n\nexport function isConditionalType(\n type?: ComponentType\n): type is ConditionalComponentType {\n const allowedTypes = [\n ComponentType.AutocompleteField,\n ComponentType.RadiosField,\n ComponentType.CheckboxesField,\n ComponentType.DatePartsField,\n ComponentType.EmailAddressField,\n ComponentType.MultilineTextField,\n ComponentType.TelephoneNumberField,\n ComponentType.NumberField,\n ComponentType.SelectField,\n ComponentType.TextField,\n ComponentType.YesNoField,\n ComponentType.DeclarationField\n ]\n\n return !!type && allowedTypes.includes(type)\n}\n\n/**\n * Check if the component type is supported for conditional reveal.\n * As of today this is just content types, but we're providing this as a wrapper\n * function for clarity.\n * @param type - Component type to check\n */\nexport function isConditionalRevealType(type: ComponentType) {\n return isContentType(type)\n}\n\n/**\n * Filter known components with content (textarea or list)\n */\nexport function hasContent(\n component?: Partial<ComponentDef>\n): component is ContentComponentsDef {\n return isContentType(component?.type)\n}\n\n/**\n * Filter known components with content textarea\n */\nexport function hasContentField(\n component?: Partial<ComponentDef>\n): component is Exclude<ContentComponentsDef, ListComponent> {\n const deniedTypes = [ComponentType.List]\n return hasContent(component) && !deniedTypes.includes(component.type)\n}\n\nexport function isContentType(\n type?: ComponentType\n): type is ContentComponentsDef['type'] {\n const allowedTypes = [\n ComponentType.Details,\n ComponentType.Html,\n ComponentType.Markdown,\n ComponentType.InsetText,\n ComponentType.List,\n ComponentType.NotificationBanner\n ]\n\n return !!type && allowedTypes.includes(type)\n}\n\n/**\n * Filter known components with form fields\n * (includes input fields and selection fields)\n */\nexport function hasFormField(\n component?: Partial<ComponentDef>\n): component is FormComponentsDef {\n return isFormType(component?.type)\n}\n\nexport function isFormType(\n type?: ComponentType\n): type is FormComponentsDef['type'] {\n return !!type && !isContentType(type)\n}\n\n/**\n * Filter known components with lists\n */\nexport function hasListField(\n component?: Partial<ComponentDef>\n): component is ListComponentsDef {\n return isListType(component?.type)\n}\n\nexport function isListType(\n type?: ComponentType\n): type is ListComponentsDef['type'] {\n const allowedTypes = [\n ComponentType.AutocompleteField,\n ComponentType.List,\n ComponentType.RadiosField,\n ComponentType.SelectField,\n ComponentType.CheckboxesField\n ]\n\n return !!type && allowedTypes.includes(type)\n}\n\n/**\n * Filter known form components with input fields\n * (excludes content and selection fields)\n */\nexport function hasInputField(\n component?: Partial<ComponentDef>\n): component is InputFieldsComponentsDef {\n return hasFormField(component) && !hasSelectionFields(component)\n}\n\n/**\n * Filter known form components with selection fields\n * (excludes content and input fields)\n */\nexport function hasSelectionFields(\n component?: Partial<ComponentDef>\n): component is SelectionComponentsDef {\n const allowedTypes = [\n ComponentType.AutocompleteField,\n ComponentType.CheckboxesField,\n ComponentType.RadiosField,\n ComponentType.SelectField,\n ComponentType.YesNoField,\n ComponentType.DeclarationField\n ]\n\n return !!component?.type && allowedTypes.includes(component.type)\n}\n\n/**\n * Filter known components with titles\n */\nexport function hasTitle(\n component?: Partial<ComponentDef>\n): component is Exclude<\n ComponentDef,\n InsetTextComponent | HtmlComponent | MarkdownComponent\n> {\n const deniedTypes = [\n ComponentType.InsetText,\n ComponentType.Html,\n ComponentType.Markdown\n ]\n return !!component?.type && !deniedTypes.includes(component.type)\n}\n\n/**\n * Filter known components with hint text\n */\nexport function hasHint(\n component?: Partial<ComponentDef>\n): component is FormComponentsDef | ListComponent {\n return isFormType(component?.type) || component?.type === ComponentType.List\n}\n"],"mappings":"AAAA,SAASA,cAAc;AACvB,SAASC,aAAa;AAgBtB;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAClCC,SAAmC,EACnC;EACA,MAAMC,QAAQ,GAAGJ,cAAc,CAACK,IAAI,CAAC,CAAC;IAAEC;EAAK,CAAC,KAAKA,IAAI,KAAKH,SAAS,EAAEG,IAAI,CAAC;EAE5E,IAAI,CAACF,QAAQ,EAAE;IACb,MAAM,IAAIG,KAAK,CACb,0CAA0CJ,SAAS,EAAEG,IAAI,GAC3D,CAAC;EACH;EAEA,OAAOE,eAAe,CAACJ,QAAQ,CAAC;AAClC;;AAEA;AACA;AACA;AACA,OAAO,SAASK,mBAAmBA,CACjCN,SAAiC,EACM;EACvC,OAAOO,iBAAiB,CAACP,SAAS,EAAEG,IAAI,CAAC;AAC3C;AAEA,OAAO,SAASI,iBAAiBA,CAC/BJ,IAAoB,EACc;EAClC,MAAMK,YAAY,GAAG,CACnBV,aAAa,CAACW,iBAAiB,EAC/BX,aAAa,CAACY,WAAW,EACzBZ,aAAa,CAACa,eAAe,EAC7Bb,aAAa,CAACc,cAAc,EAC5Bd,aAAa,CAACe,iBAAiB,EAC/Bf,aAAa,CAACgB,kBAAkB,EAChChB,aAAa,CAACiB,oBAAoB,EAClCjB,aAAa,CAACkB,WAAW,EACzBlB,aAAa,CAACmB,WAAW,EACzBnB,aAAa,CAACoB,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AI,CAAC;AACnE;;AAEA;AACA;AACA;AACA,OAAO,SAASqC,OAAOA,CACrBxC,SAAiC,EACe;EAChD,OAAOkC,UAAU,CAAClC,SAAS,EAAEG,IAAI,CAAC,IAAIH,SAAS,EAAEG,IAAI,KAAKL,aAAa,CAAC6B,IAAI;AAC9E","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"helpers.js","names":["ComponentTypes","ComponentType","getComponentDefaults","component","defaults","find","type","Error","structuredClone","hasConditionSupport","isConditionalType","allowedTypes","AutocompleteField","RadiosField","CheckboxesField","DatePartsField","EmailAddressField","MultilineTextField","TelephoneNumberField","NumberField","SelectField","TextField","YesNoField","DeclarationField","includes","isConditionalRevealType","isContentType","hasContent","hasContentField","deniedTypes","List","Details","Html","Markdown","InsetText","NotificationBanner","hasFormField","isFormType","hasListField","isListType","isTypeWithInstructions","EastingNorthingField","OsGridRefField","NationalGridFieldNumberField","LatLongField","hasInputField","hasSelectionFields","hasTitle","hasHint"],"sources":["../../../src/components/helpers.ts"],"sourcesContent":["import { ComponentTypes } from '~/src/components/component-types.js'\nimport { ComponentType } from '~/src/components/enums.js'\nimport {\n type ComponentDef,\n type ComponentsDefWithInstructions,\n type ConditionalComponentType,\n type ConditionalComponentsDef,\n type ContentComponentsDef,\n type FormComponentsDef,\n type HtmlComponent,\n type InputFieldsComponentsDef,\n type InsetTextComponent,\n type ListComponent,\n type ListComponentsDef,\n type MarkdownComponent,\n type SelectionComponentsDef\n} from '~/src/components/types.js'\n\n/**\n * Return component defaults by type\n */\nexport function getComponentDefaults<FieldType extends ComponentDef>(\n component?: Pick<FieldType, 'type'>\n) {\n const defaults = ComponentTypes.find(({ type }) => type === component?.type)\n\n if (!defaults) {\n throw new Error(\n `Defaults not found for component type '${component?.type}'`\n )\n }\n\n return structuredClone(defaults) as FieldType\n}\n\n/**\n * Filter known components with support for conditions\n */\nexport function hasConditionSupport(\n component?: Partial<ComponentDef>\n): component is ConditionalComponentsDef {\n return isConditionalType(component?.type)\n}\n\nexport function isConditionalType(\n type?: ComponentType\n): type is ConditionalComponentType {\n const allowedTypes = [\n ComponentType.AutocompleteField,\n ComponentType.RadiosField,\n ComponentType.CheckboxesField,\n ComponentType.DatePartsField,\n ComponentType.EmailAddressField,\n ComponentType.MultilineTextField,\n ComponentType.TelephoneNumberField,\n ComponentType.NumberField,\n ComponentType.SelectField,\n ComponentType.TextField,\n ComponentType.YesNoField,\n ComponentType.DeclarationField\n ]\n\n return !!type && allowedTypes.includes(type)\n}\n\n/**\n * Check if the component type is supported for conditional reveal.\n * As of today this is just content types, but we're providing this as a wrapper\n * function for clarity.\n * @param type - Component type to check\n */\nexport function isConditionalRevealType(type: ComponentType) {\n return isContentType(type)\n}\n\n/**\n * Filter known components with content (textarea or list)\n */\nexport function hasContent(\n component?: Partial<ComponentDef>\n): component is ContentComponentsDef {\n return isContentType(component?.type)\n}\n\n/**\n * Filter known components with content textarea\n */\nexport function hasContentField(\n component?: Partial<ComponentDef>\n): component is Exclude<ContentComponentsDef, ListComponent> {\n const deniedTypes = [ComponentType.List]\n return hasContent(component) && !deniedTypes.includes(component.type)\n}\n\nexport function isContentType(\n type?: ComponentType\n): type is ContentComponentsDef['type'] {\n const allowedTypes = [\n ComponentType.Details,\n ComponentType.Html,\n ComponentType.Markdown,\n ComponentType.InsetText,\n ComponentType.List,\n ComponentType.NotificationBanner\n ]\n\n return !!type && allowedTypes.includes(type)\n}\n\n/**\n * Filter known components with form fields\n * (includes input fields and selection fields)\n */\nexport function hasFormField(\n component?: Partial<ComponentDef>\n): component is FormComponentsDef {\n return isFormType(component?.type)\n}\n\nexport function isFormType(\n type?: ComponentType\n): type is FormComponentsDef['type'] {\n return !!type && !isContentType(type)\n}\n\n/**\n * Filter known components with lists\n */\nexport function hasListField(\n component?: Partial<ComponentDef>\n): component is ListComponentsDef {\n return isListType(component?.type)\n}\n\nexport function isListType(\n type?: ComponentType\n): type is ListComponentsDef['type'] {\n const allowedTypes = [\n ComponentType.AutocompleteField,\n ComponentType.List,\n ComponentType.RadiosField,\n ComponentType.SelectField,\n ComponentType.CheckboxesField\n ]\n\n return !!type && allowedTypes.includes(type)\n}\n\nexport function isTypeWithInstructions(\n type?: ComponentType\n): type is ComponentsDefWithInstructions['type'] {\n const allowedTypes = [\n ComponentType.EastingNorthingField,\n ComponentType.OsGridRefField,\n ComponentType.NationalGridFieldNumberField,\n ComponentType.LatLongField\n ]\n\n return !!type && allowedTypes.includes(type)\n}\n\n/**\n * Filter known form components with input fields\n * (excludes content and selection fields)\n */\nexport function hasInputField(\n component?: Partial<ComponentDef>\n): component is InputFieldsComponentsDef {\n return hasFormField(component) && !hasSelectionFields(component)\n}\n\n/**\n * Filter known form components with selection fields\n * (excludes content and input fields)\n */\nexport function hasSelectionFields(\n component?: Partial<ComponentDef>\n): component is SelectionComponentsDef {\n const allowedTypes = [\n ComponentType.AutocompleteField,\n ComponentType.CheckboxesField,\n ComponentType.RadiosField,\n ComponentType.SelectField,\n ComponentType.YesNoField,\n ComponentType.DeclarationField\n ]\n\n return !!component?.type && allowedTypes.includes(component.type)\n}\n\n/**\n * Filter known components with titles\n */\nexport function hasTitle(\n component?: Partial<ComponentDef>\n): component is Exclude<\n ComponentDef,\n InsetTextComponent | HtmlComponent | MarkdownComponent\n> {\n const deniedTypes = [\n ComponentType.InsetText,\n ComponentType.Html,\n ComponentType.Markdown\n ]\n return !!component?.type && !deniedTypes.includes(component.type)\n}\n\n/**\n * Filter known components with hint text\n */\nexport function hasHint(\n component?: Partial<ComponentDef>\n): component is FormComponentsDef | ListComponent {\n return isFormType(component?.type) || component?.type === ComponentType.List\n}\n"],"mappings":"AAAA,SAASA,cAAc;AACvB,SAASC,aAAa;AAiBtB;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAClCC,SAAmC,EACnC;EACA,MAAMC,QAAQ,GAAGJ,cAAc,CAACK,IAAI,CAAC,CAAC;IAAEC;EAAK,CAAC,KAAKA,IAAI,KAAKH,SAAS,EAAEG,IAAI,CAAC;EAE5E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AAY,CAC3B;EAED,OAAO,CAAC,CAACtC,IAAI,IAAIK,YAAY,CAACa,QAAQ,CAAClB,IAAI,CAAC;AAC9C;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASuC,aAAaA,CAC3B1C,SAAiC,EACM;EACvC,OAAOiC,YAAY,CAACjC,SAAS,CAAC,IAAI,CAAC2C,kBAAkB,CAAC3C,SAAS,CAAC;AAClE;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAAS2C,kBAAkBA,CAChC3C,SAAiC,EACI;EACrC,MAAMQ,YAAY,GAAG,CACnBV,aAAa,CAACW,iBAAiB,EAC/BX,aAAa,CAACa,eAAe,EAC7Bb,aAAa,CAACY,WAAW,EACzBZ,aAAa,CAACmB,WAAW,EACzBnB,aAAa,CAACqB,UAAU,EACxBrB,aAAa,CAACsB,gBAAgB,CAC/B;EAED,OAAO,CAAC,CAACpB,SAAS,EAAEG,IAAI,IAAIK,YAAY,CAACa,QAAQ,CAACrB,SAAS,CAACG,IAAI,CAAC;AACnE;;AAEA;AACA;AACA;AACA,OAAO,SAASyC,QAAQA,CACtB5C,SAAiC,EAIjC;EACA,MAAM0B,WAAW,GAAG,CAClB5B,aAAa,CAACiC,SAAS,EACvBjC,aAAa,CAAC+B,IAAI,EAClB/B,aAAa,CAACgC,QAAQ,CACvB;EACD,OAAO,CAAC,CAAC9B,SAAS,EAAEG,IAAI,IAAI,CAACuB,WAAW,CAACL,QAAQ,CAACrB,SAAS,CAACG,IAAI,CAAC;AACnE;;AAEA;AACA;AACA;AACA,OAAO,SAAS0C,OAAOA,CACrB7C,SAAiC,EACe;EAChD,OAAOkC,UAAU,CAAClC,SAAS,EAAEG,IAAI,CAAC,IAAIH,SAAS,EAAEG,IAAI,KAAKL,aAAa,CAAC6B,IAAI;AAC9E","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/components/types.ts"],"sourcesContent":["import { type LanguageMessages } from 'joi'\n\nimport {\n type ComponentType,\n type GeospatialFieldGeometryTypesEnum,\n type PreviewTypeEnum\n} from '~/src/components/enums.js'\nimport {\n type ListTypeContent,\n type ListTypeOption\n} from '~/src/form/form-definition/types.js'\n\nexport type ConditionalComponentType = Exclude<\n ConditionalComponentsDef['type'],\n ContentComponentsDef\n>\n\n/**\n * Types for Components JSON structure which are expected by engine and turned into actual form input/content/lists\n */\n\ninterface FormFieldBase {\n id?: string\n type: FormComponentsDef['type']\n shortDescription?: string\n errorDescription?: string\n name: string\n title: string\n hint?: string\n options: {\n required?: boolean\n optionalText?: boolean\n classes?: string\n customValidationMessages?: LanguageMessages\n instructionText?: string\n }\n}\n\ninterface ListFieldBase extends FormFieldBase {\n type:\n | ComponentType.AutocompleteField\n | ComponentType.CheckboxesField\n | ComponentType.RadiosField\n | ComponentType.SelectField\n list: string\n options: FormFieldBase['options'] & {\n type?: ListTypeContent\n }\n}\n\ninterface ContentFieldBase {\n id?: string\n type:\n | ComponentType.Details\n | ComponentType.Html\n | ComponentType.Markdown\n | ComponentType.InsetText\n | ComponentType.List\n | ComponentType.NotificationBanner\n name: string\n title: string\n options?: {\n required?: undefined\n optionalText?: undefined\n }\n}\n\ninterface DateFieldBase extends FormFieldBase {\n type: ComponentType.DatePartsField\n name: string\n title: string\n hint?: string\n options: FormFieldBase['options'] & {\n maxDaysInPast?: number\n maxDaysInFuture?: number\n earliestDate?: string\n latestDate?: string\n }\n}\n\n// Text Fields\nexport interface TextFieldComponent extends FormFieldBase {\n type: ComponentType.TextField\n options: FormFieldBase['options'] & {\n autocomplete?: string\n condition?: string\n customValidationMessage?: string\n }\n schema: {\n max?: number\n min?: number\n length?: number\n regex?: string\n }\n}\n\nexport interface EmailAddressFieldComponent extends FormFieldBase {\n type: ComponentType.EmailAddressField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface NumberFieldComponent extends FormFieldBase {\n type: ComponentType.NumberField\n options: FormFieldBase['options'] & {\n prefix?: string\n suffix?: string\n autocomplete?: string\n condition?: string\n customValidationMessage?: string\n }\n schema: {\n max?: number\n min?: number\n precision?: number\n minPrecision?: number\n minLength?: number\n maxLength?: number\n }\n}\n\nexport type TelephoneNumberFieldOptionsFormat = 'international' | 'uk'\n\nexport interface TelephoneNumberFieldComponent extends FormFieldBase {\n type: ComponentType.TelephoneNumberField\n options: FormFieldBase['options'] & {\n condition?: string\n format?: TelephoneNumberFieldOptionsFormat\n customValidationMessage?: string\n }\n}\n\nexport interface FileUploadFieldComponent extends FormFieldBase {\n type: ComponentType.FileUploadField\n name: string\n title: string\n hint?: string\n options: FormFieldBase['options'] & {\n accept?: string\n }\n schema: {\n max?: number\n min?: number\n length?: number\n }\n}\n\nexport interface YesNoFieldComponent extends FormFieldBase {\n type: ComponentType.YesNoField\n options: FormFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface DeclarationFieldComponent extends FormFieldBase {\n type: ComponentType.DeclarationField\n content: string\n options: FormFieldBase['options'] & {\n condition?: string\n declarationConfirmationLabel?: string\n }\n}\n\nexport interface MultilineTextFieldComponent extends FormFieldBase {\n type: ComponentType.MultilineTextField\n options: FormFieldBase['options'] & {\n autocomplete?: string\n condition?: string\n customValidationMessage?: string\n rows?: number\n maxWords?: number\n }\n schema: {\n max?: number\n min?: number\n length?: number\n regex?: string\n }\n}\n\nexport interface UkAddressFieldComponent extends FormFieldBase {\n type: ComponentType.UkAddressField\n options: FormFieldBase['options'] & {\n hideTitle?: boolean\n usePostcodeLookup?: boolean\n }\n}\n\n// Precise Location Fields\nexport interface EastingNorthingFieldComponent extends FormFieldBase {\n type: ComponentType.EastingNorthingField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n schema?: {\n easting?: {\n min?: number\n max?: number\n }\n northing?: {\n min?: number\n max?: number\n }\n }\n}\n\nexport interface OsGridRefFieldComponent extends FormFieldBase {\n type: ComponentType.OsGridRefField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface NationalGridFieldNumberFieldComponent extends FormFieldBase {\n type: ComponentType.NationalGridFieldNumberField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface LatLongFieldComponent extends FormFieldBase {\n type: ComponentType.LatLongField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n schema?: {\n latitude?: {\n min?: number\n max?: number\n }\n longitude?: {\n min?: number\n max?: number\n }\n }\n}\n\nexport interface HiddenFieldComponent extends FormFieldBase {\n type: ComponentType.HiddenField\n options: FormFieldBase['options'] & {\n condition?: string\n }\n}\n\n// Date Fields\nexport interface DatePartsFieldComponent extends DateFieldBase {\n type: ComponentType.DatePartsField\n options: DateFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface MonthYearFieldComponent extends FormFieldBase {\n type: ComponentType.MonthYearField\n options: FormFieldBase['options'] & {\n customValidationMessage?: string\n earliestMonthYear?: string\n latestMonthYear?: string\n }\n}\n\nexport interface PaymentFieldComponent extends FormFieldBase {\n type: ComponentType.PaymentField\n options: FormFieldBase['options'] & {\n amount: number\n description: string\n conditionalAmounts?: {\n condition: string\n amount: number\n }[]\n emailField?: string\n }\n}\n\nexport type GeospatialFieldOptionsCountry =\n | 'england'\n | 'wales'\n | 'northern-ireland'\n | 'scotland'\n\nexport interface GeospatialFieldComponent extends FormFieldBase {\n type: ComponentType.GeospatialField\n options: FormFieldBase['options'] & {\n condition?: string\n countries?: GeospatialFieldOptionsCountry[]\n geometryTypes?: GeospatialFieldGeometryTypesEnum[]\n }\n schema?: {\n max?: number\n min?: number\n length?: number\n }\n}\n\n// Content Fields\nexport interface DetailsComponent extends ContentFieldBase {\n type: ComponentType.Details\n content: string\n options: ContentFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface HtmlComponent extends ContentFieldBase {\n type: ComponentType.Html\n content: string\n options: ContentFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface MarkdownComponent extends ContentFieldBase {\n type: ComponentType.Markdown\n content: string\n options: ContentFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface InsetTextComponent extends ContentFieldBase {\n type: ComponentType.InsetText\n content: string\n}\n\nexport interface ListComponent extends ContentFieldBase {\n type: ComponentType.List\n hint?: string\n list: string\n options: ContentFieldBase['options'] & {\n type?: ListTypeOption\n classes?: string\n hideTitle?: boolean\n bold?: boolean\n }\n}\n\nexport interface NotificationBannerComponent extends ContentFieldBase {\n type: ComponentType.NotificationBanner\n content: string\n options: ContentFieldBase['options'] & {\n type?: 'success'\n heading?: string\n condition?: string\n }\n}\n\nexport interface AutocompleteFieldComponent extends ListFieldBase {\n type: ComponentType.AutocompleteField\n options: ListFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface CheckboxesFieldComponent extends ListFieldBase {\n type: ComponentType.CheckboxesField\n options: ListFieldBase['options'] & {\n bold?: boolean\n condition?: string\n }\n schema?: {\n max?: number\n min?: number\n length?: number\n }\n}\n\nexport interface RadiosFieldComponent extends ListFieldBase {\n type: ComponentType.RadiosField\n options: ListFieldBase['options'] & {\n bold?: boolean\n condition?: string\n }\n}\n\nexport interface SelectFieldComponent extends ListFieldBase {\n type: ComponentType.SelectField\n options: ListFieldBase['options'] & {\n autocomplete?: string\n condition?: string\n }\n}\n\nexport type ComponentDef = FormComponentsDef | ContentComponentsDef\n\n// Components that render form fields\nexport type FormComponentsDef =\n | InputFieldsComponentsDef\n | SelectionComponentsDef\n\n// Components that render inputs\nexport type InputFieldsComponentsDef =\n | TextFieldComponent\n | EmailAddressFieldComponent\n | NumberFieldComponent\n | MultilineTextFieldComponent\n | TelephoneNumberFieldComponent\n | MonthYearFieldComponent\n | DatePartsFieldComponent\n | UkAddressFieldComponent\n | FileUploadFieldComponent\n | DeclarationFieldComponent\n | EastingNorthingFieldComponent\n | OsGridRefFieldComponent\n | NationalGridFieldNumberFieldComponent\n | LatLongFieldComponent\n | HiddenFieldComponent\n | PaymentFieldComponent\n | GeospatialFieldComponent\n\n// Components that render content\nexport type ContentComponentsDef =\n | DetailsComponent\n | HtmlComponent\n | MarkdownComponent\n | InsetTextComponent\n | ListComponent\n | NotificationBannerComponent\n\n// Components that render lists\nexport type ListComponentsDef =\n | Exclude<SelectionComponentsDef, YesNoFieldComponent>\n | ListComponent\n\n// Components that have selection fields\nexport type SelectionComponentsDef =\n | AutocompleteFieldComponent\n | CheckboxesFieldComponent\n | RadiosFieldComponent\n | SelectFieldComponent\n | YesNoFieldComponent\n\n// Components that have condition support\nexport type ConditionalComponentsDef = Exclude<\n ComponentDef,\n | InsetTextComponent\n | ListComponent\n | MonthYearFieldComponent\n | UkAddressFieldComponent\n | FileUploadFieldComponent\n | PaymentFieldComponent\n>\n\nexport type PreviewType = keyof typeof PreviewTypeEnum\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/components/types.ts"],"sourcesContent":["import { type LanguageMessages } from 'joi'\n\nimport {\n type ComponentType,\n type GeospatialFieldGeometryTypesEnum,\n type PreviewTypeEnum\n} from '~/src/components/enums.js'\nimport {\n type ListTypeContent,\n type ListTypeOption\n} from '~/src/form/form-definition/types.js'\n\nexport type ConditionalComponentType = Exclude<\n ConditionalComponentsDef['type'],\n ContentComponentsDef\n>\n\n/**\n * Types for Components JSON structure which are expected by engine and turned into actual form input/content/lists\n */\n\ninterface FormFieldBase {\n id?: string\n type: FormComponentsDef['type']\n shortDescription?: string\n errorDescription?: string\n name: string\n title: string\n hint?: string\n options: {\n required?: boolean\n optionalText?: boolean\n classes?: string\n customValidationMessages?: LanguageMessages\n instructionText?: string\n }\n}\n\ninterface ListFieldBase extends FormFieldBase {\n type:\n | ComponentType.AutocompleteField\n | ComponentType.CheckboxesField\n | ComponentType.RadiosField\n | ComponentType.SelectField\n list: string\n options: FormFieldBase['options'] & {\n type?: ListTypeContent\n }\n}\n\ninterface ContentFieldBase {\n id?: string\n type:\n | ComponentType.Details\n | ComponentType.Html\n | ComponentType.Markdown\n | ComponentType.InsetText\n | ComponentType.List\n | ComponentType.NotificationBanner\n name: string\n title: string\n options?: {\n required?: undefined\n optionalText?: undefined\n }\n}\n\ninterface DateFieldBase extends FormFieldBase {\n type: ComponentType.DatePartsField\n name: string\n title: string\n hint?: string\n options: FormFieldBase['options'] & {\n maxDaysInPast?: number\n maxDaysInFuture?: number\n earliestDate?: string\n latestDate?: string\n }\n}\n\n// Text Fields\nexport interface TextFieldComponent extends FormFieldBase {\n type: ComponentType.TextField\n options: FormFieldBase['options'] & {\n autocomplete?: string\n condition?: string\n customValidationMessage?: string\n }\n schema: {\n max?: number\n min?: number\n length?: number\n regex?: string\n }\n}\n\nexport interface EmailAddressFieldComponent extends FormFieldBase {\n type: ComponentType.EmailAddressField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface NumberFieldComponent extends FormFieldBase {\n type: ComponentType.NumberField\n options: FormFieldBase['options'] & {\n prefix?: string\n suffix?: string\n autocomplete?: string\n condition?: string\n customValidationMessage?: string\n }\n schema: {\n max?: number\n min?: number\n precision?: number\n minPrecision?: number\n minLength?: number\n maxLength?: number\n }\n}\n\nexport type TelephoneNumberFieldOptionsFormat = 'international' | 'uk'\n\nexport interface TelephoneNumberFieldComponent extends FormFieldBase {\n type: ComponentType.TelephoneNumberField\n options: FormFieldBase['options'] & {\n condition?: string\n format?: TelephoneNumberFieldOptionsFormat\n customValidationMessage?: string\n }\n}\n\nexport interface FileUploadFieldComponent extends FormFieldBase {\n type: ComponentType.FileUploadField\n name: string\n title: string\n hint?: string\n options: FormFieldBase['options'] & {\n accept?: string\n }\n schema: {\n max?: number\n min?: number\n length?: number\n }\n}\n\nexport interface YesNoFieldComponent extends FormFieldBase {\n type: ComponentType.YesNoField\n options: FormFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface DeclarationFieldComponent extends FormFieldBase {\n type: ComponentType.DeclarationField\n content: string\n options: FormFieldBase['options'] & {\n condition?: string\n declarationConfirmationLabel?: string\n }\n}\n\nexport interface MultilineTextFieldComponent extends FormFieldBase {\n type: ComponentType.MultilineTextField\n options: FormFieldBase['options'] & {\n autocomplete?: string\n condition?: string\n customValidationMessage?: string\n rows?: number\n maxWords?: number\n }\n schema: {\n max?: number\n min?: number\n length?: number\n regex?: string\n }\n}\n\nexport interface UkAddressFieldComponent extends FormFieldBase {\n type: ComponentType.UkAddressField\n options: FormFieldBase['options'] & {\n hideTitle?: boolean\n usePostcodeLookup?: boolean\n }\n}\n\nexport interface MapLayerOptions {\n sssi?: boolean\n}\n\n// Precise Location Fields\nexport interface EastingNorthingFieldComponent extends FormFieldBase {\n type: ComponentType.EastingNorthingField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n mapLayers?: MapLayerOptions\n }\n schema?: {\n easting?: {\n min?: number\n max?: number\n }\n northing?: {\n min?: number\n max?: number\n }\n }\n}\n\nexport interface OsGridRefFieldComponent extends FormFieldBase {\n type: ComponentType.OsGridRefField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n mapLayers?: MapLayerOptions\n }\n}\n\nexport interface NationalGridFieldNumberFieldComponent extends FormFieldBase {\n type: ComponentType.NationalGridFieldNumberField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface LatLongFieldComponent extends FormFieldBase {\n type: ComponentType.LatLongField\n options: FormFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n mapLayers?: MapLayerOptions\n }\n schema?: {\n latitude?: {\n min?: number\n max?: number\n }\n longitude?: {\n min?: number\n max?: number\n }\n }\n}\n\nexport interface HiddenFieldComponent extends FormFieldBase {\n type: ComponentType.HiddenField\n options: FormFieldBase['options'] & {\n condition?: string\n }\n}\n\n// Date Fields\nexport interface DatePartsFieldComponent extends DateFieldBase {\n type: ComponentType.DatePartsField\n options: DateFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface MonthYearFieldComponent extends FormFieldBase {\n type: ComponentType.MonthYearField\n options: FormFieldBase['options'] & {\n customValidationMessage?: string\n earliestMonthYear?: string\n latestMonthYear?: string\n }\n}\n\nexport interface PaymentFieldComponent extends FormFieldBase {\n type: ComponentType.PaymentField\n options: FormFieldBase['options'] & {\n amount: number\n description: string\n conditionalAmounts?: {\n condition: string\n amount: number\n }[]\n emailField?: string\n }\n}\n\nexport type GeospatialFieldOptionsCountry =\n | 'england'\n | 'wales'\n | 'northern-ireland'\n | 'scotland'\n\nexport interface GeospatialFieldComponent extends FormFieldBase {\n type: ComponentType.GeospatialField\n options: FormFieldBase['options'] & {\n condition?: string\n countries?: GeospatialFieldOptionsCountry[]\n geometryTypes?: GeospatialFieldGeometryTypesEnum[]\n mapLayers?: MapLayerOptions\n }\n schema?: {\n max?: number\n min?: number\n length?: number\n }\n}\n\n// Content Fields\nexport interface DetailsComponent extends ContentFieldBase {\n type: ComponentType.Details\n content: string\n options: ContentFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface HtmlComponent extends ContentFieldBase {\n type: ComponentType.Html\n content: string\n options: ContentFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface MarkdownComponent extends ContentFieldBase {\n type: ComponentType.Markdown\n content: string\n options: ContentFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface InsetTextComponent extends ContentFieldBase {\n type: ComponentType.InsetText\n content: string\n}\n\nexport interface ListComponent extends ContentFieldBase {\n type: ComponentType.List\n hint?: string\n list: string\n options: ContentFieldBase['options'] & {\n type?: ListTypeOption\n classes?: string\n hideTitle?: boolean\n bold?: boolean\n }\n}\n\nexport interface NotificationBannerComponent extends ContentFieldBase {\n type: ComponentType.NotificationBanner\n content: string\n options: ContentFieldBase['options'] & {\n type?: 'success'\n heading?: string\n condition?: string\n }\n}\n\nexport interface AutocompleteFieldComponent extends ListFieldBase {\n type: ComponentType.AutocompleteField\n options: ListFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface CheckboxesFieldComponent extends ListFieldBase {\n type: ComponentType.CheckboxesField\n options: ListFieldBase['options'] & {\n bold?: boolean\n condition?: string\n }\n schema?: {\n max?: number\n min?: number\n length?: number\n }\n}\n\nexport interface RadiosFieldComponent extends ListFieldBase {\n type: ComponentType.RadiosField\n options: ListFieldBase['options'] & {\n bold?: boolean\n condition?: string\n }\n}\n\nexport interface SelectFieldComponent extends ListFieldBase {\n type: ComponentType.SelectField\n options: ListFieldBase['options'] & {\n autocomplete?: string\n condition?: string\n }\n}\n\nexport type ComponentDef = FormComponentsDef | ContentComponentsDef\n\n// Components that render form fields\nexport type FormComponentsDef =\n | InputFieldsComponentsDef\n | SelectionComponentsDef\n\n// Components that render inputs\nexport type InputFieldsComponentsDef =\n | TextFieldComponent\n | EmailAddressFieldComponent\n | NumberFieldComponent\n | MultilineTextFieldComponent\n | TelephoneNumberFieldComponent\n | MonthYearFieldComponent\n | DatePartsFieldComponent\n | UkAddressFieldComponent\n | FileUploadFieldComponent\n | DeclarationFieldComponent\n | EastingNorthingFieldComponent\n | OsGridRefFieldComponent\n | NationalGridFieldNumberFieldComponent\n | LatLongFieldComponent\n | HiddenFieldComponent\n | PaymentFieldComponent\n | GeospatialFieldComponent\n\n// Components that render content\nexport type ContentComponentsDef =\n | DetailsComponent\n | HtmlComponent\n | MarkdownComponent\n | InsetTextComponent\n | ListComponent\n | NotificationBannerComponent\n\n// Components that render lists\nexport type ListComponentsDef =\n | Exclude<SelectionComponentsDef, YesNoFieldComponent>\n | ListComponent\n\n// Components that have selection fields\nexport type SelectionComponentsDef =\n | AutocompleteFieldComponent\n | CheckboxesFieldComponent\n | RadiosFieldComponent\n | SelectFieldComponent\n | YesNoFieldComponent\n\n// Components that have instruction fields\nexport type ComponentsDefWithInstructions =\n | EastingNorthingFieldComponent\n | OsGridRefFieldComponent\n | NationalGridFieldNumberFieldComponent\n | LatLongFieldComponent\n\n// Components that have condition support\nexport type ConditionalComponentsDef = Exclude<\n ComponentDef,\n | InsetTextComponent\n | ListComponent\n | MonthYearFieldComponent\n | UkAddressFieldComponent\n | FileUploadFieldComponent\n | PaymentFieldComponent\n>\n\nexport type PreviewType = keyof typeof PreviewTypeEnum\n"],"mappings":"","ignoreList":[]}
|
|
@@ -260,6 +260,12 @@ export const componentSchema = Joi.object().description('Form component definiti
|
|
|
260
260
|
is: Joi.string().trim().valid(ComponentType.GeospatialField).required(),
|
|
261
261
|
then: Joi.array().items(Joi.string().valid(...Object.values(GeospatialFieldGeometryTypesEnum))).description('Geometry types for geospatial data - for GeospatialField only')
|
|
262
262
|
}).description('Geometry types - for GeospatialField only'),
|
|
263
|
+
mapLayers: Joi.when('type', {
|
|
264
|
+
is: Joi.string().trim().valid(ComponentType.GeospatialField, ComponentType.EastingNorthingField, ComponentType.LatLongField, ComponentType.OsGridRefField).required(),
|
|
265
|
+
then: Joi.object().keys({
|
|
266
|
+
sssi: Joi.boolean().optional().description('Sites of Special Scientific Interest layer')
|
|
267
|
+
}).optional().description('Supported map layers')
|
|
268
|
+
}).description('Map layers'),
|
|
263
269
|
format: Joi.when('type', {
|
|
264
270
|
is: Joi.string().trim().valid(ComponentType.TelephoneNumberField).required(),
|
|
265
271
|
then: Joi.string().valid(...Object.values(TelephoneNumberFieldOptionsFormatEnum)).description('Format for telephone number - for TelephoneNumberField only')
|