@defra/forms-model 3.0.484 → 3.0.486
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-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/module/utils/helpers.js +9 -0
- package/dist/module/utils/helpers.js.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/dist/types/utils/helpers.d.ts +6 -0
- package/dist/types/utils/helpers.d.ts.map +1 -1
- package/package.json +1 -1
- 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
- package/src/utils/helpers.ts +9 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/form/form-editor/preview/types.ts"],"sourcesContent":["import {\n type PagePreviewPanelMacro,\n type QuestionBaseModel\n} from '~/src/form/form-editor/macros/types.js'\nimport { type AutocompleteQuestion } from '~/src/form/form-editor/preview/autocomplete.js'\nimport { type DateInputQuestion } from '~/src/form/form-editor/preview/date-input.js'\nimport { type EmailAddressQuestion } from '~/src/form/form-editor/preview/email-address.js'\nimport { type ListSortableQuestion } from '~/src/form/form-editor/preview/list-sortable.js'\nimport { type LongAnswerQuestion } from '~/src/form/form-editor/preview/long-answer.js'\nimport { type PhoneNumberQuestion } from '~/src/form/form-editor/preview/phone-number.js'\nimport { type Question } from '~/src/form/form-editor/preview/question.js'\nimport { type RadioSortableQuestion } from '~/src/form/form-editor/preview/radio-sortable.js'\nimport { type SelectSortableQuestion } from '~/src/form/form-editor/preview/select-sortable.js'\nimport { type ShortAnswerQuestion } from '~/src/form/form-editor/preview/short-answer.js'\nimport { type UkAddressQuestion } from '~/src/form/form-editor/preview/uk-address.js'\nimport { type ListElement } from '~/src/form/form-editor/types.js'\nexport { type QuestionBaseModel } from '~/src/form/form-editor/macros/types.js'\nexport interface BaseSettings {\n question: string\n hintText: string\n optional: boolean\n shortDesc: string\n items: ListElement[]\n content: string\n}\n\nexport interface DefaultComponent {\n id?: string\n text: string\n classes: string\n}\n\nexport interface GovukFieldset {\n legend: DefaultComponent\n}\n\nexport type ListenerRow = [\n HTMLInputElement | null,\n (target: HTMLInputElement, e: Event) => void,\n keyof HTMLElementEventMap\n]\n\nexport interface QuestionElements {\n readonly values: BaseSettings\n setPreviewHTML(value: string): void\n setPreviewDOM(element: HTMLElement): void\n}\nexport interface AutocompleteElements extends QuestionElements {\n autocompleteOptions: string\n}\n\nexport interface RenderContext {\n model: QuestionBaseModel\n}\n\nexport interface HTMLBuilder {\n buildHTML(questionTemplate: string, renderContext: RenderContext): string\n}\n\nexport interface QuestionRenderer {\n render(questionTemplate: string, questionBaseModel: QuestionBaseModel): void\n}\n\nexport interface PageRenderer {\n render(pageTemplate: string, pagePreview: PagePreviewPanelMacro): void\n}\n\nexport interface ListElements extends QuestionElements {\n afterInputsHTML: string\n}\n\nexport interface PageOverviewElements {\n heading: string\n guidance: string\n}\n\nexport type PreviewQuestion =\n | DateInputQuestion\n | EmailAddressQuestion\n | ListSortableQuestion\n | LongAnswerQuestion\n | PhoneNumberQuestion\n | Question\n | RadioSortableQuestion\n | SelectSortableQuestion\n | ShortAnswerQuestion\n | UkAddressQuestion\n | AutocompleteQuestion\n"],"mappings":"","ignoreList":[]}
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/form/form-editor/preview/types.ts"],"sourcesContent":["import {\n type PagePreviewPanelMacro,\n type QuestionBaseModel\n} from '~/src/form/form-editor/macros/types.js'\nimport { type AutocompleteQuestion } from '~/src/form/form-editor/preview/autocomplete.js'\nimport { type DateInputQuestion } from '~/src/form/form-editor/preview/date-input.js'\nimport { type EmailAddressQuestion } from '~/src/form/form-editor/preview/email-address.js'\nimport { type ListSortableQuestion } from '~/src/form/form-editor/preview/list-sortable.js'\nimport { type LongAnswerQuestion } from '~/src/form/form-editor/preview/long-answer.js'\nimport { type PhoneNumberQuestion } from '~/src/form/form-editor/preview/phone-number.js'\nimport { type Question } from '~/src/form/form-editor/preview/question.js'\nimport { type RadioSortableQuestion } from '~/src/form/form-editor/preview/radio-sortable.js'\nimport { type SelectSortableQuestion } from '~/src/form/form-editor/preview/select-sortable.js'\nimport { type ShortAnswerQuestion } from '~/src/form/form-editor/preview/short-answer.js'\nimport { type UkAddressQuestion } from '~/src/form/form-editor/preview/uk-address.js'\nimport { type ListElement } from '~/src/form/form-editor/types.js'\nexport { type QuestionBaseModel } from '~/src/form/form-editor/macros/types.js'\nexport interface BaseSettings {\n largeTitle: boolean\n question: string\n hintText: string\n optional: boolean\n shortDesc: string\n items: ListElement[]\n content: string\n}\n\nexport interface DefaultComponent {\n id?: string\n text: string\n classes: string\n}\n\nexport interface GovukFieldset {\n legend: DefaultComponent\n}\n\nexport type ListenerRow = [\n HTMLInputElement | null,\n (target: HTMLInputElement, e: Event) => void,\n keyof HTMLElementEventMap\n]\n\nexport interface QuestionElements {\n readonly values: BaseSettings\n setPreviewHTML(value: string): void\n setPreviewDOM(element: HTMLElement): void\n}\nexport interface AutocompleteElements extends QuestionElements {\n autocompleteOptions: string\n}\n\nexport interface RenderContext {\n model: QuestionBaseModel\n}\n\nexport interface HTMLBuilder {\n buildHTML(questionTemplate: string, renderContext: RenderContext): string\n}\n\nexport interface QuestionRenderer {\n render(questionTemplate: string, questionBaseModel: QuestionBaseModel): void\n}\n\nexport interface PageRenderer {\n render(pageTemplate: string, pagePreview: PagePreviewPanelMacro): void\n}\n\nexport interface ListElements extends QuestionElements {\n afterInputsHTML: string\n}\n\nexport interface PageOverviewElements {\n heading: string\n guidance: string\n}\n\nexport type PreviewQuestion =\n | DateInputQuestion\n | EmailAddressQuestion\n | ListSortableQuestion\n | LongAnswerQuestion\n | PhoneNumberQuestion\n | Question\n | RadioSortableQuestion\n | SelectSortableQuestion\n | ShortAnswerQuestion\n | UkAddressQuestion\n | AutocompleteQuestion\n"],"mappings":"","ignoreList":[]}
|
@@ -13,4 +13,13 @@ export function slugify(input = '', options) {
|
|
13
13
|
...options
|
14
14
|
});
|
15
15
|
}
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Safely extracts error message from unknown error types
|
19
|
+
* @param {unknown} error - The error to extract message from
|
20
|
+
* @returns {string} The error message
|
21
|
+
*/
|
22
|
+
export function getErrorMessage(error) {
|
23
|
+
return error instanceof Error ? error.message : String(error);
|
24
|
+
}
|
16
25
|
//# sourceMappingURL=helpers.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.js","names":["slug","slugify","input","options","string","trimStart","replace","fallback","lower","trim"],"sources":["../../../src/utils/helpers.ts"],"sourcesContent":["import slug from 'slug'\n\n/**\n * Replace whitespace, en-dashes and em-dashes with spaces\n * before running through the slug package\n */\nexport function slugify(input = '', options?: slug.Options) {\n const string = input.trimStart().replace(/[\\s–—]/g, ' ')\n\n return slug(string, {\n fallback: false,\n lower: true,\n trim: true,\n ...options\n })\n}\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA;AACA,OAAO,SAASC,OAAOA,CAACC,KAAK,GAAG,EAAE,EAAEC,OAAsB,EAAE;EAC1D,MAAMC,MAAM,GAAGF,KAAK,CAACG,SAAS,CAAC,CAAC,CAACC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;EAExD,OAAON,IAAI,CAACI,MAAM,EAAE;IAClBG,QAAQ,EAAE,KAAK;IACfC,KAAK,EAAE,IAAI;IACXC,IAAI,EAAE,IAAI;IACV,GAAGN;EACL,CAAC,CAAC;AACJ","ignoreList":[]}
|
1
|
+
{"version":3,"file":"helpers.js","names":["slug","slugify","input","options","string","trimStart","replace","fallback","lower","trim","getErrorMessage","error","Error","message","String"],"sources":["../../../src/utils/helpers.ts"],"sourcesContent":["import slug from 'slug'\n\n/**\n * Replace whitespace, en-dashes and em-dashes with spaces\n * before running through the slug package\n */\nexport function slugify(input = '', options?: slug.Options) {\n const string = input.trimStart().replace(/[\\s–—]/g, ' ')\n\n return slug(string, {\n fallback: false,\n lower: true,\n trim: true,\n ...options\n })\n}\n\n/**\n * Safely extracts error message from unknown error types\n * @param {unknown} error - The error to extract message from\n * @returns {string} The error message\n */\nexport function getErrorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error)\n}\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA;AACA,OAAO,SAASC,OAAOA,CAACC,KAAK,GAAG,EAAE,EAAEC,OAAsB,EAAE;EAC1D,MAAMC,MAAM,GAAGF,KAAK,CAACG,SAAS,CAAC,CAAC,CAACC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;EAExD,OAAON,IAAI,CAACI,MAAM,EAAE;IAClBG,QAAQ,EAAE,KAAK;IACfC,KAAK,EAAE,IAAI;IACXC,IAAI,EAAE,IAAI;IACV,GAAGN;EACL,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASO,eAAeA,CAACC,KAAc,EAAU;EACtD,OAAOA,KAAK,YAAYC,KAAK,GAAGD,KAAK,CAACE,OAAO,GAAGC,MAAM,CAACH,KAAK,CAAC;AAC/D","ignoreList":[]}
|
@@ -59,7 +59,7 @@ export class QuestionPreviewElements implements ListElements {
|
|
59
59
|
/**
|
60
60
|
* @param {BaseSettings} baseSettings
|
61
61
|
*/
|
62
|
-
constructor({ question, hintText, optional, shortDesc, items, content }: BaseSettings);
|
62
|
+
constructor({ question, hintText, optional, shortDesc, items, content, largeTitle }: BaseSettings);
|
63
63
|
/**
|
64
64
|
* @protected
|
65
65
|
*/
|
@@ -84,6 +84,7 @@ export class QuestionPreviewElements implements ListElements {
|
|
84
84
|
* @private
|
85
85
|
*/
|
86
86
|
private _items;
|
87
|
+
_largeTitle: boolean;
|
87
88
|
afterInputsHTML: string;
|
88
89
|
/**
|
89
90
|
* @returns {BaseSettings}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/__stubs__/preview.js"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/__stubs__/preview.js"],"names":[],"mappings":"AA2OA;;;;GAIG;AACH,6DAJW,OAAO,CAAC,YAAY,CAAC,cACrB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,GAC1C,QAAQ,CAUpB;AAtPD;;GAEG;AACH;IAqBE;;;;OAIG;IACH,oCAHW,MAAM,kBACN,aAAa,GAFX,MAAM,CAMlB;IAtBD;;OAEG;IACH,wBAFW,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,EAItD;IAVD;;OAEG;IACH,YAFU,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAE5C;IASV;;;OAGG;IACH,yBAHW,MAAM,qBACN,iBAAiB,QAI3B;CAUF;AAED;;GAEG;AACH;IAqBE;;;;OAIG;IACH,oCAHW,MAAM,kBACN,aAAa,GAFX,MAAM,CAMlB;IAtBD;;OAEG;IACH,wBAFW,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,EAI1D;IAVD;;OAEG;IACH,YAFU,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAEhD;IASV;;;OAGG;IACH,qBAHW,MAAM,yBACN,qBAAqB,QAI/B;CAUF;AAED;;GAEG;AACH;IA4BE;;OAEG;IACH,qFAFW,YAAY,EAkBtB;IA9CD;;OAEG;IACH,4BAAc;IACd,iBAAiB;IACjB,4BAAc;IACd,iBAAiB;IACjB,6BAAiB;IACjB;;;OAGG;IACH,sBAHU,MAAM,CAGD;IACf;;;OAGG;IACH,oBAHU,MAAM,CAGH;IACb;;;;OAIG;IACH,eAAW;IACX,qBAAkB;IAClB,wBAA2E;IAuB3E;;OAEG;IACH,cAFa,YAAY,CAYxB;IAED;;OAEG;IACH,uBAFW,MAAM,QAIhB;IAED;;OAEG;IACH,sBAFW,WAAW,QAIrB;CACF;AAED;;GAEG;AACH;IACE;;OAEG;IACH,kDAFW,YAAY,GAAG;QAAC,mBAAmB,EAAE,MAAM,CAAA;KAAC,EAKtD;IADC,4BAA8C;CAEjD;AAED;;GAEG;AACH;IAIE;;;OAGG;IACH,qBAHW,MAAM,aACN,MAAM,EAKhB;IAVD,iBAAQ;IACR,gBAAO;CAUR;AAED,2BAAuC,YAAY,CAQjD;;;;;;;;kCA+D8K,yCAAyC;uCAAzC,yCAAyC;yBA7PhM,4CAA4C;sCA6P2G,yCAAyC;mCAAzC,yCAAyC;kCAAzC,yCAAyC;2CAD/K,wCAAwC;kCAC8F,yCAAyC;0CAAzC,yCAAyC;0CAAzC,yCAAyC;AA7DzN,uBAAgB,sCAAsC,CAAA;AACtD,uBAAgB,sCAAsC,CAAA;AACtD,uBAAgB,sCAAsC,CAAA;AACtD,uBAAgB,sCAAsC,CAAA;AAEtD,gCAAoC,YAAY,CA4B9C"}
|
@@ -4,13 +4,19 @@
|
|
4
4
|
export class ComponentElements implements QuestionElements {
|
5
5
|
/**
|
6
6
|
* @param {ComponentDef} component
|
7
|
+
* @param {boolean} [largeTitle]
|
7
8
|
*/
|
8
|
-
constructor(component: ComponentDef);
|
9
|
+
constructor(component: ComponentDef, largeTitle?: boolean);
|
9
10
|
/**
|
10
11
|
* @type {ComponentDef}
|
11
12
|
* @protected
|
12
13
|
*/
|
13
14
|
protected _component: ComponentDef;
|
15
|
+
/**
|
16
|
+
* @type {boolean}
|
17
|
+
* @private
|
18
|
+
*/
|
19
|
+
private _largeTitle;
|
14
20
|
/**
|
15
21
|
* @protected
|
16
22
|
* @returns {BaseSettings}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"component-elements.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/component-elements.js"],"names":[],"mappings":"AAAA;;GAEG;AACH;
|
1
|
+
{"version":3,"file":"component-elements.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/component-elements.js"],"names":[],"mappings":"AAAA;;GAEG;AACH;IAWE;;;OAGG;IACH,uBAHW,YAAY,eACZ,OAAO,EAKjB;IAjBD;;;OAGG;IACH,sBAHU,YAAY,CAGZ;IACV;;;OAGG;IACH,oBAAkB;IAUlB;;;OAGG;IACH,wBAFa,YAAY,CAcxB;IAED;;OAEG;IACH,cAFa,YAAY,CAKxB;IAED;;OAEG;IACH,wBAFW,WAAW,QAIrB;IAED;;OAEG;IACH,uBAFW,MAAM,QAIhB;CACF;sCAGqI,yCAAyC;kCACrG,2BAA2B;kCADiC,yCAAyC"}
|
@@ -4,8 +4,9 @@
|
|
4
4
|
export class ContentElements extends ComponentElements implements QuestionElements {
|
5
5
|
/**
|
6
6
|
* @param {Exclude<ContentComponentsDef, ListComponent>} component
|
7
|
+
* @param {boolean} largeTitle
|
7
8
|
*/
|
8
|
-
constructor(component: Exclude<ContentComponentsDef, ListComponent
|
9
|
+
constructor(component: Exclude<ContentComponentsDef, ListComponent>, largeTitle?: boolean);
|
9
10
|
/**
|
10
11
|
* @type {Exclude<ContentComponentsDef, ListComponent>}
|
11
12
|
* @protected
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/content.js"],"names":[],"mappings":"AAGA;;GAEG;AACH;IAME
|
1
|
+
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/content.js"],"names":[],"mappings":"AAGA;;GAEG;AACH;IAME;;;OAGG;IACH,uBAHW,OAAO,CAAC,oBAAoB,EAAE,aAAa,CAAC,eAC5C,OAAO,EAKjB;IAZD;;;OAGG;IACH,sBAHU,OAAO,CAAC,oBAAoB,EAAE,aAAa,CAAC,CAG5C;CAoBX;AAED;;;;;GAKG;AACH;IACE;;;OAGG;IACH,oBAHU,MAAM,CAGR;IAwBR;;;OAGG;IACH,6BAHW,MAAM,QAKhB;IASD,mBANa,MAAM,EASlB;IAVD;;OAEG;IACH,eAFa,MAAM,CAIlB;CAMF;sCAGqI,yCAAyC;kCA1F7I,sDAAsD;0CA2FC,2BAA2B;mCAA3B,2BAA2B;iCA1FnF,2CAA2C"}
|
@@ -70,11 +70,6 @@ export class PreviewPageController implements PagePreviewPanelMacro {
|
|
70
70
|
* @protected
|
71
71
|
*/
|
72
72
|
protected _guidanceComponent: Markdown;
|
73
|
-
/**
|
74
|
-
* @type {boolean}
|
75
|
-
* @private
|
76
|
-
*/
|
77
|
-
private _showGuidance;
|
78
73
|
/**
|
79
74
|
* @returns {Markdown[]}
|
80
75
|
* @private
|
@@ -90,11 +85,6 @@ export class PreviewPageController implements PagePreviewPanelMacro {
|
|
90
85
|
text: string;
|
91
86
|
classes: string;
|
92
87
|
};
|
93
|
-
/**
|
94
|
-
* @private
|
95
|
-
* @returns {string}
|
96
|
-
*/
|
97
|
-
private _fallBackTitle;
|
98
88
|
/**
|
99
89
|
* @returns {{ text: string, classes: string }}
|
100
90
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"page-controller.d.ts","sourceRoot":"","sources":["../../../../../../src/form/form-editor/preview/controller/page-controller.js"],"names":[],"mappings":"AAmBA;;GAEG;AACH;IAME;;OAEG;IACH,kBAFW,IAAI,EAId;IAVD;;;OAGG;IACH,cAAK;IAQL,sBAEC;IAED,uBAUC;CACF;AAED;;GAEG;AACH;IACE,oBAAoC;
|
1
|
+
{"version":3,"file":"page-controller.d.ts","sourceRoot":"","sources":["../../../../../../src/form/form-editor/preview/controller/page-controller.js"],"names":[],"mappings":"AAmBA;;GAEG;AACH;IAME;;OAEG;IACH,kBAFW,IAAI,EAId;IAVD;;;OAGG;IACH,cAAK;IAQL,sBAEC;IAED,uBAUC;CACF;AAED;;GAEG;AACH;IACE,oBAAoC;IA8JpC;;;;OAIG;IACH,kCAFa,QAAQ,CAepB;IAED;;;;;OAKG;IACH,4CAKC;IApJD;;;;;OAKG;IACH,wBALW,YAAY,EAAE,YACd,oBAAoB,cACpB,cAAc,YACd,YAAY,EAqBtB;IAjED;;;OAGG;IACH,yBAHU,MAAM,CAGkD;IAClE;;;OAGG;IACH,uBAFU,QAAQ,EAAE,CAEJ;IAUhB;;;OAGG;IACH,wBAHW,SAAS,GAAG,OAAO,GAAG,UAAU,CAGnB;IACxB;;;OAGG;IACH,sBAAkB;IAClB;;;OAGG;IACH,uBAAgE;IAChE;;;;OAIG;IACH,8BAHU,QAAQ,CAGA;IAuClB;;;OAGG;IACH,kCAQC;IAED;;OAEG;IACH,kBAFa,oBAAoB,EAAE,CAYlC;IAED,+BAIC;IAED,2BAEC;IAED;;;MAKC;IAED;;OAEG;IACH,iBAFa;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAO7C;IAED,eAEC;IASD;;OAEG;IACH,iBAFW,MAAM,EAKhB;IAbD;;OAEG;IACH,aAFa,MAAM,CAIlB;IAUD,uBAEC;IAmCD,0BAGC;IAED;;OAEG;IACH,iCAFW,OAAO,GAAC,UAAU,QAK5B;IAED,uBAKC;;CACF;0CAG2F,yCAAyC;0BAE5F,qCAAqC;2CAEd,wCAAwC;8BAH3E,4CAA4C;yBA1QhD,4CAA4C;0CA6QL,wCAAwC;kCADpD,2BAA2B;oCADtC,qCAAqC;kCAFc,yCAAyC"}
|
@@ -1,9 +1,10 @@
|
|
1
1
|
/**
|
2
2
|
* @param {QuestionRenderer} questionRenderer
|
3
3
|
* @param {FormDefinition} definition
|
4
|
+
* @param {boolean} hasTitle
|
4
5
|
* @returns {(component: ComponentDef) => Question}
|
5
6
|
*/
|
6
|
-
export function mapComponentToPreviewQuestion(questionRenderer: QuestionRenderer, definition: FormDefinition): (component: ComponentDef) => Question;
|
7
|
+
export function mapComponentToPreviewQuestion(questionRenderer: QuestionRenderer, definition: FormDefinition, hasTitle: boolean): (component: ComponentDef) => Question;
|
7
8
|
import type { QuestionRenderer } from '../../../form/form-editor/preview/types.js';
|
8
9
|
import type { FormDefinition } from '../../../form/form-definition/types.js';
|
9
10
|
import type { ComponentDef } from '../../../components/types.js';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/helpers.js"],"names":[],"mappings":"AAsDA
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/helpers.js"],"names":[],"mappings":"AAsDA;;;;;GAKG;AACH,gEALW,gBAAgB,cAChB,cAAc,YACd,OAAO,GACL,CAAC,SAAS,EAAE,YAAY,KAAK,QAAQ,CAiCjD;sCAGsD,yCAAyC;oCAGvD,qCAAqC;kCAC1B,2BAA2B;8BAHlD,4CAA4C"}
|
@@ -21,8 +21,9 @@ export class ListComponentElements extends QuestionComponentElements implements
|
|
21
21
|
/**
|
22
22
|
* @param {SelectionComponentsDef} component
|
23
23
|
* @param {List} list
|
24
|
+
* @param {boolean} largeTitle
|
24
25
|
*/
|
25
|
-
constructor(component: SelectionComponentsDef, list: List);
|
26
|
+
constructor(component: SelectionComponentsDef, list: List, largeTitle?: boolean);
|
26
27
|
/**
|
27
28
|
* @type {List}
|
28
29
|
* @protected
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/list.js"],"names":[],"mappings":"AAeA;;;GAGG;AACH,4CAHW,WAAW,GACT,CAAC,MAAM,EAAE,WAAW,CAAC,CAIjC;AAED;;;;GAIG;AACH,gDAHY,WAAW,EAAE,GAAE,SAAS,GACvB,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAKpC;AAED;;;GAGG;AACH,4CAHW,IAAI,GACF,WAAW,CAavB;AAED;;GAEG;AACH;IAOE
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/list.js"],"names":[],"mappings":"AAeA;;;GAGG;AACH,4CAHW,WAAW,GACT,CAAC,MAAM,EAAE,WAAW,CAAC,CAIjC;AAED;;;;GAIG;AACH,gDAHY,WAAW,EAAE,GAAE,SAAS,GACvB,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAKpC;AAED;;;GAGG;AACH,4CAHW,IAAI,GACF,WAAW,CAavB;AAED;;GAEG;AACH;IAOE;;;;OAIG;IACH,uBAJW,sBAAsB,QACtB,IAAI,eACJ,OAAO,EAKjB;IAdD;;;OAGG;IACH,iBAHU,IAAI,CAGT;CAsBN;AAED;IAqBE;;;OAGG;IACH,0BAHW,YAAY,oBACZ,gBAAgB,EAQ1B;IArBD,2BAA2B;IAC3B,eADW,YAAY,CACV;IACb,qBAAqC;IACrC,uBAA4C;IAE5C;;;OAGG;IACH,iBAHU,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAG7B;IAcL;;;;;;;;;OASG;IACH,mBATa;QACT,SAAS,CAAC,EAAE;YAAC,WAAW,EAAE;gBAAC,IAAI,EAAE,MAAM,CAAA;aAAC,CAAA;SAAC,CAAC;QAC1C,IAAI,EAAE,gBAAgB,CAAC;QACvB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,aAAa,CAAC;QACzB,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,gBAAgB,EAAE,CAAA;KACzB,CAwBH;IAED;;;OAGG;IACH,kBAFW,WAAW,QAKrB;IAED;;OAEG;IACH,YAFW,MAAM,QAKhB;IAED;;;OAGG;IACH,qCAHW,WAAW,EAAE,GACX,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAKpC;IAED;;OAEG;IACH,YAFa,gBAAgB,EAAE,CAiC9B;IAED;;;;OAIG;IACH,eAHW,MAAM,GAAG,SAAS,QAClB,MAAM,QAYhB;IAED;;;;OAIG;IACH,eAHW,MAAM,GAAG,SAAS,QAClB,MAAM,QAehB;IAED;;;OAGG;IACH,gBAHW,MAAM,GAAG,SAAS,SAClB,MAAM,QAYhB;CACF;iCAGiD,iCAAiC;0BAEpD,qCAAqC;sCACgD,yCAAyC;0CAxQtJ,4CAA4C;0BAuQpB,qCAAqC;4CADN,2BAA2B;yBAtQlF,4CAA4C;kCAwQiE,yCAAyC;sCAAzC,yCAAyC;mCAAzC,yCAAyC;sCAH3G,iCAAiC;sCAGiC,yCAAyC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/preview.js"],"names":[],"mappings":"AAGA;;GAEG;AACH;IACE,oBAAmC;
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/preview.js"],"names":[],"mappings":"AAGA;;GAEG;AACH;IACE,oBAAmC;IA6CnC;;;OAGG;IACH,0BAHW,gBAAgB,oBAChB,gBAAgB,EA2B1B;IAzED;;;OAGG;IACH,eAFU,aAAa,CAEc;IACrC;;;;OAIG;IACH,6BAHU,MAAM,CAGM;IACtB;;;OAGG;IACH,sBAHW,MAAM,GAAC,IAAI,CAGL;IACjB;;;;OAIG;IACH,sBAHU,MAAM,CAGD;IACf;;;OAGG;IACH,6BAHU,gBAAgB,CAGT;IAEjB;;;OAGG;IACH,yBAHU,gBAAgB,CAGb;IACb;;;OAGG;IACH,wBAHU,OAAO,CAGG;IACpB;;;OAGG;IACH,uBAHU,OAAO,CAGC;IAchB;;;OAGG;IACH,kBAAyB;IACzB;;;OAGG;IACH,kBAAyB;IAU3B;;;;OAIG;IACH,gCAJW,MAAM,GACJ,MAAM,CAKlB;IAED,wBAGC;IAED;;;OAGG;IACH,uBAFU,gBAAgB,CASzB;IAED;;;OAGG;IACH,0BAFU,aAAa,CAatB;IAED;;OAEG;IACH,0BAFa,OAAO,CAAC,iBAAiB,CAAC,CAItC;IAED;;;;OAIG;IACH,0BAHa,iBAAiB,CAS7B;IAED;;OAEG;IACH,mBAFU,iBAAiB,CAO1B;IAED,eAEC;IASD;;OAEG;IACH,oBAFW,MAAM,EAKhB;IAbD;;OAEG;IACH,gBAFU,MAAM,CAIf;IAcD;;OAEG;IACH,oBAFW,OAAO,EAKjB;IAVD,gBAKW,OAAO,CAHjB;IAiBD;;OAEG;IACH,qBAFW,MAAM,GAAG,IAAI,EAKvB;IAbD;;OAEG;IACH,iBAFU,MAAM,GAAG,IAAI,CAItB;IAUD;;OAEG;IACH,yBAEC;IAED;;OAEG;IACH,2BAEC;CACF;8BAxN6B,2BAA2B;sCA2N6E,yCAAyC;sCAAzC,yCAAyC;sCAAzC,yCAAyC;mCAAzC,yCAAyC;uCAAzC,yCAAyC"}
|
@@ -5,7 +5,7 @@ export class QuestionComponentElements extends ComponentElements implements Ques
|
|
5
5
|
/**
|
6
6
|
* @param {FormComponentsDef} component
|
7
7
|
*/
|
8
|
-
constructor(component: FormComponentsDef);
|
8
|
+
constructor(component: FormComponentsDef, largeTitle?: boolean);
|
9
9
|
/**
|
10
10
|
* @type {FormComponentsDef}
|
11
11
|
* @protected
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/question.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;IAME;;OAEG;IACH,uBAFW,iBAAiB,
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/question.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;IAME;;OAEG;IACH,uBAFW,iBAAiB,wBAK3B;IAXD;;;OAGG;IACH,sBAHU,iBAAiB,CAGjB;CAoBX;AAED;;;;;;;;;GASG;AACH;IAwBI;;;OAGG;IACH,kBAAyB;IAG3B;;;OAGG;IACH,sBAHU,gBAAgB,CAazB;IAiBD;;OAEG;IACH,oBAFW,MAAM,EAKhB;IAbD;;OAEG;IACH,gBAFU,MAAM,CAIf;CASF;sCAGqI,yCAAyC;kCAnH7I,sDAAsD;uCAoHd,2BAA2B;iCAnHpE,2CAA2C;sCAkH0D,yCAAyC"}
|
@@ -13,6 +13,7 @@ import { type UkAddressQuestion } from '../../../form/form-editor/preview/uk-add
|
|
13
13
|
import { type ListElement } from '../../../form/form-editor/types.js';
|
14
14
|
export { type QuestionBaseModel } from '../../../form/form-editor/macros/types.js';
|
15
15
|
export interface BaseSettings {
|
16
|
+
largeTitle: boolean;
|
16
17
|
question: string;
|
17
18
|
hintText: string;
|
18
19
|
optional: boolean;
|
@@ -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,4CAA4C,CAAA;AAC1E,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,kDAAkD,CAAA;AAC7F,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,mDAAmD,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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"}
|
@@ -4,4 +4,10 @@ import slug from 'slug';
|
|
4
4
|
* before running through the slug package
|
5
5
|
*/
|
6
6
|
export declare function slugify(input?: string, options?: slug.Options): string;
|
7
|
+
/**
|
8
|
+
* Safely extracts error message from unknown error types
|
9
|
+
* @param {unknown} error - The error to extract message from
|
10
|
+
* @returns {string} The error message
|
11
|
+
*/
|
12
|
+
export declare function getErrorMessage(error: unknown): string;
|
7
13
|
//# sourceMappingURL=helpers.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AAEvB;;;GAGG;AACH,wBAAgB,OAAO,CAAC,KAAK,SAAK,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,UASzD"}
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AAEvB;;;GAGG;AACH,wBAAgB,OAAO,CAAC,KAAK,SAAK,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,UASzD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEtD"}
|
package/package.json
CHANGED
@@ -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
|
package/src/utils/helpers.ts
CHANGED
@@ -14,3 +14,12 @@ export function slugify(input = '', options?: slug.Options) {
|
|
14
14
|
...options
|
15
15
|
})
|
16
16
|
}
|
17
|
+
|
18
|
+
/**
|
19
|
+
* Safely extracts error message from unknown error types
|
20
|
+
* @param {unknown} error - The error to extract message from
|
21
|
+
* @returns {string} The error message
|
22
|
+
*/
|
23
|
+
export function getErrorMessage(error: unknown): string {
|
24
|
+
return error instanceof Error ? error.message : String(error)
|
25
|
+
}
|