@defra/forms-model 3.0.235 → 3.0.237
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/components/component-types.js +1 -19
- package/dist/module/components/component-types.js.map +1 -1
- package/dist/module/components/enums.js +0 -6
- package/dist/module/components/enums.js.map +1 -1
- package/dist/module/components/helpers.js +1 -1
- package/dist/module/components/helpers.js.map +1 -1
- package/dist/module/components/index.js +1 -1
- package/dist/module/components/index.js.map +1 -1
- package/dist/module/components/types.js.map +1 -1
- package/dist/module/form/form-definition/index.js +1 -16
- package/dist/module/form/form-definition/index.js.map +1 -1
- package/dist/module/form/form-definition/types.js.map +1 -1
- package/dist/types/components/component-types.d.ts +1 -4
- package/dist/types/components/component-types.d.ts.map +1 -1
- package/dist/types/components/enums.d.ts +0 -5
- package/dist/types/components/enums.d.ts.map +1 -1
- package/dist/types/components/helpers.d.ts +1 -3
- package/dist/types/components/helpers.d.ts.map +1 -1
- package/dist/types/components/index.d.ts +1 -1
- package/dist/types/components/index.d.ts.map +1 -1
- package/dist/types/components/types.d.ts +1 -1
- 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-definition/types.d.ts +3 -32
- package/dist/types/form/form-definition/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/component-types.ts +2 -22
- package/src/components/enums.ts +0 -6
- package/src/components/helpers.ts +1 -0
- package/src/components/index.ts +1 -1
- package/src/components/types.ts +1 -0
- package/src/form/form-definition/index.ts +6 -32
- package/src/form/form-definition/types.ts +3 -36
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { ComponentType } from "./enums.js";
|
2
2
|
/**
|
3
3
|
* Defaults for creating new components
|
4
4
|
*/
|
@@ -6,7 +6,6 @@ export const ComponentTypes = [{
|
|
6
6
|
name: 'TextField',
|
7
7
|
title: 'Text field',
|
8
8
|
type: ComponentType.TextField,
|
9
|
-
subType: ComponentSubType.Field,
|
10
9
|
hint: '',
|
11
10
|
options: {},
|
12
11
|
schema: {}
|
@@ -14,7 +13,6 @@ export const ComponentTypes = [{
|
|
14
13
|
name: 'MultilineTextField',
|
15
14
|
title: 'Multiline text field',
|
16
15
|
type: ComponentType.MultilineTextField,
|
17
|
-
subType: ComponentSubType.Field,
|
18
16
|
hint: '',
|
19
17
|
options: {},
|
20
18
|
schema: {}
|
@@ -22,7 +20,6 @@ export const ComponentTypes = [{
|
|
22
20
|
name: 'YesNoField',
|
23
21
|
title: 'Yes/No field',
|
24
22
|
type: ComponentType.YesNoField,
|
25
|
-
subType: ComponentSubType.Field,
|
26
23
|
hint: '',
|
27
24
|
options: {},
|
28
25
|
schema: {}
|
@@ -30,7 +27,6 @@ export const ComponentTypes = [{
|
|
30
27
|
name: 'TimeField',
|
31
28
|
title: 'Time field',
|
32
29
|
type: ComponentType.TimeField,
|
33
|
-
subType: ComponentSubType.Field,
|
34
30
|
hint: '',
|
35
31
|
options: {},
|
36
32
|
schema: {}
|
@@ -38,7 +34,6 @@ export const ComponentTypes = [{
|
|
38
34
|
name: 'DatePartsField',
|
39
35
|
title: 'Date field',
|
40
36
|
type: ComponentType.DatePartsField,
|
41
|
-
subType: ComponentSubType.Field,
|
42
37
|
hint: '',
|
43
38
|
options: {},
|
44
39
|
schema: {}
|
@@ -46,7 +41,6 @@ export const ComponentTypes = [{
|
|
46
41
|
name: 'MonthYearField',
|
47
42
|
title: 'Month & year field',
|
48
43
|
type: ComponentType.MonthYearField,
|
49
|
-
subType: ComponentSubType.Field,
|
50
44
|
hint: '',
|
51
45
|
options: {},
|
52
46
|
schema: {}
|
@@ -54,7 +48,6 @@ export const ComponentTypes = [{
|
|
54
48
|
name: 'SelectField',
|
55
49
|
title: 'Select field',
|
56
50
|
type: ComponentType.SelectField,
|
57
|
-
subType: ComponentSubType.ListField,
|
58
51
|
options: {},
|
59
52
|
schema: {},
|
60
53
|
list: ''
|
@@ -62,7 +55,6 @@ export const ComponentTypes = [{
|
|
62
55
|
name: 'AutocompleteField',
|
63
56
|
title: 'Autocomplete field',
|
64
57
|
type: ComponentType.AutocompleteField,
|
65
|
-
subType: ComponentSubType.ListField,
|
66
58
|
options: {},
|
67
59
|
schema: {},
|
68
60
|
list: ''
|
@@ -70,7 +62,6 @@ export const ComponentTypes = [{
|
|
70
62
|
name: 'RadiosField',
|
71
63
|
title: 'Radios field',
|
72
64
|
type: ComponentType.RadiosField,
|
73
|
-
subType: ComponentSubType.ListField,
|
74
65
|
options: {},
|
75
66
|
schema: {},
|
76
67
|
list: ''
|
@@ -78,7 +69,6 @@ export const ComponentTypes = [{
|
|
78
69
|
name: 'CheckboxesField',
|
79
70
|
title: 'Checkboxes field',
|
80
71
|
type: ComponentType.CheckboxesField,
|
81
|
-
subType: ComponentSubType.ListField,
|
82
72
|
options: {},
|
83
73
|
schema: {},
|
84
74
|
list: ''
|
@@ -86,7 +76,6 @@ export const ComponentTypes = [{
|
|
86
76
|
name: 'NumberField',
|
87
77
|
title: 'Number field',
|
88
78
|
type: ComponentType.NumberField,
|
89
|
-
subType: ComponentSubType.Field,
|
90
79
|
hint: '',
|
91
80
|
options: {},
|
92
81
|
schema: {}
|
@@ -94,7 +83,6 @@ export const ComponentTypes = [{
|
|
94
83
|
name: 'UkAddressField',
|
95
84
|
title: 'UK address field',
|
96
85
|
type: ComponentType.UkAddressField,
|
97
|
-
subType: ComponentSubType.Field,
|
98
86
|
hint: '',
|
99
87
|
options: {},
|
100
88
|
schema: {}
|
@@ -102,7 +90,6 @@ export const ComponentTypes = [{
|
|
102
90
|
name: 'TelephoneNumberField',
|
103
91
|
title: 'Telephone number field',
|
104
92
|
type: ComponentType.TelephoneNumberField,
|
105
|
-
subType: ComponentSubType.Field,
|
106
93
|
hint: '',
|
107
94
|
options: {},
|
108
95
|
schema: {}
|
@@ -110,7 +97,6 @@ export const ComponentTypes = [{
|
|
110
97
|
name: 'EmailAddressField',
|
111
98
|
title: 'Email address field',
|
112
99
|
type: ComponentType.EmailAddressField,
|
113
|
-
subType: ComponentSubType.Field,
|
114
100
|
hint: 'For example, ‘name@example.com’',
|
115
101
|
options: {},
|
116
102
|
schema: {}
|
@@ -118,7 +104,6 @@ export const ComponentTypes = [{
|
|
118
104
|
name: 'Html',
|
119
105
|
title: 'Html',
|
120
106
|
type: ComponentType.Html,
|
121
|
-
subType: ComponentSubType.Content,
|
122
107
|
content: '',
|
123
108
|
options: {},
|
124
109
|
schema: {}
|
@@ -126,7 +111,6 @@ export const ComponentTypes = [{
|
|
126
111
|
name: 'InsetText',
|
127
112
|
title: 'Inset text',
|
128
113
|
type: ComponentType.InsetText,
|
129
|
-
subType: ComponentSubType.Content,
|
130
114
|
content: '',
|
131
115
|
options: {},
|
132
116
|
schema: {}
|
@@ -134,7 +118,6 @@ export const ComponentTypes = [{
|
|
134
118
|
name: 'Details',
|
135
119
|
title: 'Details',
|
136
120
|
type: ComponentType.Details,
|
137
|
-
subType: ComponentSubType.Content,
|
138
121
|
content: '',
|
139
122
|
options: {},
|
140
123
|
schema: {}
|
@@ -142,7 +125,6 @@ export const ComponentTypes = [{
|
|
142
125
|
name: 'List',
|
143
126
|
title: 'List',
|
144
127
|
type: ComponentType.List,
|
145
|
-
subType: ComponentSubType.Content,
|
146
128
|
options: {},
|
147
129
|
schema: {},
|
148
130
|
list: ''
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"component-types.js","names":["
|
1
|
+
{"version":3,"file":"component-types.js","names":["ComponentType","ComponentTypes","name","title","type","TextField","hint","options","schema","MultilineTextField","YesNoField","TimeField","DatePartsField","MonthYearField","SelectField","list","AutocompleteField","RadiosField","CheckboxesField","NumberField","UkAddressField","TelephoneNumberField","EmailAddressField","Html","content","InsetText","Details","List"],"sources":["../../../src/components/component-types.ts"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { type ComponentDef } from '~/src/components/types.js'\n\n/**\n * Defaults for creating new components\n */\nexport const ComponentTypes: ComponentDef[] = [\n {\n name: 'TextField',\n title: 'Text field',\n type: ComponentType.TextField,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'MultilineTextField',\n title: 'Multiline text field',\n type: ComponentType.MultilineTextField,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'YesNoField',\n title: 'Yes/No field',\n type: ComponentType.YesNoField,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'TimeField',\n title: 'Time field',\n type: ComponentType.TimeField,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'DatePartsField',\n title: 'Date field',\n type: ComponentType.DatePartsField,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'MonthYearField',\n title: 'Month & year field',\n type: ComponentType.MonthYearField,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'SelectField',\n title: 'Select field',\n type: ComponentType.SelectField,\n options: {},\n schema: {},\n list: ''\n },\n {\n name: 'AutocompleteField',\n title: 'Autocomplete field',\n type: ComponentType.AutocompleteField,\n options: {},\n schema: {},\n list: ''\n },\n {\n name: 'RadiosField',\n title: 'Radios field',\n type: ComponentType.RadiosField,\n options: {},\n schema: {},\n list: ''\n },\n {\n name: 'CheckboxesField',\n title: 'Checkboxes field',\n type: ComponentType.CheckboxesField,\n options: {},\n schema: {},\n list: ''\n },\n {\n name: 'NumberField',\n title: 'Number field',\n type: ComponentType.NumberField,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'UkAddressField',\n title: 'UK address field',\n type: ComponentType.UkAddressField,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'TelephoneNumberField',\n title: 'Telephone number field',\n type: ComponentType.TelephoneNumberField,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'EmailAddressField',\n title: 'Email address field',\n type: ComponentType.EmailAddressField,\n hint: 'For example, ‘name@example.com’',\n options: {},\n schema: {}\n },\n {\n name: 'Html',\n title: 'Html',\n type: ComponentType.Html,\n content: '',\n options: {},\n schema: {}\n },\n {\n name: 'InsetText',\n title: 'Inset text',\n type: ComponentType.InsetText,\n content: '',\n options: {},\n schema: {}\n },\n {\n name: 'Details',\n title: 'Details',\n type: ComponentType.Details,\n content: '',\n options: {},\n schema: {}\n },\n {\n name: 'List',\n title: 'List',\n type: ComponentType.List,\n options: {},\n schema: {},\n list: ''\n }\n]\n"],"mappings":"AAAA,SAASA,aAAa;AAGtB;AACA;AACA;AACA,OAAO,MAAMC,cAA8B,GAAG,CAC5C;EACEC,IAAI,EAAE,WAAW;EACjBC,KAAK,EAAE,YAAY;EACnBC,IAAI,EAAEJ,aAAa,CAACK,SAAS;EAC7BC,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE,CAAC;AACX,CAAC,EACD;EACEN,IAAI,EAAE,oBAAoB;EAC1BC,KAAK,EAAE,sBAAsB;EAC7BC,IAAI,EAAEJ,aAAa,CAACS,kBAAkB;EACtCH,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE,CAAC;AACX,CAAC,EACD;EACEN,IAAI,EAAE,YAAY;EAClBC,KAAK,EAAE,cAAc;EACrBC,IAAI,EAAEJ,aAAa,CAACU,UAAU;EAC9BJ,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE,CAAC;AACX,CAAC,EACD;EACEN,IAAI,EAAE,WAAW;EACjBC,KAAK,EAAE,YAAY;EACnBC,IAAI,EAAEJ,aAAa,CAACW,SAAS;EAC7BL,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE,CAAC;AACX,CAAC,EACD;EACEN,IAAI,EAAE,gBAAgB;EACtBC,KAAK,EAAE,YAAY;EACnBC,IAAI,EAAEJ,aAAa,CAACY,cAAc;EAClCN,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE,CAAC;AACX,CAAC,EACD;EACEN,IAAI,EAAE,gBAAgB;EACtBC,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ComponentType = /*#__PURE__*/function (ComponentType) {
|
|
19
19
|
ComponentType["List"] = "List";
|
20
20
|
return ComponentType;
|
21
21
|
}({});
|
22
|
-
export let ComponentSubType = /*#__PURE__*/function (ComponentSubType) {
|
23
|
-
ComponentSubType["Content"] = "content";
|
24
|
-
ComponentSubType["Field"] = "field";
|
25
|
-
ComponentSubType["ListField"] = "listField";
|
26
|
-
return ComponentSubType;
|
27
|
-
}({});
|
28
22
|
//# sourceMappingURL=enums.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"enums.js","names":["ComponentType"
|
1
|
+
{"version":3,"file":"enums.js","names":["ComponentType"],"sources":["../../../src/components/enums.ts"],"sourcesContent":["export enum ComponentType {\n TextField = 'TextField',\n MultilineTextField = 'MultilineTextField',\n YesNoField = 'YesNoField',\n TimeField = 'TimeField',\n DatePartsField = 'DatePartsField',\n MonthYearField = 'MonthYearField',\n SelectField = 'SelectField',\n AutocompleteField = 'AutocompleteField',\n RadiosField = 'RadiosField',\n CheckboxesField = 'CheckboxesField',\n NumberField = 'NumberField',\n UkAddressField = 'UkAddressField',\n TelephoneNumberField = 'TelephoneNumberField',\n EmailAddressField = 'EmailAddressField',\n Html = 'Html',\n InsetText = 'InsetText',\n Details = 'Details',\n List = 'List'\n}\n"],"mappings":"AAAA,WAAYA,aAAa,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA","ignoreList":[]}
|
@@ -43,7 +43,7 @@ export function hasEditor(component) {
|
|
43
43
|
* Filter known components with input fields
|
44
44
|
*/
|
45
45
|
export function hasInputField(component) {
|
46
|
-
const allowedTypes = [ComponentType.TextField, ComponentType.EmailAddressField, ComponentType.NumberField, ComponentType.MultilineTextField, ComponentType.TelephoneNumberField, ComponentType.YesNoField, ComponentType.MonthYearField, ComponentType.TimeField, ComponentType.UkAddressField];
|
46
|
+
const allowedTypes = [ComponentType.TextField, ComponentType.EmailAddressField, ComponentType.NumberField, ComponentType.MultilineTextField, ComponentType.TelephoneNumberField, ComponentType.YesNoField, ComponentType.MonthYearField, ComponentType.TimeField, ComponentType.DatePartsField, ComponentType.UkAddressField];
|
47
47
|
return !!component?.type && allowedTypes.includes(component.type);
|
48
48
|
}
|
49
49
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.js","names":["ComponentTypes","ComponentType","getComponentDefaults","component","type","find","hasConditionSupport","isConditionalType","allowedTypes","RadiosField","CheckboxesField","DatePartsField","EmailAddressField","MultilineTextField","NumberField","TextField","TimeField","YesNoField","includes","hasContentField","Details","Html","InsetText","hasEditor","TelephoneNumberField","AutocompleteField","SelectField","List","hasInputField","MonthYearField","UkAddressField","hasListField","hasSelectionFields","hasTitle","deniedTypes"],"sources":["../../../src/components/helpers.ts"],"sourcesContent":["import { ComponentTypes } from '~/src/components/component-types.js'\nimport { ComponentType } from '~/src/components/enums.js'\nimport {\n type InputFieldsComponentsDef,\n type ComponentDef,\n type ConditionalComponentsDef,\n type ConditionalComponentType,\n type ContentComponentsDef,\n type HtmlComponent,\n type InsetTextComponent,\n type ListComponentsDef,\n type SelectionComponentsDef,\n type EditorComponentsDef\n} from '~/src/components/types.js'\n\n/**\n * Return component defaults by type\n */\nexport function getComponentDefaults(component?: Partial<ComponentDef>) {\n if (!component?.type) {\n return\n }\n\n return ComponentTypes.find(({ type }) => type === component.type)\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.RadiosField,\n ComponentType.CheckboxesField,\n ComponentType.DatePartsField,\n ComponentType.EmailAddressField,\n ComponentType.MultilineTextField,\n ComponentType.NumberField,\n ComponentType.TextField,\n ComponentType.TimeField,\n ComponentType.YesNoField\n ]\n\n return !!type && allowedTypes.includes(type)\n}\n\n/**\n * Filter known components with content fields\n */\nexport function hasContentField(\n component?: Partial<ComponentDef>\n): component is ContentComponentsDef {\n const allowedTypes = [\n ComponentType.Details,\n ComponentType.Html,\n ComponentType.InsetText\n ]\n\n return !!component?.type && allowedTypes.includes(component.type)\n}\n\n/**\n * Filter known components with text editor or list select\n */\nexport function hasEditor(\n component?: Partial<ComponentDef>\n): component is EditorComponentsDef {\n const allowedTypes = [\n ComponentType.TextField,\n ComponentType.EmailAddressField,\n ComponentType.TelephoneNumberField,\n ComponentType.MultilineTextField,\n ComponentType.NumberField,\n ComponentType.AutocompleteField,\n ComponentType.SelectField,\n ComponentType.RadiosField,\n ComponentType.CheckboxesField,\n ComponentType.List,\n ComponentType.Details,\n ComponentType.Html,\n ComponentType.InsetText,\n ComponentType.DatePartsField\n ]\n\n return !!component?.type && allowedTypes.includes(component.type)\n}\n\n/**\n * Filter known components with input fields\n */\nexport function hasInputField(\n component?: Partial<ComponentDef>\n): component is InputFieldsComponentsDef {\n const allowedTypes = [\n ComponentType.TextField,\n ComponentType.EmailAddressField,\n ComponentType.NumberField,\n ComponentType.MultilineTextField,\n ComponentType.TelephoneNumberField,\n ComponentType.YesNoField,\n ComponentType.MonthYearField,\n ComponentType.TimeField,\n ComponentType.UkAddressField\n ]\n\n return !!component?.type && allowedTypes.includes(component.type)\n}\n\n/**\n * Filter known components with lists\n */\nexport function hasListField(\n component?: Partial<ComponentDef>\n): component is ListComponentsDef {\n const allowedTypes = [\n ComponentType.AutocompleteField,\n ComponentType.List,\n ComponentType.RadiosField,\n ComponentType.SelectField,\n ComponentType.CheckboxesField\n ]\n\n return !!component?.type && allowedTypes.includes(component.type)\n}\n\n/**\n * Filter known components with selection fields\n */\nexport function hasSelectionFields(\n component?: Partial<ComponentDef>\n): component is SelectionComponentsDef {\n const allowedTypes = [\n ComponentType.CheckboxesField,\n ComponentType.RadiosField,\n ComponentType.SelectField,\n ComponentType.YesNoField\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<ComponentDef, InsetTextComponent | HtmlComponent> {\n const deniedTypes = [ComponentType.InsetText, ComponentType.Html]\n return !!component?.type && !deniedTypes.includes(component.type)\n}\n"],"mappings":"AAAA,SAASA,cAAc;AACvB,SAASC,aAAa;AActB;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAACC,SAAiC,EAAE;EACtE,IAAI,CAACA,SAAS,EAAEC,IAAI,EAAE;IACpB;EACF;EAEA,OAAOJ,cAAc,CAACK,IAAI,CAAC,CAAC;IAAED;EAAK,CAAC,KAAKA,IAAI,KAAKD,SAAS,CAACC,IAAI,CAAC;AACnE;;AAEA;AACA;AACA;AACA,OAAO,SAASE,mBAAmBA,CACjCH,SAAiC,EACM;EACvC,OAAOI,iBAAiB,CAACJ,SAAS,EAAEC,IAAI,CAAC;AAC3C;AAEA,OAAO,SAASG,iBAAiBA,CAC/BH,IAAoB,EACc;EAClC,MAAMI,YAAY,GAAG,CACnBP,aAAa,CAACQ,WAAW,EACzBR,aAAa,CAACS,eAAe,EAC7BT,aAAa,CAACU,cAAc,EAC5BV,aAAa,CAACW,iBAAiB,EAC/BX,aAAa,CAACY,kBAAkB,EAChCZ,aAAa,CAACa,WAAW,EACzBb,aAAa,CAACc,SAAS,EACvBd,aAAa,CAACe,SAAS,EACvBf,aAAa,CAACgB,UAAU,CACzB;EAED,OAAO,CAAC,CAACb,IAAI,IAAII,YAAY,CAACU,QAAQ,CAACd,IAAI,CAAC;AAC9C;;AAEA;AACA;AACA;AACA,OAAO,SAASe,eAAeA,CAC7BhB,SAAiC,EACE;EACnC,MAAMK,YAAY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nE;;AAEA;AACA;AACA;AACA,OAAO,SAAS2B,YAAYA,CAC1B5B,SAAiC,EACD;EAChC,MAAMK,YAAY,GAAG,CACnBP,aAAa,CAACwB,iBAAiB,EAC/BxB,aAAa,CAAC0B,IAAI,EAClB1B,aAAa,CAACQ,WAAW,EACzBR,aAAa,CAACyB,WAAW,EACzBzB,aAAa,CAACS,eAAe,CAC9B;EAED,OAAO,CAAC,CAACP,SAAS,EAAEC,IAAI,IAAII,YAAY,CAACU,QAAQ,CAACf,SAAS,CAACC,IAAI,CAAC;AACnE;;AAEA;AACA;AACA;AACA,OAAO,SAAS4B,kBAAkBA,CAChC7B,SAAiC,EACI;EACrC,MAAMK,YAAY,GAAG,CACnBP,aAAa,CAACS,eAAe,EAC7BT,aAAa,CAACQ,WAAW,EACzBR,aAAa,CAACyB,WAAW,EACzBzB,aAAa,CAACgB,UAAU,CACzB;EAED,OAAO,CAAC,CAACd,SAAS,EAAEC,IAAI,IAAII,YAAY,CAACU,QAAQ,CAACf,SAAS,CAACC,IAAI,CAAC;AACnE;;AAEA;AACA;AACA;AACA,OAAO,SAAS6B,QAAQA,CACtB9B,SAAiC,EACuC;EACxE,MAAM+B,WAAW,GAAG,CAACjC,aAAa,CAACqB,SAAS,EAAErB,aAAa,CAACoB,IAAI,CAAC;EACjE,OAAO,CAAC,CAAClB,SAAS,EAAEC,IAAI,IAAI,CAAC8B,WAAW,CAAChB,QAAQ,CAACf,SAAS,CAACC,IAAI,CAAC;AACnE","ignoreList":[]}
|
1
|
+
{"version":3,"file":"helpers.js","names":["ComponentTypes","ComponentType","getComponentDefaults","component","type","find","hasConditionSupport","isConditionalType","allowedTypes","RadiosField","CheckboxesField","DatePartsField","EmailAddressField","MultilineTextField","NumberField","TextField","TimeField","YesNoField","includes","hasContentField","Details","Html","InsetText","hasEditor","TelephoneNumberField","AutocompleteField","SelectField","List","hasInputField","MonthYearField","UkAddressField","hasListField","hasSelectionFields","hasTitle","deniedTypes"],"sources":["../../../src/components/helpers.ts"],"sourcesContent":["import { ComponentTypes } from '~/src/components/component-types.js'\nimport { ComponentType } from '~/src/components/enums.js'\nimport {\n type InputFieldsComponentsDef,\n type ComponentDef,\n type ConditionalComponentsDef,\n type ConditionalComponentType,\n type ContentComponentsDef,\n type HtmlComponent,\n type InsetTextComponent,\n type ListComponentsDef,\n type SelectionComponentsDef,\n type EditorComponentsDef\n} from '~/src/components/types.js'\n\n/**\n * Return component defaults by type\n */\nexport function getComponentDefaults(component?: Partial<ComponentDef>) {\n if (!component?.type) {\n return\n }\n\n return ComponentTypes.find(({ type }) => type === component.type)\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.RadiosField,\n ComponentType.CheckboxesField,\n ComponentType.DatePartsField,\n ComponentType.EmailAddressField,\n ComponentType.MultilineTextField,\n ComponentType.NumberField,\n ComponentType.TextField,\n ComponentType.TimeField,\n ComponentType.YesNoField\n ]\n\n return !!type && allowedTypes.includes(type)\n}\n\n/**\n * Filter known components with content fields\n */\nexport function hasContentField(\n component?: Partial<ComponentDef>\n): component is ContentComponentsDef {\n const allowedTypes = [\n ComponentType.Details,\n ComponentType.Html,\n ComponentType.InsetText\n ]\n\n return !!component?.type && allowedTypes.includes(component.type)\n}\n\n/**\n * Filter known components with text editor or list select\n */\nexport function hasEditor(\n component?: Partial<ComponentDef>\n): component is EditorComponentsDef {\n const allowedTypes = [\n ComponentType.TextField,\n ComponentType.EmailAddressField,\n ComponentType.TelephoneNumberField,\n ComponentType.MultilineTextField,\n ComponentType.NumberField,\n ComponentType.AutocompleteField,\n ComponentType.SelectField,\n ComponentType.RadiosField,\n ComponentType.CheckboxesField,\n ComponentType.List,\n ComponentType.Details,\n ComponentType.Html,\n ComponentType.InsetText,\n ComponentType.DatePartsField\n ]\n\n return !!component?.type && allowedTypes.includes(component.type)\n}\n\n/**\n * Filter known components with input fields\n */\nexport function hasInputField(\n component?: Partial<ComponentDef>\n): component is InputFieldsComponentsDef {\n const allowedTypes = [\n ComponentType.TextField,\n ComponentType.EmailAddressField,\n ComponentType.NumberField,\n ComponentType.MultilineTextField,\n ComponentType.TelephoneNumberField,\n ComponentType.YesNoField,\n ComponentType.MonthYearField,\n ComponentType.TimeField,\n ComponentType.DatePartsField,\n ComponentType.UkAddressField\n ]\n\n return !!component?.type && allowedTypes.includes(component.type)\n}\n\n/**\n * Filter known components with lists\n */\nexport function hasListField(\n component?: Partial<ComponentDef>\n): component is ListComponentsDef {\n const allowedTypes = [\n ComponentType.AutocompleteField,\n ComponentType.List,\n ComponentType.RadiosField,\n ComponentType.SelectField,\n ComponentType.CheckboxesField\n ]\n\n return !!component?.type && allowedTypes.includes(component.type)\n}\n\n/**\n * Filter known components with selection fields\n */\nexport function hasSelectionFields(\n component?: Partial<ComponentDef>\n): component is SelectionComponentsDef {\n const allowedTypes = [\n ComponentType.CheckboxesField,\n ComponentType.RadiosField,\n ComponentType.SelectField,\n ComponentType.YesNoField\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<ComponentDef, InsetTextComponent | HtmlComponent> {\n const deniedTypes = [ComponentType.InsetText, ComponentType.Html]\n return !!component?.type && !deniedTypes.includes(component.type)\n}\n"],"mappings":"AAAA,SAASA,cAAc;AACvB,SAASC,aAAa;AActB;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAACC,SAAiC,EAAE;EACtE,IAAI,CAACA,SAAS,EAAEC,IAAI,EAAE;IACpB;EACF;EAEA,OAAOJ,cAAc,CAACK,IAAI,CAAC,CAAC;IAAED;EAAK,CAAC,KAAKA,IAAI,KAAKD,SAAS,CAACC,IAAI,CAAC;AACnE;;AAEA;AACA;AACA;AACA,OAAO,SAASE,mBAAmBA,CAC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nE;;AAEA;AACA;AACA;AACA,OAAO,SAAS6B,QAAQA,CACtB9B,SAAiC,EACuC;EACxE,MAAM+B,WAAW,GAAG,CAACjC,aAAa,CAACqB,SAAS,EAAErB,aAAa,CAACoB,IAAI,CAAC;EACjE,OAAO,CAAC,CAAClB,SAAS,EAAEC,IAAI,IAAI,CAAC8B,WAAW,CAAChB,QAAQ,CAACf,SAAS,CAACC,IAAI,CAAC;AACnE","ignoreList":[]}
|
@@ -1,4 +1,4 @@
|
|
1
1
|
export { ComponentTypes } from "./component-types.js";
|
2
2
|
export { getComponentDefaults, hasConditionSupport, hasContentField, hasEditor, hasInputField, hasListField, hasSelectionFields, hasTitle } from "./helpers.js";
|
3
|
-
export { ComponentType
|
3
|
+
export { ComponentType } from "./enums.js";
|
4
4
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","names":["ComponentTypes","getComponentDefaults","hasConditionSupport","hasContentField","hasEditor","hasInputField","hasListField","hasSelectionFields","hasTitle","ComponentType"
|
1
|
+
{"version":3,"file":"index.js","names":["ComponentTypes","getComponentDefaults","hasConditionSupport","hasContentField","hasEditor","hasInputField","hasListField","hasSelectionFields","hasTitle","ComponentType"],"sources":["../../../src/components/index.ts"],"sourcesContent":["export { ComponentTypes } from '~/src/components/component-types.js'\nexport {\n getComponentDefaults,\n hasConditionSupport,\n hasContentField,\n hasEditor,\n hasInputField,\n hasListField,\n hasSelectionFields,\n hasTitle\n} from '~/src/components/helpers.js'\n\nexport { ComponentType } from '~/src/components/enums.js'\n"],"mappings":"AAAA,SAASA,cAAc;AACvB,SACEC,oBAAoB,EACpBC,mBAAmB,EACnBC,eAAe,EACfC,SAAS,EACTC,aAAa,EACbC,YAAY,EACZC,kBAAkB,EAClBC,QAAQ;AAGV,SAASC,aAAa","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/components/types.ts"],"sourcesContent":["import { type ComponentType } from '~/src/components/enums.js'\n\nexport type ConditionalComponentType =\n | ComponentType.RadiosField\n | ComponentType.CheckboxesField\n | ComponentType.DatePartsField\n | ComponentType.EmailAddressField\n | ComponentType.MultilineTextField\n | ComponentType.NumberField\n | ComponentType.TextField\n | ComponentType.TimeField\n | ComponentType.YesNoField\n\n/**\n * Types for Components JSON structure which are expected by engine and turned into actual form input/content/lists\n */\ninterface TextFieldBase {\n type:\n | ComponentType.EmailAddressField\n | ComponentType.MultilineTextField\n | ComponentType.NumberField\n | ComponentType.TelephoneNumberField\n | ComponentType.TextField\n | ComponentType.UkAddressField\n | ComponentType.YesNoField\n name: string\n title: string\n hint?: string\n options: {\n required?: boolean\n optionalText?: boolean\n classes?: string\n allow?: string\n autocomplete?: string\n }\n schema: {\n max?: number\n min?: number\n length?: number\n regex?: string\n error?: unknown\n }\n}\n\ninterface NumberFieldBase {\n type: ComponentType\n name: string\n title: string\n hint?: string\n options: {\n required?: boolean\n optionalText?: boolean\n classes?: string\n prefix?: string\n suffix?: string\n }\n schema: {\n min?: number\n max?: number\n precision?: number\n }\n}\n\ninterface ListFieldBase {\n type:\n | ComponentType.AutocompleteField\n | ComponentType.CheckboxesField\n | ComponentType.List\n | ComponentType.RadiosField\n | ComponentType.SelectField\n name: string\n title: string\n options: {\n type?: string\n required?: boolean\n optionalText?: boolean\n classes?: string\n bold?: boolean\n }\n list: string\n schema: object\n}\n\ninterface ContentFieldBase {\n type: ComponentType.Details | ComponentType.Html | ComponentType.InsetText\n name: string\n title: string\n content: string\n options: {\n condition?: string\n }\n schema: object\n}\n\ninterface DateFieldBase {\n type:\n | ComponentType.DatePartsField\n | ComponentType.MonthYearField\n | ComponentType.TimeField\n name: string\n title: string\n hint?: string\n options: {\n required?: boolean\n optionalText?: boolean\n maxDaysInFuture?: number\n maxDaysInPast?: number\n }\n schema: object\n}\n\n// Text Fields\nexport interface TextFieldComponent extends TextFieldBase {\n type: ComponentType.TextField\n options: TextFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface EmailAddressFieldComponent extends TextFieldBase {\n type: ComponentType.EmailAddressField\n options: TextFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface NumberFieldComponent extends NumberFieldBase {\n type: ComponentType.NumberField\n options: NumberFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface TelephoneNumberFieldComponent extends TextFieldBase {\n type: ComponentType.TelephoneNumberField\n options: TextFieldBase['options'] & {\n customValidationMessage?: string\n }\n}\n\nexport interface YesNoFieldComponent extends TextFieldBase {\n type: ComponentType.YesNoField\n options: TextFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface MultilineTextFieldComponent extends TextFieldBase {\n type: ComponentType.MultilineTextField\n options: TextFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n rows?: number\n maxWords?: number\n }\n schema: {\n max?: number\n min?: number\n }\n}\n\nexport interface UkAddressFieldComponent extends TextFieldBase {\n type: ComponentType.UkAddressField\n options: TextFieldBase['options'] & {\n hideTitle?: boolean\n }\n}\n\n// Date Fields\nexport interface DatePartsFieldFieldComponent extends DateFieldBase {\n type: ComponentType.DatePartsField\n options: DateFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface MonthYearFieldComponent extends DateFieldBase {\n type: ComponentType.MonthYearField\n options: DateFieldBase['options'] & {\n customValidationMessage?: string\n }\n}\n\nexport interface TimeFieldComponent extends DateFieldBase {\n type: ComponentType.TimeField\n options: DateFieldBase['options'] & {\n condition?: string\n }\n}\n\n// Content Fields\nexport interface DetailsComponent extends ContentFieldBase {\n type: ComponentType.Details\n}\n\nexport interface HtmlComponent extends ContentFieldBase {\n type: ComponentType.Html\n}\n\nexport interface InsetTextComponent extends ContentFieldBase {\n type: ComponentType.InsetText\n}\n\n// List Fields\nexport interface ListComponent extends ListFieldBase {\n type: ComponentType.List\n}\n\nexport interface AutocompleteFieldComponent extends ListFieldBase {\n type: ComponentType.AutocompleteField\n}\n\nexport interface CheckboxesFieldComponent extends ListFieldBase {\n type: ComponentType.CheckboxesField\n options: ListFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface RadiosFieldComponent extends ListFieldBase {\n type: ComponentType.RadiosField\n options: ListFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface SelectFieldComponent extends ListFieldBase {\n type: ComponentType.SelectField\n options: ListFieldBase['options'] & { autocomplete?: string }\n}\n\nexport type ComponentDef =\n | InsetTextComponent\n | AutocompleteFieldComponent\n | CheckboxesFieldComponent\n | DatePartsFieldFieldComponent\n | MonthYearFieldComponent\n | DetailsComponent\n | EmailAddressFieldComponent\n | HtmlComponent\n | ListComponent\n | MultilineTextFieldComponent\n | NumberFieldComponent\n | RadiosFieldComponent\n | SelectFieldComponent\n | TelephoneNumberFieldComponent\n | TextFieldComponent\n | TimeFieldComponent\n | UkAddressFieldComponent\n | YesNoFieldComponent\n\n// Components that render inputs\nexport type InputFieldsComponentsDef =\n | TextFieldComponent\n | EmailAddressFieldComponent\n | NumberFieldComponent\n | MultilineTextFieldComponent\n | TelephoneNumberFieldComponent\n | YesNoFieldComponent\n | MonthYearFieldComponent\n | TimeFieldComponent\n | UkAddressFieldComponent\n\n// Components that render content\nexport type ContentComponentsDef =\n | DetailsComponent\n | HtmlComponent\n | InsetTextComponent\n\n// Components with editors\nexport type EditorComponentsDef =\n | TextFieldComponent\n | EmailAddressFieldComponent\n | TelephoneNumberFieldComponent\n | MultilineTextFieldComponent\n | NumberFieldComponent\n | AutocompleteFieldComponent\n | SelectFieldComponent\n | RadiosFieldComponent\n | CheckboxesFieldComponent\n | ListComponent\n | DetailsComponent\n | HtmlComponent\n | InsetTextComponent\n | DatePartsFieldFieldComponent\n\n// Components that render lists\nexport type ListComponentsDef =\n | ListComponent\n | AutocompleteFieldComponent\n | CheckboxesFieldComponent\n | RadiosFieldComponent\n | SelectFieldComponent\n\n// Components that have selection fields\nexport type SelectionComponentsDef =\n | CheckboxesFieldComponent\n | RadiosFieldComponent\n | SelectFieldComponent\n | YesNoFieldComponent\n\n// Components that have custom condition operators\nexport type ConditionalComponentsDef =\n | CheckboxesFieldComponent\n | DatePartsFieldFieldComponent\n | EmailAddressFieldComponent\n | MultilineTextFieldComponent\n | NumberFieldComponent\n | TextFieldComponent\n | TimeFieldComponent\n | YesNoFieldComponent\n"],"mappings":"","ignoreList":[]}
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/components/types.ts"],"sourcesContent":["import { type ComponentType } from '~/src/components/enums.js'\n\nexport type ConditionalComponentType =\n | ComponentType.RadiosField\n | ComponentType.CheckboxesField\n | ComponentType.DatePartsField\n | ComponentType.EmailAddressField\n | ComponentType.MultilineTextField\n | ComponentType.NumberField\n | ComponentType.TextField\n | ComponentType.TimeField\n | ComponentType.YesNoField\n\n/**\n * Types for Components JSON structure which are expected by engine and turned into actual form input/content/lists\n */\ninterface TextFieldBase {\n type:\n | ComponentType.EmailAddressField\n | ComponentType.MultilineTextField\n | ComponentType.NumberField\n | ComponentType.TelephoneNumberField\n | ComponentType.TextField\n | ComponentType.UkAddressField\n | ComponentType.YesNoField\n name: string\n title: string\n hint?: string\n options: {\n required?: boolean\n optionalText?: boolean\n classes?: string\n allow?: string\n autocomplete?: string\n }\n schema: {\n max?: number\n min?: number\n length?: number\n regex?: string\n error?: unknown\n }\n}\n\ninterface NumberFieldBase {\n type: ComponentType\n name: string\n title: string\n hint?: string\n options: {\n required?: boolean\n optionalText?: boolean\n classes?: string\n prefix?: string\n suffix?: string\n }\n schema: {\n min?: number\n max?: number\n precision?: number\n }\n}\n\ninterface ListFieldBase {\n type:\n | ComponentType.AutocompleteField\n | ComponentType.CheckboxesField\n | ComponentType.List\n | ComponentType.RadiosField\n | ComponentType.SelectField\n name: string\n title: string\n options: {\n type?: string\n required?: boolean\n optionalText?: boolean\n classes?: string\n bold?: boolean\n }\n list: string\n schema: object\n}\n\ninterface ContentFieldBase {\n type: ComponentType.Details | ComponentType.Html | ComponentType.InsetText\n name: string\n title: string\n content: string\n options: {\n condition?: string\n }\n schema: object\n}\n\ninterface DateFieldBase {\n type:\n | ComponentType.DatePartsField\n | ComponentType.MonthYearField\n | ComponentType.TimeField\n name: string\n title: string\n hint?: string\n options: {\n required?: boolean\n optionalText?: boolean\n maxDaysInFuture?: number\n maxDaysInPast?: number\n }\n schema: object\n}\n\n// Text Fields\nexport interface TextFieldComponent extends TextFieldBase {\n type: ComponentType.TextField\n options: TextFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface EmailAddressFieldComponent extends TextFieldBase {\n type: ComponentType.EmailAddressField\n options: TextFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface NumberFieldComponent extends NumberFieldBase {\n type: ComponentType.NumberField\n options: NumberFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n }\n}\n\nexport interface TelephoneNumberFieldComponent extends TextFieldBase {\n type: ComponentType.TelephoneNumberField\n options: TextFieldBase['options'] & {\n customValidationMessage?: string\n }\n}\n\nexport interface YesNoFieldComponent extends TextFieldBase {\n type: ComponentType.YesNoField\n options: TextFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface MultilineTextFieldComponent extends TextFieldBase {\n type: ComponentType.MultilineTextField\n options: TextFieldBase['options'] & {\n condition?: string\n customValidationMessage?: string\n rows?: number\n maxWords?: number\n }\n schema: {\n max?: number\n min?: number\n }\n}\n\nexport interface UkAddressFieldComponent extends TextFieldBase {\n type: ComponentType.UkAddressField\n options: TextFieldBase['options'] & {\n hideTitle?: boolean\n }\n}\n\n// Date Fields\nexport interface DatePartsFieldFieldComponent extends DateFieldBase {\n type: ComponentType.DatePartsField\n options: DateFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface MonthYearFieldComponent extends DateFieldBase {\n type: ComponentType.MonthYearField\n options: DateFieldBase['options'] & {\n customValidationMessage?: string\n }\n}\n\nexport interface TimeFieldComponent extends DateFieldBase {\n type: ComponentType.TimeField\n options: DateFieldBase['options'] & {\n condition?: string\n }\n}\n\n// Content Fields\nexport interface DetailsComponent extends ContentFieldBase {\n type: ComponentType.Details\n}\n\nexport interface HtmlComponent extends ContentFieldBase {\n type: ComponentType.Html\n}\n\nexport interface InsetTextComponent extends ContentFieldBase {\n type: ComponentType.InsetText\n}\n\n// List Fields\nexport interface ListComponent extends ListFieldBase {\n type: ComponentType.List\n}\n\nexport interface AutocompleteFieldComponent extends ListFieldBase {\n type: ComponentType.AutocompleteField\n}\n\nexport interface CheckboxesFieldComponent extends ListFieldBase {\n type: ComponentType.CheckboxesField\n options: ListFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface RadiosFieldComponent extends ListFieldBase {\n type: ComponentType.RadiosField\n options: ListFieldBase['options'] & {\n condition?: string\n }\n}\n\nexport interface SelectFieldComponent extends ListFieldBase {\n type: ComponentType.SelectField\n options: ListFieldBase['options'] & { autocomplete?: string }\n}\n\nexport type ComponentDef =\n | InsetTextComponent\n | AutocompleteFieldComponent\n | CheckboxesFieldComponent\n | DatePartsFieldFieldComponent\n | MonthYearFieldComponent\n | DetailsComponent\n | EmailAddressFieldComponent\n | HtmlComponent\n | ListComponent\n | MultilineTextFieldComponent\n | NumberFieldComponent\n | RadiosFieldComponent\n | SelectFieldComponent\n | TelephoneNumberFieldComponent\n | TextFieldComponent\n | TimeFieldComponent\n | UkAddressFieldComponent\n | YesNoFieldComponent\n\n// Components that render inputs\nexport type InputFieldsComponentsDef =\n | TextFieldComponent\n | EmailAddressFieldComponent\n | NumberFieldComponent\n | MultilineTextFieldComponent\n | TelephoneNumberFieldComponent\n | YesNoFieldComponent\n | MonthYearFieldComponent\n | TimeFieldComponent\n | DatePartsFieldFieldComponent\n | UkAddressFieldComponent\n\n// Components that render content\nexport type ContentComponentsDef =\n | DetailsComponent\n | HtmlComponent\n | InsetTextComponent\n\n// Components with editors\nexport type EditorComponentsDef =\n | TextFieldComponent\n | EmailAddressFieldComponent\n | TelephoneNumberFieldComponent\n | MultilineTextFieldComponent\n | NumberFieldComponent\n | AutocompleteFieldComponent\n | SelectFieldComponent\n | RadiosFieldComponent\n | CheckboxesFieldComponent\n | ListComponent\n | DetailsComponent\n | HtmlComponent\n | InsetTextComponent\n | DatePartsFieldFieldComponent\n\n// Components that render lists\nexport type ListComponentsDef =\n | ListComponent\n | AutocompleteFieldComponent\n | CheckboxesFieldComponent\n | RadiosFieldComponent\n | SelectFieldComponent\n\n// Components that have selection fields\nexport type SelectionComponentsDef =\n | CheckboxesFieldComponent\n | RadiosFieldComponent\n | SelectFieldComponent\n | YesNoFieldComponent\n\n// Components that have custom condition operators\nexport type ConditionalComponentsDef =\n | CheckboxesFieldComponent\n | DatePartsFieldFieldComponent\n | EmailAddressFieldComponent\n | MultilineTextFieldComponent\n | NumberFieldComponent\n | TextFieldComponent\n | TimeFieldComponent\n | YesNoFieldComponent\n"],"mappings":"","ignoreList":[]}
|
@@ -80,21 +80,7 @@ const pageSchema = Joi.object().keys({
|
|
80
80
|
section: Joi.string(),
|
81
81
|
controller: Joi.string().optional(),
|
82
82
|
components: Joi.array().items(componentSchema),
|
83
|
-
next: Joi.array().items(nextSchema)
|
84
|
-
repeatField: Joi.string().optional(),
|
85
|
-
options: Joi.object().optional(),
|
86
|
-
backLinkFallback: Joi.string().optional()
|
87
|
-
});
|
88
|
-
const toggleableString = Joi.alternatives().try(Joi.boolean(), Joi.string());
|
89
|
-
const confirmationPageSchema = Joi.object({
|
90
|
-
customText: Joi.object({
|
91
|
-
title: Joi.string().default('Application complete'),
|
92
|
-
nextSteps: toggleableString.default('You will receive an email with details with the next steps.')
|
93
|
-
}).default(),
|
94
|
-
components: Joi.array().items(componentSchema)
|
95
|
-
});
|
96
|
-
const specialPagesSchema = Joi.object().keys({
|
97
|
-
confirmationPage: confirmationPageSchema.optional()
|
83
|
+
next: Joi.array().items(nextSchema)
|
98
84
|
});
|
99
85
|
const baseListItemSchema = Joi.object().keys({
|
100
86
|
text: localisedString,
|
@@ -154,7 +140,6 @@ export const formDefinitionSchema = Joi.object().required().keys({
|
|
154
140
|
declaration: Joi.string().allow('').optional(),
|
155
141
|
skipSummary: Joi.boolean().optional().default(false),
|
156
142
|
phaseBanner: phaseBannerSchema.optional(),
|
157
|
-
specialPages: specialPagesSchema.optional(),
|
158
143
|
outputEmail: Joi.string().email({
|
159
144
|
tlds: {
|
160
145
|
allow: ['uk']
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","names":["Joi","CURRENT_VERSION","sectionsSchema","object","keys","name","string","required","title","hideTitle","boolean","optional","default","conditionFieldSchema","type","display","conditionValueSchema","value","relativeTimeValueSchema","timePeriod","timeUnit","direction","timeOnly","conditionRefSchema","conditionName","conditionDisplayName","coordinator","conditionSchema","field","operator","alternatives","try","conditionGroupSchema","conditions","array","items","any","conditionsModelSchema","conditionsSchema","displayName","localisedString","a","unknown","allow","componentSchema","hint","options","schema","min","number","max","list","nextSchema","path","condition","redirect","pageSchema","disallow","section","controller","components","next","repeatField","backLinkFallback","toggleableString","confirmationPageSchema","customText","nextSteps","specialPagesSchema","confirmationPage","baseListItemSchema","text","description","conditional","unique","stringListItemSchema","append","numberListItemSchema","listSchema","valid","when","is","then","otherwise","feedbackSchema","feedbackForm","url","emailAddress","email","tlds","phaseBannerSchema","phase","formDefinitionSchema","feedback","startPage","pages","sections","lists","metadata","declaration","skipSummary","phaseBanner","specialPages","outputEmail","trim","Schema"],"sources":["../../../../src/form/form-definition/index.ts"],"sourcesContent":["import Joi from 'joi'\n\nimport { type ComponentType } from '~/src/components/enums.js'\nimport { type ComponentDef } from '~/src/components/types.js'\nimport {\n type ConditionRawData,\n type ConditionWrapperValue,\n type ConfirmationPage,\n type FormDefinition,\n type Item,\n type List,\n type Next,\n type Page,\n type PhaseBanner,\n type RepeatingFieldPage,\n type Section,\n type SpecialPages\n} from '~/src/form/form-definition/types.js'\n\n/**\n * If an optional key is added, CURRENT_VERSION does not need to be incremented.\n * Only breaking changes will require an increment, as well as a migration script.\n */\nexport const CURRENT_VERSION = 2\n\nconst sectionsSchema = Joi.object<Section>().keys({\n name: Joi.string().required(),\n title: Joi.string().required(),\n hideTitle: Joi.boolean().optional().default(false)\n})\n\nconst conditionFieldSchema = Joi.object().keys({\n name: Joi.string().required(),\n type: Joi.string().required(),\n display: Joi.string().required()\n})\n\nconst conditionValueSchema = Joi.object().keys({\n type: Joi.string().required(),\n value: Joi.string().required(),\n display: Joi.string().required()\n})\n\nconst relativeTimeValueSchema = Joi.object().keys({\n type: Joi.string().required(),\n timePeriod: Joi.string().required(),\n timeUnit: Joi.string().required(),\n direction: Joi.string().required(),\n timeOnly: Joi.boolean().required()\n})\n\nconst conditionRefSchema = Joi.object().keys({\n conditionName: Joi.string().required(),\n conditionDisplayName: Joi.string().required(),\n coordinator: Joi.string().optional()\n})\n\nconst conditionSchema = Joi.object().keys({\n field: conditionFieldSchema,\n operator: Joi.string().required(),\n value: Joi.alternatives().try(conditionValueSchema, relativeTimeValueSchema),\n coordinator: Joi.string().optional()\n})\n\nconst conditionGroupSchema = Joi.object().keys({\n conditions: Joi.array().items(\n Joi.alternatives().try(\n conditionSchema,\n conditionRefSchema,\n Joi.any() /** Should be a joi.link('#conditionGroupSchema') */\n )\n )\n})\n\nconst conditionsModelSchema = Joi.alternatives<ConditionWrapperValue>().try(\n Joi.string(),\n Joi.object().keys({\n name: Joi.string().required(),\n conditions: Joi.array().items(\n Joi.alternatives().try(\n conditionSchema,\n conditionRefSchema,\n conditionGroupSchema\n )\n )\n })\n)\n\nconst conditionsSchema = Joi.object<ConditionRawData>().keys({\n name: Joi.string().required(),\n displayName: Joi.string(),\n value: conditionsModelSchema.required()\n})\n\nconst localisedString = Joi.alternatives().try(\n Joi.object({ a: Joi.any() }).unknown(),\n Joi.string().allow('')\n)\n\nexport const componentSchema = Joi.object<ComponentDef>()\n .keys({\n type: Joi.string<ComponentType>().required(),\n name: Joi.string(),\n title: localisedString,\n hint: localisedString.optional(),\n options: Joi.object().default({}),\n schema: Joi.object({ min: Joi.number(), max: Joi.number() })\n .unknown(true)\n .default({}),\n list: Joi.string().optional()\n })\n .unknown(true)\n\nconst nextSchema = Joi.object<Next>().keys({\n path: Joi.string().required(),\n condition: Joi.string().allow('').optional(),\n redirect: Joi.string().optional()\n})\n\n/**\n * `/status` is a special route for providing a user's application status.\n * It should not be configured via the designer.\n */\nconst pageSchema = Joi.object<Page | RepeatingFieldPage>().keys({\n path: Joi.string().required().disallow('/status'),\n title: localisedString,\n section: Joi.string(),\n controller: Joi.string().optional(),\n components: Joi.array<ComponentDef>().items(componentSchema),\n next: Joi.array<Next>().items(nextSchema),\n repeatField: Joi.string().optional(),\n options: Joi.object().optional(),\n backLinkFallback: Joi.string().optional()\n})\n\nconst toggleableString = Joi.alternatives().try(Joi.boolean(), Joi.string())\n\nconst confirmationPageSchema = Joi.object<ConfirmationPage>({\n customText: Joi.object<ConfirmationPage['customText']>({\n title: Joi.string().default('Application complete'),\n nextSteps: toggleableString.default(\n 'You will receive an email with details with the next steps.'\n )\n }).default(),\n components: Joi.array<ComponentDef>().items(componentSchema)\n})\n\nconst specialPagesSchema = Joi.object<SpecialPages>().keys({\n confirmationPage: confirmationPageSchema.optional()\n})\n\nconst baseListItemSchema = Joi.object<Item>().keys({\n text: localisedString,\n description: localisedString.optional(),\n conditional: Joi.object<Item['conditional']>()\n .keys({\n components: Joi.array<ComponentDef>()\n .required()\n .items(componentSchema.unknown(true))\n .unique('name')\n })\n .allow(null)\n .optional(),\n condition: Joi.string().allow(null, '').optional()\n})\n\nconst stringListItemSchema = baseListItemSchema.append({\n value: Joi.string().required()\n})\n\nconst numberListItemSchema = baseListItemSchema.append({\n value: Joi.number().required()\n})\n\nconst listSchema = Joi.object<List>().keys({\n name: Joi.string().required(),\n title: localisedString,\n type: Joi.string().required().valid('string', 'number'),\n items: Joi.when('type', {\n is: 'string',\n then: Joi.array()\n .items(stringListItemSchema)\n .unique('text')\n .unique('value'),\n otherwise: Joi.array()\n .items(numberListItemSchema)\n .unique('text')\n .unique('value')\n })\n})\n\nconst feedbackSchema = Joi.object<FormDefinition['feedback']>().keys({\n feedbackForm: Joi.boolean().default(false),\n url: Joi.when('feedbackForm', {\n is: Joi.boolean().valid(false),\n then: Joi.string().optional().allow('')\n }),\n emailAddress: Joi.string()\n .email({\n tlds: {\n allow: false\n }\n })\n .optional()\n})\n\nconst phaseBannerSchema = Joi.object<PhaseBanner>().keys({\n phase: Joi.string().valid('alpha', 'beta')\n})\n\n/**\n * Joi schema for `FormDefinition` interface\n * @see {@link FormDefinition}\n */\nexport const formDefinitionSchema = Joi.object<FormDefinition>()\n .required()\n .keys({\n name: localisedString.optional(),\n feedback: feedbackSchema.optional(),\n startPage: Joi.string().optional(),\n pages: Joi.array<Page | RepeatingFieldPage>()\n .required()\n .items(pageSchema)\n .unique('path'),\n sections: Joi.array<Section>()\n .items(sectionsSchema)\n .unique('name')\n .required(),\n conditions: Joi.array<ConditionRawData>()\n .items(conditionsSchema)\n .unique('name'),\n lists: Joi.array<List>().items(listSchema).unique('name'),\n metadata: Joi.object({ a: Joi.any() }).unknown().optional(),\n declaration: Joi.string().allow('').optional(),\n skipSummary: Joi.boolean().optional().default(false),\n phaseBanner: phaseBannerSchema.optional(),\n specialPages: specialPagesSchema.optional(),\n outputEmail: Joi.string()\n .email({ tlds: { allow: ['uk'] } })\n .trim()\n .optional()\n })\n\n// Maintain compatibility with legacy named export\n// E.g. `import { Schema } from '@defra/forms-model'`\nexport const Schema = formDefinitionSchema\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,KAAK;AAmBrB;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAe,GAAG,CAAC;AAEhC,MAAMC,cAAc,GAAGF,GAAG,CAACG,MAAM,CAAU,CAAC,CAACC,IAAI,CAAC;EAChDC,IAAI,EAAEL,GAAG,CAACM,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EAC7BC,KAAK,EAAER,GAAG,CAACM,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EAC9BE,SAA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
|
+
{"version":3,"file":"index.js","names":["Joi","CURRENT_VERSION","sectionsSchema","object","keys","name","string","required","title","hideTitle","boolean","optional","default","conditionFieldSchema","type","display","conditionValueSchema","value","relativeTimeValueSchema","timePeriod","timeUnit","direction","timeOnly","conditionRefSchema","conditionName","conditionDisplayName","coordinator","conditionSchema","field","operator","alternatives","try","conditionGroupSchema","conditions","array","items","any","conditionsModelSchema","conditionsSchema","displayName","localisedString","a","unknown","allow","componentSchema","hint","options","schema","min","number","max","list","nextSchema","path","condition","redirect","pageSchema","disallow","section","controller","components","next","baseListItemSchema","text","description","conditional","unique","stringListItemSchema","append","numberListItemSchema","listSchema","valid","when","is","then","otherwise","feedbackSchema","feedbackForm","url","emailAddress","email","tlds","phaseBannerSchema","phase","formDefinitionSchema","feedback","startPage","pages","sections","lists","metadata","declaration","skipSummary","phaseBanner","outputEmail","trim","Schema"],"sources":["../../../../src/form/form-definition/index.ts"],"sourcesContent":["import Joi from 'joi'\n\nimport { type ComponentType } from '~/src/components/enums.js'\nimport { type ComponentDef } from '~/src/components/types.js'\nimport {\n type ConditionRawData,\n type ConditionWrapperValue,\n type FormDefinition,\n type Item,\n type Link,\n type List,\n type Page,\n type PhaseBanner,\n type Section\n} from '~/src/form/form-definition/types.js'\n\n/**\n * If an optional key is added, CURRENT_VERSION does not need to be incremented.\n * Only breaking changes will require an increment, as well as a migration script.\n */\nexport const CURRENT_VERSION = 2\n\nconst sectionsSchema = Joi.object<Section>().keys({\n name: Joi.string().required(),\n title: Joi.string().required(),\n hideTitle: Joi.boolean().optional().default(false)\n})\n\nconst conditionFieldSchema = Joi.object().keys({\n name: Joi.string().required(),\n type: Joi.string().required(),\n display: Joi.string().required()\n})\n\nconst conditionValueSchema = Joi.object().keys({\n type: Joi.string().required(),\n value: Joi.string().required(),\n display: Joi.string().required()\n})\n\nconst relativeTimeValueSchema = Joi.object().keys({\n type: Joi.string().required(),\n timePeriod: Joi.string().required(),\n timeUnit: Joi.string().required(),\n direction: Joi.string().required(),\n timeOnly: Joi.boolean().required()\n})\n\nconst conditionRefSchema = Joi.object().keys({\n conditionName: Joi.string().required(),\n conditionDisplayName: Joi.string().required(),\n coordinator: Joi.string().optional()\n})\n\nconst conditionSchema = Joi.object().keys({\n field: conditionFieldSchema,\n operator: Joi.string().required(),\n value: Joi.alternatives().try(conditionValueSchema, relativeTimeValueSchema),\n coordinator: Joi.string().optional()\n})\n\nconst conditionGroupSchema = Joi.object().keys({\n conditions: Joi.array().items(\n Joi.alternatives().try(\n conditionSchema,\n conditionRefSchema,\n Joi.any() /** Should be a joi.link('#conditionGroupSchema') */\n )\n )\n})\n\nconst conditionsModelSchema = Joi.alternatives<ConditionWrapperValue>().try(\n Joi.string(),\n Joi.object().keys({\n name: Joi.string().required(),\n conditions: Joi.array().items(\n Joi.alternatives().try(\n conditionSchema,\n conditionRefSchema,\n conditionGroupSchema\n )\n )\n })\n)\n\nconst conditionsSchema = Joi.object<ConditionRawData>().keys({\n name: Joi.string().required(),\n displayName: Joi.string(),\n value: conditionsModelSchema.required()\n})\n\nconst localisedString = Joi.alternatives().try(\n Joi.object({ a: Joi.any() }).unknown(),\n Joi.string().allow('')\n)\n\nexport const componentSchema = Joi.object<ComponentDef>()\n .keys({\n type: Joi.string<ComponentType>().required(),\n name: Joi.string(),\n title: localisedString,\n hint: localisedString.optional(),\n options: Joi.object().default({}),\n schema: Joi.object({ min: Joi.number(), max: Joi.number() })\n .unknown(true)\n .default({}),\n list: Joi.string().optional()\n })\n .unknown(true)\n\nconst nextSchema = Joi.object<Link>().keys({\n path: Joi.string().required(),\n condition: Joi.string().allow('').optional(),\n redirect: Joi.string().optional()\n})\n\n/**\n * `/status` is a special route for providing a user's application status.\n * It should not be configured via the designer.\n */\nconst pageSchema = Joi.object<Page>().keys({\n path: Joi.string().required().disallow('/status'),\n title: localisedString,\n section: Joi.string(),\n controller: Joi.string().optional(),\n components: Joi.array<ComponentDef>().items(componentSchema),\n next: Joi.array<Link>().items(nextSchema)\n})\n\nconst baseListItemSchema = Joi.object<Item>().keys({\n text: localisedString,\n description: localisedString.optional(),\n conditional: Joi.object<Item['conditional']>()\n .keys({\n components: Joi.array<ComponentDef>()\n .required()\n .items(componentSchema.unknown(true))\n .unique('name')\n })\n .allow(null)\n .optional(),\n condition: Joi.string().allow(null, '').optional()\n})\n\nconst stringListItemSchema = baseListItemSchema.append({\n value: Joi.string().required()\n})\n\nconst numberListItemSchema = baseListItemSchema.append({\n value: Joi.number().required()\n})\n\nconst listSchema = Joi.object<List>().keys({\n name: Joi.string().required(),\n title: localisedString,\n type: Joi.string().required().valid('string', 'number'),\n items: Joi.when('type', {\n is: 'string',\n then: Joi.array()\n .items(stringListItemSchema)\n .unique('text')\n .unique('value'),\n otherwise: Joi.array()\n .items(numberListItemSchema)\n .unique('text')\n .unique('value')\n })\n})\n\nconst feedbackSchema = Joi.object<FormDefinition['feedback']>().keys({\n feedbackForm: Joi.boolean().default(false),\n url: Joi.when('feedbackForm', {\n is: Joi.boolean().valid(false),\n then: Joi.string().optional().allow('')\n }),\n emailAddress: Joi.string()\n .email({\n tlds: {\n allow: false\n }\n })\n .optional()\n})\n\nconst phaseBannerSchema = Joi.object<PhaseBanner>().keys({\n phase: Joi.string().valid('alpha', 'beta')\n})\n\n/**\n * Joi schema for `FormDefinition` interface\n * @see {@link FormDefinition}\n */\nexport const formDefinitionSchema = Joi.object<FormDefinition>()\n .required()\n .keys({\n name: localisedString.optional(),\n feedback: feedbackSchema.optional(),\n startPage: Joi.string().optional(),\n pages: Joi.array<Page>().required().items(pageSchema).unique('path'),\n sections: Joi.array<Section>()\n .items(sectionsSchema)\n .unique('name')\n .required(),\n conditions: Joi.array<ConditionRawData>()\n .items(conditionsSchema)\n .unique('name'),\n lists: Joi.array<List>().items(listSchema).unique('name'),\n metadata: Joi.object({ a: Joi.any() }).unknown().optional(),\n declaration: Joi.string().allow('').optional(),\n skipSummary: Joi.boolean().optional().default(false),\n phaseBanner: phaseBannerSchema.optional(),\n outputEmail: Joi.string()\n .email({ tlds: { allow: ['uk'] } })\n .trim()\n .optional()\n })\n\n// Maintain compatibility with legacy named export\n// E.g. `import { Schema } from '@defra/forms-model'`\nexport const Schema = formDefinitionSchema\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,KAAK;AAgBrB;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAe,GAAG,CAAC;AAEhC,MAAMC,cAAc,GAAGF,GAAG,CAACG,MAAM,CAAU,CAAC,CAACC,IAAI,CAAC;EAChDC,IAAI,EAAEL,GAAG,CAACM,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EAC7BC,KAAK,EAAER,GAAG,CAACM,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EAC9BE,SAAS,EAAET,GAAG,CAACU,OAAO,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAACC,OAAO,CAAC,KAAK;AACnD,CAAC,CAAC;AAEF,MAAMC,oBAAoB,GAAGb,GAAG,CAACG,MAAM,CAAC,CAAC,CAACC,IAAI,CAAC;EAC7CC,IAAI,EAAEL,GAAG,CAACM,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EAC7BO,IAAI,EAAEd,GAAG,CAACM,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EAC7BQ,OAAO,EAAEf,GAAG,CAACM,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC;AACjC,CAAC,CAAC;AAEF,MAAMS,oBAAoB,GAAGhB,GAAG,CAACG,MAAM,CAAC,CAAC,CAACC,IAAI,CAAC;EAC7CU,IAAI,EAAEd,GAAG,CAACM,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EAC7BU,KAAK,EAAEjB,GAAG,CAACM,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EAC9BQ,OAAO,EAAEf,GAAG,CAACM,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC;AACjC,CAAC,CAAC;AAEF,MAAMW,uBAA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GAAG,CAACG,MAAM,CAAC;IAAEsC,CAAC,EAAEzC,GAAG,CAACoC,GAAG,CAAC;EAAE,CAAC,CAAC,CAACM,OAAO,CAAC,CAAC,CAAC/B,QAAQ,CAAC,CAAC;EAC3DgF,WAAW,EAAE3F,GAAG,CAACM,MAAM,CAAC,CAAC,CAACqC,KAAK,CAAC,EAAE,CAAC,CAAChC,QAAQ,CAAC,CAAC;EAC9CiF,WAAW,EAAE5F,GAAG,CAACU,OAAO,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAACC,OAAO,CAAC,KAAK,CAAC;EACpDiF,WAAW,EAAEX,iBAAiB,CAACvE,QAAQ,CAAC,CAAC;EACzCmF,WAAW,EAAE9F,GAAG,CAACM,MAAM,CAAC,CAAC,CACtB0E,KAAK,CAAC;IAAEC,IAAI,EAAE;MAAEtC,KAAK,EAAE,CAAC,IAAI;IAAE;EAAE,CAAC,CAAC,CAClCoD,IAAI,CAAC,CAAC,CACNpF,QAAQ,CAAC;AACd,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMqF,MAAM,GAAGZ,oBAAoB","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../src/form/form-definition/types.ts"],"sourcesContent":["import { type ComponentDef } from '~/src/components/types.js'\nimport { type Condition } from '~/src/conditions/condition.js'\nimport { formDefinitionSchema } from '~/src/form/form-definition/index.js'\n\
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../src/form/form-definition/types.ts"],"sourcesContent":["import { type ComponentDef } from '~/src/components/types.js'\nimport { type Condition } from '~/src/conditions/condition.js'\nimport { formDefinitionSchema } from '~/src/form/form-definition/index.js'\n\nexport interface Link {\n path: string\n condition?: string\n redirect?: string\n}\n\nexport interface Page {\n title: string\n path: string\n controller?: string\n components?: ComponentDef[]\n section?: string // the section ID\n next?: Link[]\n}\n\nexport interface Section {\n name: string\n title: string\n hideTitle?: boolean\n}\n\nexport interface Item {\n text: string\n value: string | number | boolean\n description?: string\n conditional?: { components: ComponentDef[] } | null\n condition?: string | null\n}\n\nexport interface List {\n name: string\n title: string\n type: 'string' | 'number' | 'boolean'\n items: Item[]\n}\n\nexport interface Feedback {\n feedbackForm?: boolean\n url?: string\n emailAddress?: string\n}\n\nexport interface PhaseBanner {\n phase?: 'alpha' | 'beta'\n feedbackUrl?: string\n}\n\nexport type ConditionWrapperValue =\n | string\n | {\n name: string\n conditions: Condition[]\n }\n\nexport interface ConditionRawData {\n name: string\n displayName: string\n value: ConditionWrapperValue\n}\n\n/**\n * Interface for `formDefinitionSchema` Joi schema\n * @see {@link formDefinitionSchema}\n */\nexport interface FormDefinition {\n pages: Page[]\n conditions: ConditionRawData[]\n lists: List[]\n sections: Section[]\n startPage?: Page['path']\n name?: string\n feedback?: Feedback\n phaseBanner?: PhaseBanner\n skipSummary?: boolean\n declaration?: string\n metadata?: Record<string, unknown>\n outputEmail?: string\n}\n"],"mappings":"","ignoreList":[]}
|
@@ -1,9 +1,6 @@
|
|
1
|
-
import { ComponentSubType } from '../components/enums.js';
|
2
1
|
import { type ComponentDef } from '../components/types.js';
|
3
2
|
/**
|
4
3
|
* Defaults for creating new components
|
5
4
|
*/
|
6
|
-
export declare const ComponentTypes:
|
7
|
-
subType?: ComponentSubType;
|
8
|
-
})[];
|
5
|
+
export declare const ComponentTypes: ComponentDef[];
|
9
6
|
//# sourceMappingURL=component-types.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"component-types.d.ts","sourceRoot":"","sources":["../../../src/components/component-types.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"component-types.d.ts","sourceRoot":"","sources":["../../../src/components/component-types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE7D;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,YAAY,EAiJxC,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../src/components/enums.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa;IACvB,SAAS,cAAc;IACvB,kBAAkB,uBAAuB;IACzC,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,cAAc,mBAAmB;IACjC,cAAc,mBAAmB;IACjC,WAAW,gBAAgB;IAC3B,iBAAiB,sBAAsB;IACvC,WAAW,gBAAgB;IAC3B,eAAe,oBAAoB;IACnC,WAAW,gBAAgB;IAC3B,cAAc,mBAAmB;IACjC,oBAAoB,yBAAyB;IAC7C,iBAAiB,sBAAsB;IACvC,IAAI,SAAS;IACb,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,IAAI,SAAS;CACd
|
1
|
+
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../src/components/enums.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa;IACvB,SAAS,cAAc;IACvB,kBAAkB,uBAAuB;IACzC,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,cAAc,mBAAmB;IACjC,cAAc,mBAAmB;IACjC,WAAW,gBAAgB;IAC3B,iBAAiB,sBAAsB;IACvC,WAAW,gBAAgB;IAC3B,eAAe,oBAAoB;IACnC,WAAW,gBAAgB;IAC3B,cAAc,mBAAmB;IACjC,oBAAoB,yBAAyB;IAC7C,iBAAiB,sBAAsB;IACvC,IAAI,SAAS;IACb,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,IAAI,SAAS;CACd"}
|
@@ -3,9 +3,7 @@ import { type InputFieldsComponentsDef, type ComponentDef, type ConditionalCompo
|
|
3
3
|
/**
|
4
4
|
* Return component defaults by type
|
5
5
|
*/
|
6
|
-
export declare function getComponentDefaults(component?: Partial<ComponentDef>):
|
7
|
-
subType?: import("../components/enums.js").ComponentSubType;
|
8
|
-
}) | undefined;
|
6
|
+
export declare function getComponentDefaults(component?: Partial<ComponentDef>): ComponentDef | undefined;
|
9
7
|
/**
|
10
8
|
* Filter known components with support for conditions
|
11
9
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/components/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACzB,MAAM,2BAA2B,CAAA;AAElC;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/components/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACzB,MAAM,2BAA2B,CAAA;AAElC;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,4BAMrE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAChC,SAAS,IAAI,wBAAwB,CAEvC;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,CAAC,EAAE,aAAa,GACnB,IAAI,IAAI,wBAAwB,CAclC;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAChC,SAAS,IAAI,oBAAoB,CAQnC;AAED;;GAEG;AACH,wBAAgB,SAAS,CACvB,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAChC,SAAS,IAAI,mBAAmB,CAmBlC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAChC,SAAS,IAAI,wBAAwB,CAevC;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAChC,SAAS,IAAI,iBAAiB,CAUhC;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAChC,SAAS,IAAI,sBAAsB,CASrC;AAED;;GAEG;AACH,wBAAgB,QAAQ,CACtB,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAChC,SAAS,IAAI,OAAO,CAAC,YAAY,EAAE,kBAAkB,GAAG,aAAa,CAAC,CAGxE"}
|
@@ -1,4 +1,4 @@
|
|
1
1
|
export { ComponentTypes } from '../components/component-types.js';
|
2
2
|
export { getComponentDefaults, hasConditionSupport, hasContentField, hasEditor, hasInputField, hasListField, hasSelectionFields, hasTitle } from '../components/helpers.js';
|
3
|
-
export { ComponentType
|
3
|
+
export { ComponentType } from '../components/enums.js';
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACpE,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,SAAS,EACT,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,QAAQ,EACT,MAAM,6BAA6B,CAAA;AAEpC,OAAO,EAAE,aAAa,EAAE,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACpE,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,SAAS,EACT,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,QAAQ,EACT,MAAM,6BAA6B,CAAA;AAEpC,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA"}
|
@@ -182,7 +182,7 @@ export interface SelectFieldComponent extends ListFieldBase {
|
|
182
182
|
};
|
183
183
|
}
|
184
184
|
export type ComponentDef = InsetTextComponent | AutocompleteFieldComponent | CheckboxesFieldComponent | DatePartsFieldFieldComponent | MonthYearFieldComponent | DetailsComponent | EmailAddressFieldComponent | HtmlComponent | ListComponent | MultilineTextFieldComponent | NumberFieldComponent | RadiosFieldComponent | SelectFieldComponent | TelephoneNumberFieldComponent | TextFieldComponent | TimeFieldComponent | UkAddressFieldComponent | YesNoFieldComponent;
|
185
|
-
export type InputFieldsComponentsDef = TextFieldComponent | EmailAddressFieldComponent | NumberFieldComponent | MultilineTextFieldComponent | TelephoneNumberFieldComponent | YesNoFieldComponent | MonthYearFieldComponent | TimeFieldComponent | UkAddressFieldComponent;
|
185
|
+
export type InputFieldsComponentsDef = TextFieldComponent | EmailAddressFieldComponent | NumberFieldComponent | MultilineTextFieldComponent | TelephoneNumberFieldComponent | YesNoFieldComponent | MonthYearFieldComponent | TimeFieldComponent | DatePartsFieldFieldComponent | UkAddressFieldComponent;
|
186
186
|
export type ContentComponentsDef = DetailsComponent | HtmlComponent | InsetTextComponent;
|
187
187
|
export type EditorComponentsDef = TextFieldComponent | EmailAddressFieldComponent | TelephoneNumberFieldComponent | MultilineTextFieldComponent | NumberFieldComponent | AutocompleteFieldComponent | SelectFieldComponent | RadiosFieldComponent | CheckboxesFieldComponent | ListComponent | DetailsComponent | HtmlComponent | InsetTextComponent | DatePartsFieldFieldComponent;
|
188
188
|
export type ListComponentsDef = ListComponent | AutocompleteFieldComponent | CheckboxesFieldComponent | RadiosFieldComponent | SelectFieldComponent;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAE9D,MAAM,MAAM,wBAAwB,GAChC,aAAa,CAAC,WAAW,GACzB,aAAa,CAAC,eAAe,GAC7B,aAAa,CAAC,cAAc,GAC5B,aAAa,CAAC,iBAAiB,GAC/B,aAAa,CAAC,kBAAkB,GAChC,aAAa,CAAC,WAAW,GACzB,aAAa,CAAC,SAAS,GACvB,aAAa,CAAC,SAAS,GACvB,aAAa,CAAC,UAAU,CAAA;AAE5B;;GAEG;AACH,UAAU,aAAa;IACrB,IAAI,EACA,aAAa,CAAC,iBAAiB,GAC/B,aAAa,CAAC,kBAAkB,GAChC,aAAa,CAAC,WAAW,GACzB,aAAa,CAAC,oBAAoB,GAClC,aAAa,CAAC,SAAS,GACvB,aAAa,CAAC,cAAc,GAC5B,aAAa,CAAC,UAAU,CAAA;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,EAAE;QACP,QAAQ,CAAC,EAAE,OAAO,CAAA;QAClB,YAAY,CAAC,EAAE,OAAO,CAAA;QACtB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,YAAY,CAAC,EAAE,MAAM,CAAA;KACtB,CAAA;IACD,MAAM,EAAE;QACN,GAAG,CAAC,EAAE,MAAM,CAAA;QACZ,GAAG,CAAC,EAAE,MAAM,CAAA;QACZ,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,KAAK,CAAC,EAAE,OAAO,CAAA;KAChB,CAAA;CACF;AAED,UAAU,eAAe;IACvB,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ACvB,gBAAgB,GAChB,0BAA0B,GAC1B,aAAa,GACb,aAAa,GACb,2BAA2B,GAC3B,oBAAoB,GACpB,oBAAoB,GACpB,oBAAoB,GACpB,6BAA6B,GAC7B,kBAAkB,GAClB,kBAAkB,GAClB,uBAAuB,GACvB,mBAAmB,CAAA;AAGvB,MAAM,MAAM,wBAAwB,GAChC,kBAAkB,GAClB,0BAA0B,GAC1B,oBAAoB,GACpB,2BAA2B,GAC3B,6BAA6B,GAC7B,mBAAmB,GACnB,uBAAuB,GACvB,kBAAkB,GAClB,uBAAuB,CAAA;AAG3B,MAAM,MAAM,oBAAoB,GAC5B,gBAAgB,GAChB,aAAa,GACb,kBAAkB,CAAA;AAGtB,MAAM,MAAM,mBAAmB,GAC3B,kBAAkB,GAClB,0BAA0B,GAC1B,6BAA6B,GAC7B,2BAA2B,GAC3B,oBAAoB,GACpB,0BAA0B,GAC1B,oBAAoB,GACpB,oBAAoB,GACpB,wBAAwB,GACxB,aAAa,GACb,gBAAgB,GAChB,aAAa,GACb,kBAAkB,GAClB,4BAA4B,CAAA;AAGhC,MAAM,MAAM,iBAAiB,GACzB,aAAa,GACb,0BAA0B,GAC1B,wBAAwB,GACxB,oBAAoB,GACpB,oBAAoB,CAAA;AAGxB,MAAM,MAAM,sBAAsB,GAC9B,wBAAwB,GACxB,oBAAoB,GACpB,oBAAoB,GACpB,mBAAmB,CAAA;AAGvB,MAAM,MAAM,wBAAwB,GAChC,wBAAwB,GACxB,4BAA4B,GAC5B,0BAA0B,GAC1B,2BAA2B,GAC3B,oBAAoB,GACpB,kBAAkB,GAClB,kBAAkB,GAClB,mBAAmB,CAAA"}
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAE9D,MAAM,MAAM,wBAAwB,GAChC,aAAa,CAAC,WAAW,GACzB,aAAa,CAAC,eAAe,GAC7B,a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C7B,mBAAmB,GACnB,uBAAuB,GACvB,kBAAkB,GAClB,4BAA4B,GAC5B,uBAAuB,CAAA;AAG3B,MAAM,MAAM,oBAAoB,GAC5B,gBAAgB,GAChB,aAAa,GACb,kBAAkB,CAAA;AAGtB,MAAM,MAAM,mBAAmB,GAC3B,kBAAkB,GAClB,0BAA0B,GAC1B,6BAA6B,GAC7B,2BAA2B,GAC3B,oBAAoB,GACpB,0BAA0B,GAC1B,oBAAoB,GACpB,oBAAoB,GACpB,wBAAwB,GACxB,aAAa,GACb,gBAAgB,GAChB,aAAa,GACb,kBAAkB,GAClB,4BAA4B,CAAA;AAGhC,MAAM,MAAM,iBAAiB,GACzB,aAAa,GACb,0BAA0B,GAC1B,wBAAwB,GACxB,oBAAoB,GACpB,oBAAoB,CAAA;AAGxB,MAAM,MAAM,sBAAsB,GAC9B,wBAAwB,GACxB,oBAAoB,GACpB,oBAAoB,GACpB,mBAAmB,CAAA;AAGvB,MAAM,MAAM,wBAAwB,GAChC,wBAAwB,GACxB,4BAA4B,GAC5B,0BAA0B,GAC1B,2BAA2B,GAC3B,oBAAoB,GACpB,kBAAkB,GAClB,kBAAkB,GAClB,mBAAmB,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/form/form-definition/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAA;AAGrB,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/form/form-definition/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAA;AAGrB,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAGL,KAAK,cAAc,EAOpB,MAAM,qCAAqC,CAAA;AAE5C;;;GAGG;AACH,eAAO,MAAM,eAAe,IAAI,CAAA;AA4EhC,eAAO,MAAM,eAAe,gCAYZ,CAAA;AAgFhB;;;GAGG;AACH,eAAO,MAAM,oBAAoB,kCAuB7B,CAAA;AAIJ,eAAO,MAAM,MAAM,kCAAuB,CAAA"}
|
@@ -1,34 +1,17 @@
|
|
1
1
|
import { type ComponentDef } from '../../components/types.js';
|
2
2
|
import { type Condition } from '../../conditions/condition.js';
|
3
|
-
|
4
|
-
export interface Next {
|
3
|
+
export interface Link {
|
5
4
|
path: string;
|
6
5
|
condition?: string;
|
7
6
|
redirect?: string;
|
8
7
|
}
|
9
|
-
export type Link = Next;
|
10
8
|
export interface Page {
|
11
9
|
title: string;
|
12
10
|
path: string;
|
13
11
|
controller?: string;
|
14
12
|
components?: ComponentDef[];
|
15
13
|
section?: string;
|
16
|
-
next?:
|
17
|
-
repeatField?: string;
|
18
|
-
backLinkFallback?: string;
|
19
|
-
}
|
20
|
-
export interface RepeatingFieldPage extends Page {
|
21
|
-
controller: 'RepeatingFieldPageController';
|
22
|
-
options: {
|
23
|
-
summaryDisplayMode?: {
|
24
|
-
samePage?: boolean;
|
25
|
-
separatePage?: boolean;
|
26
|
-
hideRowTitles?: boolean;
|
27
|
-
};
|
28
|
-
customText?: {
|
29
|
-
separatePageTitle?: string;
|
30
|
-
};
|
31
|
-
};
|
14
|
+
next?: Link[];
|
32
15
|
}
|
33
16
|
export interface Section {
|
34
17
|
name: string;
|
@@ -59,16 +42,6 @@ export interface PhaseBanner {
|
|
59
42
|
phase?: 'alpha' | 'beta';
|
60
43
|
feedbackUrl?: string;
|
61
44
|
}
|
62
|
-
export interface ConfirmationPage {
|
63
|
-
customText: {
|
64
|
-
title: string;
|
65
|
-
nextSteps: Toggleable<string>;
|
66
|
-
};
|
67
|
-
components: ComponentDef[];
|
68
|
-
}
|
69
|
-
export interface SpecialPages {
|
70
|
-
confirmationPage?: ConfirmationPage;
|
71
|
-
}
|
72
45
|
export type ConditionWrapperValue = string | {
|
73
46
|
name: string;
|
74
47
|
conditions: Condition[];
|
@@ -83,7 +56,7 @@ export interface ConditionRawData {
|
|
83
56
|
* @see {@link formDefinitionSchema}
|
84
57
|
*/
|
85
58
|
export interface FormDefinition {
|
86
|
-
pages:
|
59
|
+
pages: Page[];
|
87
60
|
conditions: ConditionRawData[];
|
88
61
|
lists: List[];
|
89
62
|
sections: Section[];
|
@@ -94,8 +67,6 @@ export interface FormDefinition {
|
|
94
67
|
skipSummary?: boolean;
|
95
68
|
declaration?: string;
|
96
69
|
metadata?: Record<string, unknown>;
|
97
|
-
specialPages?: SpecialPages;
|
98
70
|
outputEmail?: string;
|
99
71
|
}
|
100
|
-
export {};
|
101
72
|
//# sourceMappingURL=types.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/form/form-definition/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAG9D,
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/form/form-definition/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAG9D,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,YAAY,EAAE,CAAA;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,IAAI,EAAE,CAAA;CACd;AAED,MAAM,W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,EAAE,OAAO,EAAE,CAAA;IACnB,SAAS,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClC,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB"}
|
package/package.json
CHANGED
@@ -1,17 +1,14 @@
|
|
1
|
-
import {
|
1
|
+
import { ComponentType } from '~/src/components/enums.js'
|
2
2
|
import { type ComponentDef } from '~/src/components/types.js'
|
3
3
|
|
4
4
|
/**
|
5
5
|
* Defaults for creating new components
|
6
6
|
*/
|
7
|
-
export const ComponentTypes:
|
8
|
-
subType?: ComponentSubType
|
9
|
-
})[] = [
|
7
|
+
export const ComponentTypes: ComponentDef[] = [
|
10
8
|
{
|
11
9
|
name: 'TextField',
|
12
10
|
title: 'Text field',
|
13
11
|
type: ComponentType.TextField,
|
14
|
-
subType: ComponentSubType.Field,
|
15
12
|
hint: '',
|
16
13
|
options: {},
|
17
14
|
schema: {}
|
@@ -20,7 +17,6 @@ export const ComponentTypes: (ComponentDef & {
|
|
20
17
|
name: 'MultilineTextField',
|
21
18
|
title: 'Multiline text field',
|
22
19
|
type: ComponentType.MultilineTextField,
|
23
|
-
subType: ComponentSubType.Field,
|
24
20
|
hint: '',
|
25
21
|
options: {},
|
26
22
|
schema: {}
|
@@ -29,7 +25,6 @@ export const ComponentTypes: (ComponentDef & {
|
|
29
25
|
name: 'YesNoField',
|
30
26
|
title: 'Yes/No field',
|
31
27
|
type: ComponentType.YesNoField,
|
32
|
-
subType: ComponentSubType.Field,
|
33
28
|
hint: '',
|
34
29
|
options: {},
|
35
30
|
schema: {}
|
@@ -38,7 +33,6 @@ export const ComponentTypes: (ComponentDef & {
|
|
38
33
|
name: 'TimeField',
|
39
34
|
title: 'Time field',
|
40
35
|
type: ComponentType.TimeField,
|
41
|
-
subType: ComponentSubType.Field,
|
42
36
|
hint: '',
|
43
37
|
options: {},
|
44
38
|
schema: {}
|
@@ -47,7 +41,6 @@ export const ComponentTypes: (ComponentDef & {
|
|
47
41
|
name: 'DatePartsField',
|
48
42
|
title: 'Date field',
|
49
43
|
type: ComponentType.DatePartsField,
|
50
|
-
subType: ComponentSubType.Field,
|
51
44
|
hint: '',
|
52
45
|
options: {},
|
53
46
|
schema: {}
|
@@ -56,7 +49,6 @@ export const ComponentTypes: (ComponentDef & {
|
|
56
49
|
name: 'MonthYearField',
|
57
50
|
title: 'Month & year field',
|
58
51
|
type: ComponentType.MonthYearField,
|
59
|
-
subType: ComponentSubType.Field,
|
60
52
|
hint: '',
|
61
53
|
options: {},
|
62
54
|
schema: {}
|
@@ -65,7 +57,6 @@ export const ComponentTypes: (ComponentDef & {
|
|
65
57
|
name: 'SelectField',
|
66
58
|
title: 'Select field',
|
67
59
|
type: ComponentType.SelectField,
|
68
|
-
subType: ComponentSubType.ListField,
|
69
60
|
options: {},
|
70
61
|
schema: {},
|
71
62
|
list: ''
|
@@ -74,7 +65,6 @@ export const ComponentTypes: (ComponentDef & {
|
|
74
65
|
name: 'AutocompleteField',
|
75
66
|
title: 'Autocomplete field',
|
76
67
|
type: ComponentType.AutocompleteField,
|
77
|
-
subType: ComponentSubType.ListField,
|
78
68
|
options: {},
|
79
69
|
schema: {},
|
80
70
|
list: ''
|
@@ -83,7 +73,6 @@ export const ComponentTypes: (ComponentDef & {
|
|
83
73
|
name: 'RadiosField',
|
84
74
|
title: 'Radios field',
|
85
75
|
type: ComponentType.RadiosField,
|
86
|
-
subType: ComponentSubType.ListField,
|
87
76
|
options: {},
|
88
77
|
schema: {},
|
89
78
|
list: ''
|
@@ -92,7 +81,6 @@ export const ComponentTypes: (ComponentDef & {
|
|
92
81
|
name: 'CheckboxesField',
|
93
82
|
title: 'Checkboxes field',
|
94
83
|
type: ComponentType.CheckboxesField,
|
95
|
-
subType: ComponentSubType.ListField,
|
96
84
|
options: {},
|
97
85
|
schema: {},
|
98
86
|
list: ''
|
@@ -101,7 +89,6 @@ export const ComponentTypes: (ComponentDef & {
|
|
101
89
|
name: 'NumberField',
|
102
90
|
title: 'Number field',
|
103
91
|
type: ComponentType.NumberField,
|
104
|
-
subType: ComponentSubType.Field,
|
105
92
|
hint: '',
|
106
93
|
options: {},
|
107
94
|
schema: {}
|
@@ -110,7 +97,6 @@ export const ComponentTypes: (ComponentDef & {
|
|
110
97
|
name: 'UkAddressField',
|
111
98
|
title: 'UK address field',
|
112
99
|
type: ComponentType.UkAddressField,
|
113
|
-
subType: ComponentSubType.Field,
|
114
100
|
hint: '',
|
115
101
|
options: {},
|
116
102
|
schema: {}
|
@@ -119,7 +105,6 @@ export const ComponentTypes: (ComponentDef & {
|
|
119
105
|
name: 'TelephoneNumberField',
|
120
106
|
title: 'Telephone number field',
|
121
107
|
type: ComponentType.TelephoneNumberField,
|
122
|
-
subType: ComponentSubType.Field,
|
123
108
|
hint: '',
|
124
109
|
options: {},
|
125
110
|
schema: {}
|
@@ -128,7 +113,6 @@ export const ComponentTypes: (ComponentDef & {
|
|
128
113
|
name: 'EmailAddressField',
|
129
114
|
title: 'Email address field',
|
130
115
|
type: ComponentType.EmailAddressField,
|
131
|
-
subType: ComponentSubType.Field,
|
132
116
|
hint: 'For example, ‘name@example.com’',
|
133
117
|
options: {},
|
134
118
|
schema: {}
|
@@ -137,7 +121,6 @@ export const ComponentTypes: (ComponentDef & {
|
|
137
121
|
name: 'Html',
|
138
122
|
title: 'Html',
|
139
123
|
type: ComponentType.Html,
|
140
|
-
subType: ComponentSubType.Content,
|
141
124
|
content: '',
|
142
125
|
options: {},
|
143
126
|
schema: {}
|
@@ -146,7 +129,6 @@ export const ComponentTypes: (ComponentDef & {
|
|
146
129
|
name: 'InsetText',
|
147
130
|
title: 'Inset text',
|
148
131
|
type: ComponentType.InsetText,
|
149
|
-
subType: ComponentSubType.Content,
|
150
132
|
content: '',
|
151
133
|
options: {},
|
152
134
|
schema: {}
|
@@ -155,7 +137,6 @@ export const ComponentTypes: (ComponentDef & {
|
|
155
137
|
name: 'Details',
|
156
138
|
title: 'Details',
|
157
139
|
type: ComponentType.Details,
|
158
|
-
subType: ComponentSubType.Content,
|
159
140
|
content: '',
|
160
141
|
options: {},
|
161
142
|
schema: {}
|
@@ -164,7 +145,6 @@ export const ComponentTypes: (ComponentDef & {
|
|
164
145
|
name: 'List',
|
165
146
|
title: 'List',
|
166
147
|
type: ComponentType.List,
|
167
|
-
subType: ComponentSubType.Content,
|
168
148
|
options: {},
|
169
149
|
schema: {},
|
170
150
|
list: ''
|
package/src/components/enums.ts
CHANGED
package/src/components/index.ts
CHANGED
package/src/components/types.ts
CHANGED
@@ -5,16 +5,13 @@ import { type ComponentDef } from '~/src/components/types.js'
|
|
5
5
|
import {
|
6
6
|
type ConditionRawData,
|
7
7
|
type ConditionWrapperValue,
|
8
|
-
type ConfirmationPage,
|
9
8
|
type FormDefinition,
|
10
9
|
type Item,
|
10
|
+
type Link,
|
11
11
|
type List,
|
12
|
-
type Next,
|
13
12
|
type Page,
|
14
13
|
type PhaseBanner,
|
15
|
-
type
|
16
|
-
type Section,
|
17
|
-
type SpecialPages
|
14
|
+
type Section
|
18
15
|
} from '~/src/form/form-definition/types.js'
|
19
16
|
|
20
17
|
/**
|
@@ -111,7 +108,7 @@ export const componentSchema = Joi.object<ComponentDef>()
|
|
111
108
|
})
|
112
109
|
.unknown(true)
|
113
110
|
|
114
|
-
const nextSchema = Joi.object<
|
111
|
+
const nextSchema = Joi.object<Link>().keys({
|
115
112
|
path: Joi.string().required(),
|
116
113
|
condition: Joi.string().allow('').optional(),
|
117
114
|
redirect: Joi.string().optional()
|
@@ -121,32 +118,13 @@ const nextSchema = Joi.object<Next>().keys({
|
|
121
118
|
* `/status` is a special route for providing a user's application status.
|
122
119
|
* It should not be configured via the designer.
|
123
120
|
*/
|
124
|
-
const pageSchema = Joi.object<Page
|
121
|
+
const pageSchema = Joi.object<Page>().keys({
|
125
122
|
path: Joi.string().required().disallow('/status'),
|
126
123
|
title: localisedString,
|
127
124
|
section: Joi.string(),
|
128
125
|
controller: Joi.string().optional(),
|
129
126
|
components: Joi.array<ComponentDef>().items(componentSchema),
|
130
|
-
next: Joi.array<
|
131
|
-
repeatField: Joi.string().optional(),
|
132
|
-
options: Joi.object().optional(),
|
133
|
-
backLinkFallback: Joi.string().optional()
|
134
|
-
})
|
135
|
-
|
136
|
-
const toggleableString = Joi.alternatives().try(Joi.boolean(), Joi.string())
|
137
|
-
|
138
|
-
const confirmationPageSchema = Joi.object<ConfirmationPage>({
|
139
|
-
customText: Joi.object<ConfirmationPage['customText']>({
|
140
|
-
title: Joi.string().default('Application complete'),
|
141
|
-
nextSteps: toggleableString.default(
|
142
|
-
'You will receive an email with details with the next steps.'
|
143
|
-
)
|
144
|
-
}).default(),
|
145
|
-
components: Joi.array<ComponentDef>().items(componentSchema)
|
146
|
-
})
|
147
|
-
|
148
|
-
const specialPagesSchema = Joi.object<SpecialPages>().keys({
|
149
|
-
confirmationPage: confirmationPageSchema.optional()
|
127
|
+
next: Joi.array<Link>().items(nextSchema)
|
150
128
|
})
|
151
129
|
|
152
130
|
const baseListItemSchema = Joi.object<Item>().keys({
|
@@ -218,10 +196,7 @@ export const formDefinitionSchema = Joi.object<FormDefinition>()
|
|
218
196
|
name: localisedString.optional(),
|
219
197
|
feedback: feedbackSchema.optional(),
|
220
198
|
startPage: Joi.string().optional(),
|
221
|
-
pages: Joi.array<Page
|
222
|
-
.required()
|
223
|
-
.items(pageSchema)
|
224
|
-
.unique('path'),
|
199
|
+
pages: Joi.array<Page>().required().items(pageSchema).unique('path'),
|
225
200
|
sections: Joi.array<Section>()
|
226
201
|
.items(sectionsSchema)
|
227
202
|
.unique('name')
|
@@ -234,7 +209,6 @@ export const formDefinitionSchema = Joi.object<FormDefinition>()
|
|
234
209
|
declaration: Joi.string().allow('').optional(),
|
235
210
|
skipSummary: Joi.boolean().optional().default(false),
|
236
211
|
phaseBanner: phaseBannerSchema.optional(),
|
237
|
-
specialPages: specialPagesSchema.optional(),
|
238
212
|
outputEmail: Joi.string()
|
239
213
|
.email({ tlds: { allow: ['uk'] } })
|
240
214
|
.trim()
|
@@ -2,39 +2,19 @@ import { type ComponentDef } from '~/src/components/types.js'
|
|
2
2
|
import { type Condition } from '~/src/conditions/condition.js'
|
3
3
|
import { formDefinitionSchema } from '~/src/form/form-definition/index.js'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
export interface Next {
|
5
|
+
export interface Link {
|
8
6
|
path: string
|
9
7
|
condition?: string
|
10
8
|
redirect?: string
|
11
9
|
}
|
12
10
|
|
13
|
-
export type Link = Next
|
14
|
-
|
15
11
|
export interface Page {
|
16
12
|
title: string
|
17
13
|
path: string
|
18
14
|
controller?: string
|
19
15
|
components?: ComponentDef[]
|
20
16
|
section?: string // the section ID
|
21
|
-
next?:
|
22
|
-
repeatField?: string
|
23
|
-
backLinkFallback?: string
|
24
|
-
}
|
25
|
-
|
26
|
-
export interface RepeatingFieldPage extends Page {
|
27
|
-
controller: 'RepeatingFieldPageController'
|
28
|
-
options: {
|
29
|
-
summaryDisplayMode?: {
|
30
|
-
samePage?: boolean
|
31
|
-
separatePage?: boolean
|
32
|
-
hideRowTitles?: boolean
|
33
|
-
}
|
34
|
-
customText?: {
|
35
|
-
separatePageTitle?: string
|
36
|
-
}
|
37
|
-
}
|
17
|
+
next?: Link[]
|
38
18
|
}
|
39
19
|
|
40
20
|
export interface Section {
|
@@ -69,18 +49,6 @@ export interface PhaseBanner {
|
|
69
49
|
feedbackUrl?: string
|
70
50
|
}
|
71
51
|
|
72
|
-
export interface ConfirmationPage {
|
73
|
-
customText: {
|
74
|
-
title: string
|
75
|
-
nextSteps: Toggleable<string>
|
76
|
-
}
|
77
|
-
components: ComponentDef[]
|
78
|
-
}
|
79
|
-
|
80
|
-
export interface SpecialPages {
|
81
|
-
confirmationPage?: ConfirmationPage
|
82
|
-
}
|
83
|
-
|
84
52
|
export type ConditionWrapperValue =
|
85
53
|
| string
|
86
54
|
| {
|
@@ -99,7 +67,7 @@ export interface ConditionRawData {
|
|
99
67
|
* @see {@link formDefinitionSchema}
|
100
68
|
*/
|
101
69
|
export interface FormDefinition {
|
102
|
-
pages:
|
70
|
+
pages: Page[]
|
103
71
|
conditions: ConditionRawData[]
|
104
72
|
lists: List[]
|
105
73
|
sections: Section[]
|
@@ -110,6 +78,5 @@ export interface FormDefinition {
|
|
110
78
|
skipSummary?: boolean
|
111
79
|
declaration?: string
|
112
80
|
metadata?: Record<string, unknown>
|
113
|
-
specialPages?: SpecialPages
|
114
81
|
outputEmail?: string
|
115
82
|
}
|