@defra/forms-model 3.0.485 → 3.0.487
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module/form/form-definition/index.js +5 -1
- package/dist/module/form/form-definition/index.js.map +1 -1
- package/dist/module/form/form-editor/__stubs__/preview.js +8 -3
- package/dist/module/form/form-editor/__stubs__/preview.js.map +1 -1
- package/dist/module/form/form-editor/preview/component-elements.js +10 -2
- package/dist/module/form/form-editor/preview/component-elements.js.map +1 -1
- package/dist/module/form/form-editor/preview/content.js +3 -2
- package/dist/module/form/form-editor/preview/content.js.map +1 -1
- package/dist/module/form/form-editor/preview/controller/page-controller.js +3 -17
- package/dist/module/form/form-editor/preview/controller/page-controller.js.map +1 -1
- package/dist/module/form/form-editor/preview/helpers.js +6 -5
- package/dist/module/form/form-editor/preview/helpers.js.map +1 -1
- package/dist/module/form/form-editor/preview/list.js +3 -2
- package/dist/module/form/form-editor/preview/list.js.map +1 -1
- package/dist/module/form/form-editor/preview/preview.js +12 -3
- package/dist/module/form/form-editor/preview/preview.js.map +1 -1
- package/dist/module/form/form-editor/preview/question.js +2 -2
- package/dist/module/form/form-editor/preview/question.js.map +1 -1
- package/dist/module/form/form-editor/preview/types.js.map +1 -1
- package/dist/types/form/form-definition/index.d.ts.map +1 -1
- package/dist/types/form/form-editor/__stubs__/preview.d.ts +2 -1
- package/dist/types/form/form-editor/__stubs__/preview.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/component-elements.d.ts +7 -1
- package/dist/types/form/form-editor/preview/component-elements.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/content.d.ts +2 -1
- package/dist/types/form/form-editor/preview/content.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/controller/page-controller.d.ts +0 -10
- package/dist/types/form/form-editor/preview/controller/page-controller.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/helpers.d.ts +2 -1
- package/dist/types/form/form-editor/preview/helpers.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/list.d.ts +2 -1
- package/dist/types/form/form-editor/preview/list.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/preview.d.ts +5 -0
- package/dist/types/form/form-editor/preview/preview.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/question.d.ts +1 -1
- package/dist/types/form/form-editor/preview/question.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/types.d.ts +1 -0
- package/dist/types/form/form-editor/preview/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/schemas/form-definition-v2-schema.json +5 -5
- package/src/form/form-definition/index.ts +5 -3
- package/src/form/form-editor/__stubs__/preview.js +15 -4
- package/src/form/form-editor/preview/component-elements.js +10 -2
- package/src/form/form-editor/preview/content.js +3 -2
- package/src/form/form-editor/preview/controller/page-controller.js +8 -17
- package/src/form/form-editor/preview/helpers.js +10 -5
- package/src/form/form-editor/preview/list.js +3 -2
- package/src/form/form-editor/preview/preview.js +15 -3
- package/src/form/form-editor/preview/question.js +2 -2
- package/src/form/form-editor/preview/types.ts +1 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACvB,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,gDAAgD,CAAA;AAC1F,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,8CAA8C,CAAA;AACrF,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,iDAAiD,CAAA;AAC3F,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,iDAAiD,CAAA;AAC3F,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,+CAA+C,CAAA;AACvF,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,gDAAgD,CAAA;AACzF,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,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,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC5D,mBAAmB,EAAE,MAAM,CAAA;CAC5B;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,iBAAiB,CAAA;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,gBAAgB,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,GAAG,MAAM,CAAA;CAC1E;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,gBAAgB,EAAE,MAAM,EAAE,iBAAiB,EAAE,iBAAiB,GAAG,IAAI,CAAA;CAC7E;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,qBAAqB,GAAG,IAAI,CAAA;CACvE;AAED,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACpD,eAAe,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,MAAM,eAAe,GACvB,iBAAiB,GACjB,oBAAoB,GACpB,oBAAoB,GACpB,kBAAkB,GAClB,mBAAmB,GACnB,QAAQ,GACR,qBAAqB,GACrB,sBAAsB,GACtB,mBAAmB,GACnB,iBAAiB,GACjB,oBAAoB,CAAA"}
|
package/package.json
CHANGED
@@ -1531,11 +1531,11 @@
|
|
1531
1531
|
},
|
1532
1532
|
"items": {
|
1533
1533
|
"type": "array",
|
1534
|
-
"description": "Array of conditions or condition references
|
1534
|
+
"description": "Array of conditions or condition references",
|
1535
1535
|
"minItems": 1,
|
1536
1536
|
"maxItems": 15,
|
1537
1537
|
"items": {
|
1538
|
-
"
|
1538
|
+
"oneOf": [
|
1539
1539
|
{
|
1540
1540
|
"type": "object",
|
1541
1541
|
"description": "Condition definition",
|
@@ -1622,7 +1622,7 @@
|
|
1622
1622
|
"value"
|
1623
1623
|
],
|
1624
1624
|
"additionalProperties": false,
|
1625
|
-
"title": "
|
1625
|
+
"title": "Generic List Items"
|
1626
1626
|
},
|
1627
1627
|
{
|
1628
1628
|
"type": "object",
|
@@ -1653,11 +1653,11 @@
|
|
1653
1653
|
"conditionId"
|
1654
1654
|
],
|
1655
1655
|
"additionalProperties": false,
|
1656
|
-
"title": "
|
1656
|
+
"title": "Generic List Items"
|
1657
1657
|
}
|
1658
1658
|
],
|
1659
1659
|
"title": "Items Item",
|
1660
|
-
"
|
1660
|
+
"oneOfTitles": [
|
1661
1661
|
"Items Item (object)",
|
1662
1662
|
"Items Item (object)"
|
1663
1663
|
]
|
@@ -368,9 +368,11 @@ export const conditionWrapperSchemaV2 = Joi.object<ConditionWrapperV2>()
|
|
368
368
|
),
|
369
369
|
items: Joi.array<ConditionGroupDataV2>()
|
370
370
|
.items(
|
371
|
-
Joi.alternatives()
|
372
|
-
.
|
373
|
-
|
371
|
+
Joi.alternatives().conditional('.componentId', {
|
372
|
+
is: Joi.exist(),
|
373
|
+
then: conditionDataSchemaV2,
|
374
|
+
otherwise: conditionRefDataSchemaV2
|
375
|
+
})
|
374
376
|
)
|
375
377
|
.min(1)
|
376
378
|
.max(15)
|
@@ -96,19 +96,28 @@ export class QuestionPreviewElements {
|
|
96
96
|
* @private
|
97
97
|
*/
|
98
98
|
_items = []
|
99
|
-
|
99
|
+
_largeTitle = true
|
100
100
|
afterInputsHTML = '<div class="govuk-inset-text">No items added yet.</div>'
|
101
101
|
|
102
102
|
/**
|
103
103
|
* @param {BaseSettings} baseSettings
|
104
104
|
*/
|
105
|
-
constructor({
|
105
|
+
constructor({
|
106
|
+
question,
|
107
|
+
hintText,
|
108
|
+
optional,
|
109
|
+
shortDesc,
|
110
|
+
items,
|
111
|
+
content,
|
112
|
+
largeTitle = true
|
113
|
+
}) {
|
106
114
|
this._question = question
|
107
115
|
this._hintText = hintText
|
108
116
|
this._optional = optional
|
109
117
|
this._shortDesc = shortDesc
|
110
118
|
this._items = items
|
111
119
|
this._content = content
|
120
|
+
this._largeTitle = largeTitle
|
112
121
|
}
|
113
122
|
|
114
123
|
/**
|
@@ -121,7 +130,8 @@ export class QuestionPreviewElements {
|
|
121
130
|
optional: this._optional,
|
122
131
|
shortDesc: this._shortDesc,
|
123
132
|
items: this._items,
|
124
|
-
content: this._content
|
133
|
+
content: this._content,
|
134
|
+
largeTitle: this._largeTitle
|
125
135
|
}
|
126
136
|
}
|
127
137
|
|
@@ -176,7 +186,8 @@ export const baseElements = /** @type {BaseSettings} */ ({
|
|
176
186
|
question: 'Which quest would you like to pick?',
|
177
187
|
hintText: 'Choose one adventure that best suits you.',
|
178
188
|
shortDesc: '',
|
179
|
-
content: ''
|
189
|
+
content: '',
|
190
|
+
largeTitle: true
|
180
191
|
})
|
181
192
|
|
182
193
|
const list1Id = '414d82a3-4cab-416a-bd54-6b86fbd51120'
|
@@ -7,11 +7,18 @@ export class ComponentElements {
|
|
7
7
|
* @protected
|
8
8
|
*/
|
9
9
|
_component
|
10
|
+
/**
|
11
|
+
* @type {boolean}
|
12
|
+
* @private
|
13
|
+
*/
|
14
|
+
_largeTitle = true
|
10
15
|
/**
|
11
16
|
* @param {ComponentDef} component
|
17
|
+
* @param {boolean} [largeTitle]
|
12
18
|
*/
|
13
|
-
constructor(component) {
|
19
|
+
constructor(component, largeTitle = true) {
|
14
20
|
this._component = component
|
21
|
+
this._largeTitle = largeTitle
|
15
22
|
}
|
16
23
|
|
17
24
|
/**
|
@@ -27,7 +34,8 @@ export class ComponentElements {
|
|
27
34
|
optional: !required,
|
28
35
|
shortDesc: '',
|
29
36
|
items: [],
|
30
|
-
content: ''
|
37
|
+
content: '',
|
38
|
+
largeTitle: this._largeTitle
|
31
39
|
}
|
32
40
|
}
|
33
41
|
|
@@ -12,9 +12,10 @@ export class ContentElements extends ComponentElements {
|
|
12
12
|
_component
|
13
13
|
/**
|
14
14
|
* @param {Exclude<ContentComponentsDef, ListComponent>} component
|
15
|
+
* @param {boolean} largeTitle
|
15
16
|
*/
|
16
|
-
constructor(component) {
|
17
|
-
super(component)
|
17
|
+
constructor(component, largeTitle = true) {
|
18
|
+
super(component, largeTitle)
|
18
19
|
this._component = component
|
19
20
|
}
|
20
21
|
|
@@ -95,12 +95,6 @@ export class PreviewPageController {
|
|
95
95
|
* @protected
|
96
96
|
*/
|
97
97
|
_guidanceComponent
|
98
|
-
|
99
|
-
/**
|
100
|
-
* @type {boolean}
|
101
|
-
* @private
|
102
|
-
*/
|
103
|
-
_showGuidance = false
|
104
98
|
/**
|
105
99
|
* @param {ComponentDef[]} components
|
106
100
|
* @param {PageOverviewElements} elements
|
@@ -109,7 +103,11 @@ export class PreviewPageController {
|
|
109
103
|
*/
|
110
104
|
constructor(components, elements, definition, renderer) {
|
111
105
|
const questions = components.map(
|
112
|
-
mapComponentToPreviewQuestion(
|
106
|
+
mapComponentToPreviewQuestion(
|
107
|
+
questionRenderer,
|
108
|
+
definition,
|
109
|
+
elements.heading.length > 0
|
110
|
+
)
|
113
111
|
)
|
114
112
|
const firstQuestion = /** @type { Markdown | undefined | Question } */ (
|
115
113
|
questions.shift()
|
@@ -119,8 +117,9 @@ export class PreviewPageController {
|
|
119
117
|
PreviewPageController.getOrCreateGuidanceComponent(firstQuestion)
|
120
118
|
this._guidanceText = elements.guidance
|
121
119
|
this._components = this.#constructComponents(firstQuestion, questions)
|
122
|
-
|
120
|
+
|
123
121
|
this.#pageRenderer = renderer
|
122
|
+
this.#title = elements.heading
|
124
123
|
}
|
125
124
|
|
126
125
|
/**
|
@@ -180,14 +179,6 @@ export class PreviewPageController {
|
|
180
179
|
}
|
181
180
|
}
|
182
181
|
|
183
|
-
/**
|
184
|
-
* @private
|
185
|
-
* @returns {string}
|
186
|
-
*/
|
187
|
-
_fallBackTitle() {
|
188
|
-
return this._components[0]?.question ?? ''
|
189
|
-
}
|
190
|
-
|
191
182
|
/**
|
192
183
|
* @returns {{ text: string, classes: string }}
|
193
184
|
*/
|
@@ -206,7 +197,7 @@ export class PreviewPageController {
|
|
206
197
|
* @returns {string}
|
207
198
|
*/
|
208
199
|
get title() {
|
209
|
-
return this.#title
|
200
|
+
return this.#title
|
210
201
|
}
|
211
202
|
|
212
203
|
/**
|
@@ -55,9 +55,14 @@ const InputFieldComponentDictionary = {
|
|
55
55
|
/**
|
56
56
|
* @param {QuestionRenderer} questionRenderer
|
57
57
|
* @param {FormDefinition} definition
|
58
|
+
* @param {boolean} hasTitle
|
58
59
|
* @returns {(component: ComponentDef) => Question}
|
59
60
|
*/
|
60
|
-
export function mapComponentToPreviewQuestion(
|
61
|
+
export function mapComponentToPreviewQuestion(
|
62
|
+
questionRenderer,
|
63
|
+
definition,
|
64
|
+
hasTitle
|
65
|
+
) {
|
61
66
|
return /** @type {(component: ComponentDef) => Question} */ (
|
62
67
|
(component) => {
|
63
68
|
/**
|
@@ -67,16 +72,16 @@ export function mapComponentToPreviewQuestion(questionRenderer, definition) {
|
|
67
72
|
|
68
73
|
if (hasSelectionFields(component) && hasListField(component)) {
|
69
74
|
const list = findDefinitionListFromComponent(component, definition)
|
70
|
-
questionElements = new ListComponentElements(component, list)
|
75
|
+
questionElements = new ListComponentElements(component, list, !hasTitle)
|
71
76
|
} else if (
|
72
77
|
hasInputField(component) ||
|
73
78
|
component.type === ComponentType.YesNoField
|
74
79
|
) {
|
75
|
-
questionElements = new QuestionComponentElements(component)
|
80
|
+
questionElements = new QuestionComponentElements(component, !hasTitle)
|
76
81
|
} else if (hasContentField(component)) {
|
77
|
-
questionElements = new ContentElements(component)
|
82
|
+
questionElements = new ContentElements(component, !hasTitle)
|
78
83
|
} else {
|
79
|
-
questionElements = new ComponentElements(component)
|
84
|
+
questionElements = new ComponentElements(component, !hasTitle)
|
80
85
|
}
|
81
86
|
|
82
87
|
const QuestionConstructor = InputFieldComponentDictionary[component.type]
|
@@ -61,9 +61,10 @@ export class ListComponentElements extends QuestionComponentElements {
|
|
61
61
|
/**
|
62
62
|
* @param {SelectionComponentsDef} component
|
63
63
|
* @param {List} list
|
64
|
+
* @param {boolean} largeTitle
|
64
65
|
*/
|
65
|
-
constructor(component, list) {
|
66
|
-
super(component)
|
66
|
+
constructor(component, list, largeTitle = true) {
|
67
|
+
super(component, largeTitle)
|
67
68
|
this._list = list
|
68
69
|
}
|
69
70
|
|
@@ -44,13 +44,18 @@ export class PreviewComponent {
|
|
44
44
|
* @protected
|
45
45
|
*/
|
46
46
|
_highlighted = false
|
47
|
+
/**
|
48
|
+
* @type {boolean}
|
49
|
+
* @protected
|
50
|
+
*/
|
51
|
+
_largeTitle = true
|
47
52
|
|
48
53
|
/**
|
49
54
|
* @param {QuestionElements} htmlElements
|
50
55
|
* @param {QuestionRenderer} questionRenderer
|
51
56
|
*/
|
52
57
|
constructor(htmlElements, questionRenderer) {
|
53
|
-
const { question, optional } = htmlElements.values
|
58
|
+
const { question, optional, largeTitle } = htmlElements.values
|
54
59
|
|
55
60
|
/**
|
56
61
|
* @type {QuestionElements}
|
@@ -73,6 +78,7 @@ export class PreviewComponent {
|
|
73
78
|
* @protected
|
74
79
|
*/
|
75
80
|
this._questionRenderer = questionRenderer
|
81
|
+
this._largeTitle = largeTitle
|
76
82
|
}
|
77
83
|
|
78
84
|
/**
|
@@ -94,9 +100,11 @@ export class PreviewComponent {
|
|
94
100
|
* @type {DefaultComponent}
|
95
101
|
*/
|
96
102
|
get label() {
|
103
|
+
const titleClass = this._largeTitle ? 'govuk-label--l' : 'govuk-label--m'
|
104
|
+
|
97
105
|
return {
|
98
106
|
text: this.titleText,
|
99
|
-
classes:
|
107
|
+
classes: titleClass + this.getHighlight('question')
|
100
108
|
}
|
101
109
|
}
|
102
110
|
|
@@ -105,10 +113,14 @@ export class PreviewComponent {
|
|
105
113
|
* @type {GovukFieldset}
|
106
114
|
*/
|
107
115
|
get fieldSet() {
|
116
|
+
const titleClass = this._largeTitle
|
117
|
+
? 'govuk-fieldset__legend--l'
|
118
|
+
: 'govuk-fieldset__legend--m'
|
119
|
+
|
108
120
|
return {
|
109
121
|
legend: {
|
110
122
|
text: this.titleText,
|
111
|
-
classes:
|
123
|
+
classes: titleClass + this.getHighlight('question')
|
112
124
|
}
|
113
125
|
}
|
114
126
|
}
|
@@ -14,8 +14,8 @@ export class QuestionComponentElements extends ComponentElements {
|
|
14
14
|
/**
|
15
15
|
* @param {FormComponentsDef} component
|
16
16
|
*/
|
17
|
-
constructor(component) {
|
18
|
-
super(component)
|
17
|
+
constructor(component, largeTitle = true) {
|
18
|
+
super(component, largeTitle)
|
19
19
|
this._component = component
|
20
20
|
}
|
21
21
|
|
@@ -16,6 +16,7 @@ import { type UkAddressQuestion } from '~/src/form/form-editor/preview/uk-addres
|
|
16
16
|
import { type ListElement } from '~/src/form/form-editor/types.js'
|
17
17
|
export { type QuestionBaseModel } from '~/src/form/form-editor/macros/types.js'
|
18
18
|
export interface BaseSettings {
|
19
|
+
largeTitle: boolean
|
19
20
|
question: string
|
20
21
|
hintText: string
|
21
22
|
optional: boolean
|