@defra/forms-model 3.0.465 → 3.0.467
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 +151 -39
- package/dist/module/__stubs__/components.js.map +1 -1
- package/dist/module/__stubs__/pages.js +10 -19
- package/dist/module/__stubs__/pages.js.map +1 -1
- package/dist/module/form/form-definition/index.js +15 -1
- package/dist/module/form/form-definition/index.js.map +1 -1
- package/dist/module/pages/helpers.js +34 -0
- package/dist/module/pages/helpers.js.map +1 -1
- package/dist/module/pages/index.js +1 -1
- package/dist/module/pages/index.js.map +1 -1
- package/dist/types/__stubs__/components.d.ts +19 -7
- package/dist/types/__stubs__/components.d.ts.map +1 -1
- package/dist/types/__stubs__/pages.d.ts.map +1 -1
- package/dist/types/form/form-definition/index.d.ts +4 -1
- package/dist/types/form/form-definition/index.d.ts.map +1 -1
- package/dist/types/pages/helpers.d.ts +7 -0
- package/dist/types/pages/helpers.d.ts.map +1 -1
- package/dist/types/pages/index.d.ts +1 -1
- package/dist/types/pages/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/schemas/form-definition-v2-schema.json +527 -149
- package/schemas/page-schema-v2.json +527 -149
- package/src/__stubs__/components.ts +190 -44
- package/src/__stubs__/pages.ts +10 -18
- package/src/form/form-definition/index.ts +52 -6
- package/src/pages/helpers.ts +38 -0
- package/src/pages/index.ts +3 -1
@@ -4,18 +4,142 @@ import { ComponentType } from "../components/enums.js";
|
|
4
4
|
* @returns {TextFieldComponent}
|
5
5
|
*/
|
6
6
|
export function buildTextFieldComponent(partialTextField = {}) {
|
7
|
-
|
7
|
+
return {
|
8
8
|
id: '407dd0d7-cce9-4f43-8e1f-7d89cb698875',
|
9
9
|
name: 'TextField',
|
10
10
|
title: 'Text field',
|
11
|
-
type: ComponentType.TextField,
|
12
11
|
hint: '',
|
13
12
|
options: {},
|
14
|
-
schema: {}
|
13
|
+
schema: {},
|
14
|
+
...partialTextField,
|
15
|
+
type: ComponentType.TextField
|
16
|
+
};
|
17
|
+
}
|
18
|
+
export function buildMultilineTextFieldComponent(partialMultilineTextField = {}) {
|
19
|
+
return {
|
20
|
+
id: '72671f23-552e-4504-a06a-693e240880d5',
|
21
|
+
name: 'MuTeCo',
|
22
|
+
options: {},
|
23
|
+
schema: {},
|
24
|
+
title: 'Multiline TextField Component',
|
25
|
+
...partialMultilineTextField,
|
26
|
+
type: ComponentType.MultilineTextField
|
27
|
+
};
|
28
|
+
}
|
29
|
+
export function buildYesNoFieldComponent(partialYesNoField = {}) {
|
30
|
+
return {
|
31
|
+
title: 'YesNo Field Component',
|
32
|
+
id: 'be7f849c-47d8-4f1f-ba15-ab939dc70914',
|
33
|
+
name: 'YesNoFieldComponent',
|
34
|
+
options: {},
|
35
|
+
...partialYesNoField,
|
36
|
+
type: ComponentType.YesNoField
|
37
|
+
};
|
38
|
+
}
|
39
|
+
export function buildMonthYearFieldComponent(partialMonthYearField = {}) {
|
40
|
+
return {
|
41
|
+
id: 'd4e99aca-6d13-4c1a-a623-9e9e5b27d46d',
|
42
|
+
title: 'MonthYearFieldComponent',
|
43
|
+
name: 'MonthYearFieldComponent',
|
44
|
+
options: {},
|
45
|
+
...partialMonthYearField,
|
46
|
+
type: ComponentType.MonthYearField
|
47
|
+
};
|
48
|
+
}
|
49
|
+
export function buildSelectFieldComponent(partialSelectField = {}) {
|
50
|
+
return {
|
51
|
+
id: '7f219cf6-3e16-4549-b8df-789506682147',
|
52
|
+
list: '',
|
53
|
+
name: '',
|
54
|
+
options: {},
|
55
|
+
title: '',
|
56
|
+
...partialSelectField,
|
57
|
+
type: ComponentType.SelectField
|
58
|
+
};
|
59
|
+
}
|
60
|
+
export function buildUkAddressFieldComponent(partialUkAddressField = {}) {
|
61
|
+
return {
|
62
|
+
id: 'a7cb7440-9095-44cd-9136-2914232722c8',
|
63
|
+
title: 'UkAddressFieldComponent',
|
64
|
+
name: 'UkAddressFieldComponent',
|
65
|
+
options: {},
|
66
|
+
...partialUkAddressField,
|
67
|
+
type: ComponentType.UkAddressField
|
68
|
+
};
|
69
|
+
}
|
70
|
+
export function buildTelephoneNumberFieldComponent(partialTelephoneNumberField = {}) {
|
71
|
+
return {
|
72
|
+
id: '69907916-beac-4faa-b469-656dad5edced',
|
73
|
+
title: 'TelephoneNumberFieldComponent',
|
74
|
+
name: 'TelephoneNumberFieldComponent',
|
75
|
+
options: {},
|
76
|
+
...partialTelephoneNumberField,
|
77
|
+
type: ComponentType.TelephoneNumberField
|
78
|
+
};
|
79
|
+
}
|
80
|
+
export function buildEmailAddressFieldComponent(partialEmailAddressField = {}) {
|
81
|
+
return {
|
82
|
+
id: '9dcf0781-bf34-48c8-b13b-d13050dc34d9',
|
83
|
+
title: 'EmailAddressFieldComponent',
|
84
|
+
name: 'EmailAddressFieldComponent',
|
85
|
+
options: {},
|
86
|
+
...partialEmailAddressField,
|
87
|
+
type: ComponentType.EmailAddressField
|
88
|
+
};
|
89
|
+
}
|
90
|
+
export function buildHtmlComponent(partialHtml = {}) {
|
91
|
+
return {
|
92
|
+
id: 'bac683ce-149e-4740-95aa-8289b35bc327',
|
93
|
+
title: 'HtmlComponent',
|
94
|
+
name: 'HtmlComponent',
|
95
|
+
options: {},
|
96
|
+
content: '',
|
97
|
+
...partialHtml,
|
98
|
+
type: ComponentType.Html
|
15
99
|
};
|
100
|
+
}
|
101
|
+
export function buildInsetTextComponent(partialInsetText = {}) {
|
16
102
|
return {
|
17
|
-
|
18
|
-
|
103
|
+
id: '6b717151-1e86-42b2-97a9-2201b0676e47',
|
104
|
+
title: 'InsetText Component',
|
105
|
+
name: 'InsetTextComponent',
|
106
|
+
content: '',
|
107
|
+
options: {},
|
108
|
+
...partialInsetText,
|
109
|
+
type: ComponentType.InsetText
|
110
|
+
};
|
111
|
+
}
|
112
|
+
export function buildDetailsComponent(partialDetails = {}) {
|
113
|
+
return {
|
114
|
+
id: '245d54df-bb1e-488e-82f6-8f1e42c197e6',
|
115
|
+
title: 'Details Component',
|
116
|
+
name: 'DetailsComponent',
|
117
|
+
content: '',
|
118
|
+
options: {},
|
119
|
+
...partialDetails,
|
120
|
+
type: ComponentType.Details
|
121
|
+
};
|
122
|
+
}
|
123
|
+
export function buildListComponent(partialList = {}) {
|
124
|
+
return {
|
125
|
+
id: '62f17168-c2ef-4978-bd42-bdaa5704e25f',
|
126
|
+
title: 'List Component',
|
127
|
+
name: 'ListComponent',
|
128
|
+
list: '',
|
129
|
+
options: {},
|
130
|
+
...partialList,
|
131
|
+
type: ComponentType.List
|
132
|
+
};
|
133
|
+
}
|
134
|
+
export function buildMarkdownComponent(partialMarkdown = {}) {
|
135
|
+
return {
|
136
|
+
id: '4a2dc88c-be1a-4277-aff8-04220de2e778',
|
137
|
+
title: 'Markdown Component',
|
138
|
+
name: 'MarkdownComponent',
|
139
|
+
options: {},
|
140
|
+
content: '',
|
141
|
+
...partialMarkdown,
|
142
|
+
type: ComponentType.Markdown
|
19
143
|
};
|
20
144
|
}
|
21
145
|
|
@@ -23,17 +147,14 @@ export function buildTextFieldComponent(partialTextField = {}) {
|
|
23
147
|
* @param {Partial<FileUploadFieldComponent>} partialFileUploadField
|
24
148
|
* @returns {FileUploadFieldComponent}
|
25
149
|
*/
|
26
|
-
export function buildFileUploadComponent(partialFileUploadField) {
|
27
|
-
|
150
|
+
export function buildFileUploadComponent(partialFileUploadField = {}) {
|
151
|
+
return {
|
28
152
|
name: 'FileUploadField',
|
29
|
-
type: ComponentType.FileUploadField,
|
30
153
|
title: 'File Upload Field',
|
31
154
|
options: {},
|
32
|
-
schema: {}
|
33
|
-
|
34
|
-
|
35
|
-
...fileUploadFieldComponent,
|
36
|
-
...partialFileUploadField
|
155
|
+
schema: {},
|
156
|
+
...partialFileUploadField,
|
157
|
+
type: ComponentType.FileUploadField
|
37
158
|
};
|
38
159
|
}
|
39
160
|
|
@@ -42,17 +163,14 @@ export function buildFileUploadComponent(partialFileUploadField) {
|
|
42
163
|
* @param {Partial<AutocompleteFieldComponent>} partialAutoCompleteField
|
43
164
|
* @returns {AutocompleteFieldComponent}
|
44
165
|
*/
|
45
|
-
export function buildAutoCompleteComponent(partialAutoCompleteField) {
|
46
|
-
|
166
|
+
export function buildAutoCompleteComponent(partialAutoCompleteField = {}) {
|
167
|
+
return {
|
47
168
|
name: 'AutoCompleteField',
|
48
169
|
title: 'What languages do you speak?',
|
49
|
-
type: ComponentType.AutocompleteField,
|
50
170
|
list: 'AutoCompleteList',
|
51
|
-
options: {}
|
52
|
-
|
53
|
-
|
54
|
-
...autocompleteComponent,
|
55
|
-
...partialAutoCompleteField
|
171
|
+
options: {},
|
172
|
+
...partialAutoCompleteField,
|
173
|
+
type: ComponentType.AutocompleteField
|
56
174
|
};
|
57
175
|
}
|
58
176
|
|
@@ -61,16 +179,13 @@ export function buildAutoCompleteComponent(partialAutoCompleteField) {
|
|
61
179
|
* @returns {RadiosFieldComponent}
|
62
180
|
*/
|
63
181
|
export function buildRadioComponent(partialListComponent = {}) {
|
64
|
-
|
182
|
+
return {
|
65
183
|
name: 'RadioField',
|
66
184
|
title: 'Which country do you live in?',
|
67
|
-
type: ComponentType.RadiosField,
|
68
185
|
list: 'RadioList',
|
69
|
-
options: {}
|
70
|
-
|
71
|
-
|
72
|
-
...radioFieldComponent,
|
73
|
-
...partialListComponent
|
186
|
+
options: {},
|
187
|
+
...partialListComponent,
|
188
|
+
type: ComponentType.RadiosField
|
74
189
|
};
|
75
190
|
}
|
76
191
|
|
@@ -78,17 +193,14 @@ export function buildRadioComponent(partialListComponent = {}) {
|
|
78
193
|
* @param {Partial<CheckboxesFieldComponent>} partialListComponent
|
79
194
|
* @returns {CheckboxesFieldComponent}
|
80
195
|
*/
|
81
|
-
export function buildCheckboxComponent(partialListComponent) {
|
82
|
-
|
196
|
+
export function buildCheckboxComponent(partialListComponent = {}) {
|
197
|
+
return {
|
83
198
|
name: 'FellowshipOfTheRing',
|
84
199
|
title: 'Which are your favourite characters from the fellowship?',
|
85
|
-
type: ComponentType.CheckboxesField,
|
86
200
|
list: 'CheckboxList',
|
87
|
-
options: {}
|
88
|
-
|
89
|
-
|
90
|
-
...checkboxesFieldComponent,
|
91
|
-
...partialListComponent
|
201
|
+
options: {},
|
202
|
+
...partialListComponent,
|
203
|
+
type: ComponentType.CheckboxesField
|
92
204
|
};
|
93
205
|
}
|
94
206
|
|
@@ -136,7 +248,7 @@ export function buildList(partialList = {}) {
|
|
136
248
|
...partialList
|
137
249
|
};
|
138
250
|
}
|
139
|
-
export function buildNumberFieldComponent(partialComponent) {
|
251
|
+
export function buildNumberFieldComponent(partialComponent = {}) {
|
140
252
|
return {
|
141
253
|
name: 'year',
|
142
254
|
title: 'Year',
|
@@ -146,7 +258,7 @@ export function buildNumberFieldComponent(partialComponent) {
|
|
146
258
|
type: ComponentType.NumberField
|
147
259
|
};
|
148
260
|
}
|
149
|
-
export function buildDateComponent(partialComponent) {
|
261
|
+
export function buildDateComponent(partialComponent = {}) {
|
150
262
|
return {
|
151
263
|
name: 'bcdefg',
|
152
264
|
title: 'Default title',
|
@@ -155,7 +267,7 @@ export function buildDateComponent(partialComponent) {
|
|
155
267
|
type: ComponentType.DatePartsField
|
156
268
|
};
|
157
269
|
}
|
158
|
-
export function buildRadiosComponent(partialComponent) {
|
270
|
+
export function buildRadiosComponent(partialComponent = {}) {
|
159
271
|
return {
|
160
272
|
name: 'cdefgh',
|
161
273
|
title: 'Default title',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"components.js","names":["ComponentType","buildTextFieldComponent","partialTextField","textFieldComponent","id","name","title","type","TextField","hint","options","schema","buildFileUploadComponent","partialFileUploadField","fileUploadFieldComponent","FileUploadField","buildAutoCompleteComponent","partialAutoCompleteField","autocompleteComponent","AutocompleteField","list","buildRadioComponent","partialListComponent","radioFieldComponent","RadiosField","buildCheckboxComponent","checkboxesFieldComponent","CheckboxesField","buildListItem","partialListItem","text","value","buildList","partialList","items","buildNumberFieldComponent","partialComponent","NumberField","buildDateComponent","DatePartsField","buildRadiosComponent"],"sources":["../../../src/__stubs__/components.ts"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport {\n type AutocompleteFieldComponent,\n type CheckboxesFieldComponent,\n type DatePartsFieldComponent,\n type FileUploadFieldComponent,\n type NumberFieldComponent,\n type RadiosFieldComponent,\n type TextFieldComponent\n} from '~/src/components/types.js'\nimport { type Item, type List } from '~/src/form/form-definition/types.js'\n\n/**\n * @param {Partial<TextFieldComponent>} partialTextField\n * @returns {TextFieldComponent}\n */\nexport function buildTextFieldComponent(\n partialTextField: Partial<TextFieldComponent> = {}\n): TextFieldComponent {\n const textFieldComponent: TextFieldComponent = {\n id: '407dd0d7-cce9-4f43-8e1f-7d89cb698875',\n name: 'TextField',\n title: 'Text field',\n type: ComponentType.TextField,\n hint: '',\n options: {},\n schema: {}\n }\n\n return {\n ...textFieldComponent,\n ...partialTextField\n }\n}\n\n/**\n * @param {Partial<FileUploadFieldComponent>} partialFileUploadField\n * @returns {FileUploadFieldComponent}\n */\nexport function buildFileUploadComponent(\n partialFileUploadField: Partial<FileUploadFieldComponent>\n): FileUploadFieldComponent {\n const fileUploadFieldComponent: FileUploadFieldComponent = {\n name: 'FileUploadField',\n type: ComponentType.FileUploadField,\n title: 'File Upload Field',\n options: {},\n schema: {}\n }\n\n return {\n ...fileUploadFieldComponent,\n ...partialFileUploadField\n }\n}\n\n/**\n *\n * @param {Partial<AutocompleteFieldComponent>} partialAutoCompleteField\n * @returns {AutocompleteFieldComponent}\n */\nexport function buildAutoCompleteComponent(\n partialAutoCompleteField: Partial<AutocompleteFieldComponent>\n): AutocompleteFieldComponent {\n const autocompleteComponent: AutocompleteFieldComponent = {\n name: 'AutoCompleteField',\n title: 'What languages do you speak?',\n type: ComponentType.AutocompleteField,\n list: 'AutoCompleteList',\n options: {}\n }\n\n return {\n ...autocompleteComponent,\n ...partialAutoCompleteField\n }\n}\n\n/**\n * @param {Partial<RadiosFieldComponent>} partialListComponent\n * @returns {RadiosFieldComponent}\n */\nexport function buildRadioComponent(\n partialListComponent: Partial<RadiosFieldComponent> = {}\n): RadiosFieldComponent {\n const radioFieldComponent: RadiosFieldComponent = {\n name: 'RadioField',\n title: 'Which country do you live in?',\n type: ComponentType.RadiosField,\n list: 'RadioList',\n options: {}\n }\n\n return {\n ...radioFieldComponent,\n ...partialListComponent\n }\n}\n\n/**\n * @param {Partial<CheckboxesFieldComponent>} partialListComponent\n * @returns {CheckboxesFieldComponent}\n */\nexport function buildCheckboxComponent(\n partialListComponent: Partial<CheckboxesFieldComponent>\n): CheckboxesFieldComponent {\n const checkboxesFieldComponent: CheckboxesFieldComponent = {\n name: 'FellowshipOfTheRing',\n title: 'Which are your favourite characters from the fellowship?',\n type: ComponentType.CheckboxesField,\n list: 'CheckboxList',\n options: {}\n }\n\n return {\n ...checkboxesFieldComponent,\n ...partialListComponent\n }\n}\n\n/**\n * Builder to create a stub List item\n * @param {Partial<Item>} partialListItem\n * @returns {Item}\n */\nexport function buildListItem(partialListItem: Partial<Item> = {}): Item {\n return {\n text: 'Javascript',\n value: 'javascript',\n ...partialListItem\n }\n}\n\n/**\n * @param {Partial<List>} partialList\n * @returns {List}\n */\nexport function buildList(partialList: Partial<List> = {}): List {\n return {\n title: 'Development language2',\n name: 'YhmNDD',\n type: 'string',\n items: [\n buildListItem({\n text: 'Javascript',\n value: 'javascript'\n }),\n buildListItem({\n text: 'TypeScript',\n value: 'typescript'\n }),\n buildListItem({\n text: 'Python',\n value: 'python'\n }),\n buildListItem({\n text: 'Haskell',\n value: 'haskell'\n }),\n buildListItem({\n text: 'Erlang',\n value: 'erlang'\n }),\n buildListItem({\n text: 'Java',\n value: 'java'\n })\n ],\n ...partialList\n }\n}\n\nexport function buildNumberFieldComponent(\n partialComponent: Partial<NumberFieldComponent>\n): NumberFieldComponent {\n return {\n name: 'year',\n title: 'Year',\n options: {},\n schema: {},\n ...partialComponent,\n type: ComponentType.NumberField\n }\n}\n\nexport function buildDateComponent(\n partialComponent: Partial<DatePartsFieldComponent>\n): DatePartsFieldComponent {\n return {\n name: 'bcdefg',\n title: 'Default title',\n options: {},\n ...partialComponent,\n type: ComponentType.DatePartsField\n }\n}\n\nexport function buildRadiosComponent(\n partialComponent: Partial<RadiosFieldComponent>\n): RadiosFieldComponent {\n return {\n name: 'cdefgh',\n title: 'Default title',\n options: {},\n list: 'Default list Id ref',\n ...partialComponent,\n type: ComponentType.RadiosField\n }\n}\n"],"mappings":"AAAA,SAASA,aAAa;AAYtB;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CACrCC,gBAA6C,GAAG,CAAC,CAAC,EAC9B;EACpB,MAAMC,kBAAsC,GAAG;IAC7CC,EAAE,EAAE,sCAAsC;IAC1CC,IAAI,EAAE,WAAW;IACjBC,KAAK,EAAE,YAAY;IACnBC,IAAI,EAAEP,aAAa,CAACQ,SAAS;IAC7BC,IAAI,EAAE,EAAE;IACRC,OAAO,EAAE,CAAC,CAAC;IACXC,MAAM,EAAE,CAAC;EACX,CAAC;EAED,OAAO;IACL,GAAGR,kBAAkB;IACrB,GAAGD;EACL,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASU,wBAAwBA,CACtCC,sBAAyD,EAC/B;EAC1B,MAAMC,wBAAkD,GAAG;IACzDT,IAAI,EAAE,iBAAiB;IACvBE,IAAI,EAAEP,aAAa,CAACe,eAAe;IACnCT,KAAK,EAAE,mBAAmB;IAC1BI,OAAO,EAAE,CAAC,CAAC;IACXC,MAAM,EAAE,CAAC;EACX,CAAC;EAED,OAAO;IACL,GAAGG,wBAAwB;IAC3B,GAAGD;EACL,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,0BAA0BA,CACxCC,wBAA6D,EACjC;EAC5B,MAAMC,qBAAiD,GAAG;IACxDb,IAAI,EAAE,mBAAmB;IACzBC,KAAK,EAAE,8BAA8B;IACrCC,IAAI,EAAEP,aAAa,CAACmB,iBAAiB;IACrCC,IAAI,EAAE,kBAAkB;IACxBV,OAAO,EAAE,CAA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AClBC,KAAK,EAAE;IACT,CAAC,CAAC,EACFH,aAAa,CAAC;MACZE,IAAI,EAAE,QAAQ;MACdC,KAAK,EAAE;IACT,CAAC,CAAC,EACFH,aAAa,CAAC;MACZE,IAAI,EAAE,SAAS;MACfC,KAAK,EAAE;IACT,CAAC,CAAC,EACFH,aAAa,CAAC;MACZE,IAAI,EAAE,QAAQ;MACdC,KAAK,EAAE;IACT,CAAC,CAAC,EACFH,aAAa,CAAC;MACZE,IAAI,EAAE,MAAM;MACZC,KAAK,EAAE;IACT,CAAC,CAAC,CACH;IACD,GAAGE;EACL,CAAC;AACH;AAEA,OAAO,SAASE,yBAAyBA,CACvCC,gBAA+C,EACzB;EACtB,OAAO;IACL/B,IAAI,EAAE,MAAM;IACZC,KAAK,EAAE,MAAM;IACbI,OAAO,EAAE,CAAC,CAAC;IACXC,MAAM,EAAE,CAAC,CAAC;IACV,GAAGyB,gBAAgB;IACnB7B,IAAI,EAAEP,aAAa,CAACqC;EACtB,CAAC;AACH;AAEA,OAAO,SAASC,kBAAkBA,CAChCF,gBAAkD,EACzB;EACzB,OAAO;IACL/B,IAAI,EAAE,QAAQ;IACdC,KAAK,EAAE,eAAe;IACtBI,OAAO,EAAE,CAAC,CAAC;IACX,GAAG0B,gBAAgB;IACnB7B,IAAI,EAAEP,aAAa,CAACuC;EACtB,CAAC;AACH;AAEA,OAAO,SAASC,oBAAoBA,CAClCJ,gBAA+C,EACzB;EACtB,OAAO;IACL/B,IAAI,EAAE,QAAQ;IACdC,KAAK,EAAE,eAAe;IACtBI,OAAO,EAAE,CAAC,CAAC;IACXU,IAAI,EAAE,qBAAqB;IAC3B,GAAGgB,gBAAgB;IACnB7B,IAAI,EAAEP,aAAa,CAACwB;EACtB,CAAC;AACH","ignoreList":[]}
|
1
|
+
{"version":3,"file":"components.js","names":["ComponentType","buildTextFieldComponent","partialTextField","id","name","title","hint","options","schema","type","TextField","buildMultilineTextFieldComponent","partialMultilineTextField","MultilineTextField","buildYesNoFieldComponent","partialYesNoField","YesNoField","buildMonthYearFieldComponent","partialMonthYearField","MonthYearField","buildSelectFieldComponent","partialSelectField","list","SelectField","buildUkAddressFieldComponent","partialUkAddressField","UkAddressField","buildTelephoneNumberFieldComponent","partialTelephoneNumberField","TelephoneNumberField","buildEmailAddressFieldComponent","partialEmailAddressField","EmailAddressField","buildHtmlComponent","partialHtml","content","Html","buildInsetTextComponent","partialInsetText","InsetText","buildDetailsComponent","partialDetails","Details","buildListComponent","partialList","List","buildMarkdownComponent","partialMarkdown","Markdown","buildFileUploadComponent","partialFileUploadField","FileUploadField","buildAutoCompleteComponent","partialAutoCompleteField","AutocompleteField","buildRadioComponent","partialListComponent","RadiosField","buildCheckboxComponent","CheckboxesField","buildListItem","partialListItem","text","value","buildList","items","buildNumberFieldComponent","partialComponent","NumberField","buildDateComponent","DatePartsField","buildRadiosComponent"],"sources":["../../../src/__stubs__/components.ts"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport {\n type AutocompleteFieldComponent,\n type CheckboxesFieldComponent,\n type DatePartsFieldComponent,\n type DetailsComponent,\n type EmailAddressFieldComponent,\n type FileUploadFieldComponent,\n type HtmlComponent,\n type InsetTextComponent,\n type ListComponent,\n type MarkdownComponent,\n type MonthYearFieldComponent,\n type MultilineTextFieldComponent,\n type NumberFieldComponent,\n type RadiosFieldComponent,\n type SelectFieldComponent,\n type TelephoneNumberFieldComponent,\n type TextFieldComponent,\n type UkAddressFieldComponent,\n type YesNoFieldComponent\n} from '~/src/components/types.js'\nimport { type Item, type List } from '~/src/form/form-definition/types.js'\n\n/**\n * @param {Partial<TextFieldComponent>} partialTextField\n * @returns {TextFieldComponent}\n */\nexport function buildTextFieldComponent(\n partialTextField: Partial<TextFieldComponent> = {}\n): TextFieldComponent {\n return {\n id: '407dd0d7-cce9-4f43-8e1f-7d89cb698875',\n name: 'TextField',\n title: 'Text field',\n hint: '',\n options: {},\n schema: {},\n ...partialTextField,\n type: ComponentType.TextField\n }\n}\n\nexport function buildMultilineTextFieldComponent(\n partialMultilineTextField: Partial<MultilineTextFieldComponent> = {}\n): MultilineTextFieldComponent {\n return {\n id: '72671f23-552e-4504-a06a-693e240880d5',\n name: 'MuTeCo',\n options: {},\n schema: {},\n title: 'Multiline TextField Component',\n ...partialMultilineTextField,\n type: ComponentType.MultilineTextField\n }\n}\n\nexport function buildYesNoFieldComponent(\n partialYesNoField: Partial<YesNoFieldComponent> = {}\n): YesNoFieldComponent {\n return {\n title: 'YesNo Field Component',\n id: 'be7f849c-47d8-4f1f-ba15-ab939dc70914',\n name: 'YesNoFieldComponent',\n options: {},\n ...partialYesNoField,\n type: ComponentType.YesNoField\n }\n}\nexport function buildMonthYearFieldComponent(\n partialMonthYearField: Partial<MonthYearFieldComponent> = {}\n): MonthYearFieldComponent {\n return {\n id: 'd4e99aca-6d13-4c1a-a623-9e9e5b27d46d',\n title: 'MonthYearFieldComponent',\n name: 'MonthYearFieldComponent',\n options: {},\n ...partialMonthYearField,\n type: ComponentType.MonthYearField\n }\n}\nexport function buildSelectFieldComponent(\n partialSelectField: Partial<SelectFieldComponent> = {}\n): SelectFieldComponent {\n return {\n id: '7f219cf6-3e16-4549-b8df-789506682147',\n list: '',\n name: '',\n options: {},\n title: '',\n ...partialSelectField,\n type: ComponentType.SelectField\n }\n}\nexport function buildUkAddressFieldComponent(\n partialUkAddressField: Partial<UkAddressFieldComponent> = {}\n): UkAddressFieldComponent {\n return {\n id: 'a7cb7440-9095-44cd-9136-2914232722c8',\n title: 'UkAddressFieldComponent',\n name: 'UkAddressFieldComponent',\n options: {},\n ...partialUkAddressField,\n type: ComponentType.UkAddressField\n }\n}\nexport function buildTelephoneNumberFieldComponent(\n partialTelephoneNumberField: Partial<TelephoneNumberFieldComponent> = {}\n): TelephoneNumberFieldComponent {\n return {\n id: '69907916-beac-4faa-b469-656dad5edced',\n title: 'TelephoneNumberFieldComponent',\n name: 'TelephoneNumberFieldComponent',\n options: {},\n ...partialTelephoneNumberField,\n type: ComponentType.TelephoneNumberField\n }\n}\nexport function buildEmailAddressFieldComponent(\n partialEmailAddressField: Partial<EmailAddressFieldComponent> = {}\n): EmailAddressFieldComponent {\n return {\n id: '9dcf0781-bf34-48c8-b13b-d13050dc34d9',\n title: 'EmailAddressFieldComponent',\n name: 'EmailAddressFieldComponent',\n options: {},\n ...partialEmailAddressField,\n type: ComponentType.EmailAddressField\n }\n}\n\nexport function buildHtmlComponent(\n partialHtml: Partial<HtmlComponent> = {}\n): HtmlComponent {\n return {\n id: 'bac683ce-149e-4740-95aa-8289b35bc327',\n title: 'HtmlComponent',\n name: 'HtmlComponent',\n options: {},\n content: '',\n ...partialHtml,\n type: ComponentType.Html\n }\n}\nexport function buildInsetTextComponent(\n partialInsetText: Partial<InsetTextComponent> = {}\n): InsetTextComponent {\n return {\n id: '6b717151-1e86-42b2-97a9-2201b0676e47',\n title: 'InsetText Component',\n name: 'InsetTextComponent',\n content: '',\n options: {},\n ...partialInsetText,\n type: ComponentType.InsetText\n }\n}\nexport function buildDetailsComponent(\n partialDetails: Partial<DetailsComponent> = {}\n): DetailsComponent {\n return {\n id: '245d54df-bb1e-488e-82f6-8f1e42c197e6',\n title: 'Details Component',\n name: 'DetailsComponent',\n content: '',\n options: {},\n ...partialDetails,\n type: ComponentType.Details\n }\n}\nexport function buildListComponent(\n partialList: Partial<ListComponent> = {}\n): ListComponent {\n return {\n id: '62f17168-c2ef-4978-bd42-bdaa5704e25f',\n title: 'List Component',\n name: 'ListComponent',\n list: '',\n options: {},\n ...partialList,\n type: ComponentType.List\n }\n}\nexport function buildMarkdownComponent(\n partialMarkdown: Partial<MarkdownComponent> = {}\n): MarkdownComponent {\n return {\n id: '4a2dc88c-be1a-4277-aff8-04220de2e778',\n title: 'Markdown Component',\n name: 'MarkdownComponent',\n options: {},\n content: '',\n ...partialMarkdown,\n type: ComponentType.Markdown\n }\n}\n\n/**\n * @param {Partial<FileUploadFieldComponent>} partialFileUploadField\n * @returns {FileUploadFieldComponent}\n */\nexport function buildFileUploadComponent(\n partialFileUploadField: Partial<FileUploadFieldComponent> = {}\n): FileUploadFieldComponent {\n return {\n name: 'FileUploadField',\n title: 'File Upload Field',\n options: {},\n schema: {},\n ...partialFileUploadField,\n type: ComponentType.FileUploadField\n }\n}\n\n/**\n *\n * @param {Partial<AutocompleteFieldComponent>} partialAutoCompleteField\n * @returns {AutocompleteFieldComponent}\n */\nexport function buildAutoCompleteComponent(\n partialAutoCompleteField: Partial<AutocompleteFieldComponent> = {}\n): AutocompleteFieldComponent {\n return {\n name: 'AutoCompleteField',\n title: 'What languages do you speak?',\n list: 'AutoCompleteList',\n options: {},\n ...partialAutoCompleteField,\n type: ComponentType.AutocompleteField\n }\n}\n\n/**\n * @param {Partial<RadiosFieldComponent>} partialListComponent\n * @returns {RadiosFieldComponent}\n */\nexport function buildRadioComponent(\n partialListComponent: Partial<RadiosFieldComponent> = {}\n): RadiosFieldComponent {\n return {\n name: 'RadioField',\n title: 'Which country do you live in?',\n list: 'RadioList',\n options: {},\n ...partialListComponent,\n type: ComponentType.RadiosField\n }\n}\n\n/**\n * @param {Partial<CheckboxesFieldComponent>} partialListComponent\n * @returns {CheckboxesFieldComponent}\n */\nexport function buildCheckboxComponent(\n partialListComponent: Partial<CheckboxesFieldComponent> = {}\n): CheckboxesFieldComponent {\n return {\n name: 'FellowshipOfTheRing',\n title: 'Which are your favourite characters from the fellowship?',\n list: 'CheckboxList',\n options: {},\n ...partialListComponent,\n type: ComponentType.CheckboxesField\n }\n}\n\n/**\n * Builder to create a stub List item\n * @param {Partial<Item>} partialListItem\n * @returns {Item}\n */\nexport function buildListItem(partialListItem: Partial<Item> = {}): Item {\n return {\n text: 'Javascript',\n value: 'javascript',\n ...partialListItem\n }\n}\n\n/**\n * @param {Partial<List>} partialList\n * @returns {List}\n */\nexport function buildList(partialList: Partial<List> = {}): List {\n return {\n title: 'Development language2',\n name: 'YhmNDD',\n type: 'string',\n items: [\n buildListItem({\n text: 'Javascript',\n value: 'javascript'\n }),\n buildListItem({\n text: 'TypeScript',\n value: 'typescript'\n }),\n buildListItem({\n text: 'Python',\n value: 'python'\n }),\n buildListItem({\n text: 'Haskell',\n value: 'haskell'\n }),\n buildListItem({\n text: 'Erlang',\n value: 'erlang'\n }),\n buildListItem({\n text: 'Java',\n value: 'java'\n })\n ],\n ...partialList\n }\n}\n\nexport function buildNumberFieldComponent(\n partialComponent: Partial<NumberFieldComponent> = {}\n): NumberFieldComponent {\n return {\n name: 'year',\n title: 'Year',\n options: {},\n schema: {},\n ...partialComponent,\n type: ComponentType.NumberField\n }\n}\n\nexport function buildDateComponent(\n partialComponent: Partial<DatePartsFieldComponent> = {}\n): DatePartsFieldComponent {\n return {\n name: 'bcdefg',\n title: 'Default title',\n options: {},\n ...partialComponent,\n type: ComponentType.DatePartsField\n }\n}\n\nexport function buildRadiosComponent(\n partialComponent: Partial<RadiosFieldComponent> = {}\n): RadiosFieldComponent {\n return {\n name: 'cdefgh',\n title: 'Default title',\n options: {},\n list: 'Default list Id ref',\n ...partialComponent,\n type: ComponentType.RadiosField\n }\n}\n"],"mappings":"AAAA,SAASA,aAAa;AAwBtB;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CACrCC,gBAA6C,GAAG,CAAC,CAAC,EAC9B;EACpB,OAAO;IACLC,EAAE,EAAE,sCAAsC;IAC1CC,IAAI,EAAE,WAAW;IACjBC,KAAK,EAAE,YAAY;IACnBC,IAAI,EAAE,EAAE;IACRC,OAAO,EAAE,CAAC,CAAC;IACXC,MAAM,EAAE,CAAC,CAAC;IACV,GAAGN,gBAAgB;IACnBO,IAAI,EAAET,aAAa,CAACU;EACtB,CAAC;AACH;AAEA,OAAO,SAASC,gCAAgCA,CAC9CC,yBAA+D,GAAG,CAAC,CAAC,EACvC;EAC7B,OAAO;IACLT,EAAE,EAAE,sCAAsC;IAC1CC,IAAI,EAAE,QAAQ;IACdG,OAAO,EAAE,CAAC,CAAC;IACXC,MAAM,EAAE,CAAC,CAAC;IACVH,KAAK,EAAE,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CAAC;MACZE,IAAI,EAAE,SAAS;MACfC,KAAK,EAAE;IACT,CAAC,CAAC,EACFH,aAAa,CAAC;MACZE,IAAI,EAAE,QAAQ;MACdC,KAAK,EAAE;IACT,CAAC,CAAC,EACFH,aAAa,CAAC;MACZE,IAAI,EAAE,MAAM;MACZC,KAAK,EAAE;IACT,CAAC,CAAC,CACH;IACD,GAAGnB;EACL,CAAC;AACH;AAEA,OAAO,SAASsB,yBAAyBA,CACvCC,gBAA+C,GAAG,CAAC,CAAC,EAC9B;EACtB,OAAO;IACL/D,IAAI,EAAE,MAAM;IACZC,KAAK,EAAE,MAAM;IACbE,OAAO,EAAE,CAAC,CAAC;IACXC,MAAM,EAAE,CAAC,CAAC;IACV,GAAG2D,gBAAgB;IACnB1D,IAAI,EAAET,aAAa,CAACoE;EACtB,CAAC;AACH;AAEA,OAAO,SAASC,kBAAkBA,CAChCF,gBAAkD,GAAG,CAAC,CAAC,EAC9B;EACzB,OAAO;IACL/D,IAAI,EAAE,QAAQ;IACdC,KAAK,EAAE,eAAe;IACtBE,OAAO,EAAE,CAAC,CAAC;IACX,GAAG4D,gBAAgB;IACnB1D,IAAI,EAAET,aAAa,CAACsE;EACtB,CAAC;AACH;AAEA,OAAO,SAASC,oBAAoBA,CAClCJ,gBAA+C,GAAG,CAAC,CAAC,EAC9B;EACtB,OAAO;IACL/D,IAAI,EAAE,QAAQ;IACdC,KAAK,EAAE,eAAe;IACtBE,OAAO,EAAE,CAAC,CAAC;IACXe,IAAI,EAAE,qBAAqB;IAC3B,GAAG6C,gBAAgB;IACnB1D,IAAI,EAAET,aAAa,CAACyD;EACtB,CAAC;AACH","ignoreList":[]}
|
@@ -23,16 +23,13 @@ export function buildQuestionPage(partialPage) {
|
|
23
23
|
* @param {Partial<PageSummary>} [partialSummaryPage]
|
24
24
|
*/
|
25
25
|
export function buildSummaryPage(partialSummaryPage = {}) {
|
26
|
-
|
26
|
+
return {
|
27
27
|
id: '449a45f6-4541-4a46-91bd-8b8931b07b50',
|
28
28
|
title: 'Summary page',
|
29
|
+
...partialSummaryPage,
|
29
30
|
path: ControllerPath.Summary,
|
30
31
|
controller: ControllerType.Summary
|
31
32
|
};
|
32
|
-
return {
|
33
|
-
...pageSummary,
|
34
|
-
...partialSummaryPage
|
35
|
-
};
|
36
33
|
}
|
37
34
|
|
38
35
|
/**
|
@@ -41,7 +38,7 @@ export function buildSummaryPage(partialSummaryPage = {}) {
|
|
41
38
|
* @returns {PageFileUpload}
|
42
39
|
*/
|
43
40
|
export function buildFileUploadPage(partialFileUploadPage = {}) {
|
44
|
-
|
41
|
+
return {
|
45
42
|
id: '85e5c8da-88f5-4009-a821-7d7de1364318',
|
46
43
|
title: '',
|
47
44
|
path: '/supporting-evidence',
|
@@ -57,12 +54,9 @@ export function buildFileUploadPage(partialFileUploadPage = {}) {
|
|
57
54
|
},
|
58
55
|
id: '4189b8a1-1a04-4f74-a7a0-dd23012a0ee0'
|
59
56
|
})],
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
return {
|
64
|
-
...fileUploadPage,
|
65
|
-
...partialFileUploadPage
|
57
|
+
next: [],
|
58
|
+
...partialFileUploadPage,
|
59
|
+
controller: ControllerType.FileUpload
|
66
60
|
};
|
67
61
|
}
|
68
62
|
|
@@ -72,7 +66,7 @@ export function buildFileUploadPage(partialFileUploadPage = {}) {
|
|
72
66
|
* @returns {PageRepeat}
|
73
67
|
*/
|
74
68
|
export function buildRepeaterPage(partialRepeaterPage = {}) {
|
75
|
-
|
69
|
+
return {
|
76
70
|
title: 'Repeater Page',
|
77
71
|
path: '/repeater-page',
|
78
72
|
components: [{
|
@@ -87,7 +81,6 @@ export function buildRepeaterPage(partialRepeaterPage = {}) {
|
|
87
81
|
}],
|
88
82
|
next: [],
|
89
83
|
id: '32888028-61db-40fc-b255-80bc67829d31',
|
90
|
-
controller: ControllerType.Repeat,
|
91
84
|
repeat: {
|
92
85
|
options: {
|
93
86
|
name: 'fawfed',
|
@@ -97,11 +90,9 @@ export function buildRepeaterPage(partialRepeaterPage = {}) {
|
|
97
90
|
min: 1,
|
98
91
|
max: 3
|
99
92
|
}
|
100
|
-
}
|
101
|
-
|
102
|
-
|
103
|
-
...repeaterPage,
|
104
|
-
...partialRepeaterPage
|
93
|
+
},
|
94
|
+
...partialRepeaterPage,
|
95
|
+
controller: ControllerType.Repeat
|
105
96
|
};
|
106
97
|
}
|
107
98
|
//# sourceMappingURL=pages.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pages.js","names":["buildFileUploadComponent","ComponentType","ControllerPath","ControllerType","buildQuestionPage","partialPage","id","title","path","next","components","buildSummaryPage","partialSummaryPage","
|
1
|
+
{"version":3,"file":"pages.js","names":["buildFileUploadComponent","ComponentType","ControllerPath","ControllerType","buildQuestionPage","partialPage","id","title","path","next","components","buildSummaryPage","partialSummaryPage","Summary","controller","buildFileUploadPage","partialFileUploadPage","type","FileUploadField","name","shortDescription","hint","options","required","accept","FileUpload","buildRepeaterPage","partialRepeaterPage","TextField","schema","repeat","min","max","Repeat"],"sources":["../../../src/__stubs__/pages.ts"],"sourcesContent":["import { buildFileUploadComponent } from '~/src/__stubs__/components.js'\nimport { ComponentType } from '~/src/components/enums.js'\nimport {\n type PageFileUpload,\n type PageQuestion,\n type PageRepeat,\n type PageSummary\n} from '~/src/form/form-definition/types.js'\nimport { ControllerPath, ControllerType } from '~/src/pages/enums.js'\n\n/**\n * Stub builder for a question page\n * @param {Partial<PageQuestion>} [partialPage]\n * @returns {PageQuestion}\n */\nexport function buildQuestionPage(\n partialPage: Partial<PageQuestion>\n): PageQuestion {\n return {\n id: 'ffefd409-f3f4-49fe-882e-6e89f44631b1',\n title: 'Page One',\n path: '/page-one',\n next: [],\n components: [],\n ...partialPage\n }\n}\n\n/**\n * Stub builder for a Summary page\n * @param {Partial<PageSummary>} [partialSummaryPage]\n */\nexport function buildSummaryPage(\n partialSummaryPage: Partial<PageSummary> = {}\n): PageSummary {\n return {\n id: '449a45f6-4541-4a46-91bd-8b8931b07b50',\n title: 'Summary page',\n ...partialSummaryPage,\n path: ControllerPath.Summary,\n controller: ControllerType.Summary\n }\n}\n\n/**\n *\n * @param {Partial<PageFileUpload>} partialFileUploadPage\n * @returns {PageFileUpload}\n */\nexport function buildFileUploadPage(\n partialFileUploadPage: Partial<PageFileUpload> = {}\n): PageFileUpload {\n return {\n id: '85e5c8da-88f5-4009-a821-7d7de1364318',\n title: '',\n path: '/supporting-evidence',\n components: [\n buildFileUploadComponent({\n type: ComponentType.FileUploadField,\n title: 'Supporting Evidence',\n name: 'yBpZQO',\n shortDescription: 'Supporting evidence',\n hint: '',\n options: {\n required: true,\n accept:\n 'application/pdf,application/msword,image/jpeg,application/vnd.ms-excel,text/csv'\n },\n id: '4189b8a1-1a04-4f74-a7a0-dd23012a0ee0'\n })\n ],\n next: [],\n ...partialFileUploadPage,\n controller: ControllerType.FileUpload\n }\n}\n\n/**\n *\n * @param {Partial<PageRepeat>} partialRepeaterPage\n * @returns {PageRepeat}\n */\nexport function buildRepeaterPage(\n partialRepeaterPage: Partial<PageRepeat> = {}\n): PageRepeat {\n return {\n title: 'Repeater Page',\n path: '/repeater-page',\n components: [\n {\n type: ComponentType.TextField,\n title: 'Simple text field',\n name: 'IHAIzC',\n shortDescription: 'Your simple text field',\n hint: '',\n options: {},\n schema: {},\n id: 'ee83413e-31b6-4158-98e0-4611479582ce'\n }\n ],\n next: [],\n id: '32888028-61db-40fc-b255-80bc67829d31',\n repeat: {\n options: { name: 'fawfed', title: 'Simple question responses' },\n schema: { min: 1, max: 3 }\n },\n ...partialRepeaterPage,\n controller: ControllerType.Repeat\n }\n}\n"],"mappings":"AAAA,SAASA,wBAAwB;AACjC,SAASC,aAAa;AAOtB,SAASC,cAAc,EAAEC,cAAc;;AAEvC;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAC/BC,WAAkC,EACpB;EACd,OAAO;IACLC,EAAE,EAAE,sCAAsC;IAC1CC,KAAK,EAAE,UAAU;IAC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;MACdC,gBAAgB,EAAE,wBAAwB;MAC1CC,IAAI,EAAE,EAAE;MACRC,OAAO,EAAE,CAAC,CAAC;MACXO,MAAM,EAAE,CAAC,CAAC;MACVvB,EAAE,EAAE;IACN,CAAC,CACF;IACDG,IAAI,EAAE,EAAE;IACRH,EAAE,EAAE,sCAAsC;IAC1CwB,MAAM,EAAE;MACNR,OAAO,EAAE;QAAEH,IAAI,EAAE,QAAQ;QAAEZ,KAAK,EAAE;MAA4B,CAAC;MAC/DsB,MAAM,EAAE;QAAEE,GAAG,EAAE,CAAC;QAAEC,GAAG,EAAE;MAAE;IAC3B,CAAC;IACD,GAAGL,mBAAmB;IACtBb,UAAU,EAAEX,cAAc,CAAC8B;EAC7B,CAAC;AACH","ignoreList":[]}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import Joi from 'joi';
|
2
2
|
import { v4 as uuidV4 } from 'uuid';
|
3
3
|
import { ComponentType } from "../../components/enums.js";
|
4
|
+
import { ControllerType } from "../../pages/enums.js";
|
4
5
|
import { hasComponents } from "../../pages/helpers.js";
|
5
6
|
const idSchemaOptional = Joi.string().uuid();
|
6
7
|
const idSchema = idSchemaOptional.default(() => uuidV4());
|
@@ -123,6 +124,12 @@ export const componentSchemaV2 = componentSchema.keys({
|
|
123
124
|
id: idSchema.description('Unique identifier for the component'),
|
124
125
|
list: Joi.string().valid(listIdRef).optional().description('List id reference to a predefined list of options for select components')
|
125
126
|
}).description('Component schema for V2 forms');
|
127
|
+
export const fileUploadComponentSchema = componentSchemaV2.keys({
|
128
|
+
type: Joi.string().trim().valid(ComponentType.FileUploadField).required().description('Component that can only be a FileUploadField')
|
129
|
+
});
|
130
|
+
export const contentComponentSchema = componentSchemaV2.keys({
|
131
|
+
type: Joi.string().trim().valid(ComponentType.Details).valid(ComponentType.Html).valid(ComponentType.Markdown).valid(ComponentType.InsetText).valid(ComponentType.List).required().description('Content only component type (Details, Html, Markdown, etc.)')
|
132
|
+
});
|
126
133
|
const nextSchema = Joi.object().description('Navigation link defining where to go after completing a page').keys({
|
127
134
|
path: Joi.string().trim().required().description('The target page path to navigate to'),
|
128
135
|
condition: Joi.string().trim().allow('').optional().description('Optional condition that determines if this path should be taken'),
|
@@ -153,6 +160,7 @@ const eventsSchema = Joi.object().description('Collection of event handlers for
|
|
153
160
|
onLoad: eventSchema.optional().description('Event handler triggered when the page is loaded'),
|
154
161
|
onSave: eventSchema.optional().description('Event handler triggered when the page data is saved')
|
155
162
|
});
|
163
|
+
export const pageUploadComponentsSchema = Joi.array().items(fileUploadComponentSchema.required(), contentComponentSchema.optional()).unique('name').unique('id').min(1).max(2).description('Components allowed on Page Upload schema');
|
156
164
|
|
157
165
|
/**
|
158
166
|
* `/status` is a special route for providing a user's application status.
|
@@ -182,7 +190,13 @@ export const pageSchema = Joi.object().description('Form page definition specify
|
|
182
190
|
export const pageSchemaV2 = pageSchema.append({
|
183
191
|
id: idSchema.description('Unique identifier for the page'),
|
184
192
|
title: Joi.string().trim().allow('').required().description('Page title displayed at the top of the page (with support for empty titles in V2)'),
|
185
|
-
components: Joi.
|
193
|
+
components: Joi.when('controller', {
|
194
|
+
switch: [{
|
195
|
+
is: Joi.string().trim().valid(ControllerType.FileUpload).required(),
|
196
|
+
then: pageUploadComponentsSchema
|
197
|
+
}],
|
198
|
+
otherwise: Joi.array().items(componentSchemaV2).unique('name').unique('id').description('Components schema for V2 forms')
|
199
|
+
}),
|
186
200
|
condition: Joi.string().trim().valid(conditionIdRef).optional().description('Optional condition that determines if this page is shown')
|
187
201
|
}).description('Page schema for V2 forms');
|
188
202
|
const baseListItemSchema = Joi.object().description('Base schema for list items with common properties').keys({
|