@defra/forms-model 3.0.491 → 3.0.493
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 +6 -7
- package/dist/module/form/form-editor/__stubs__/preview.js.map +1 -1
- package/dist/module/form/form-editor/macros/types.js.map +1 -1
- package/dist/module/form/form-editor/preview/autocomplete.js +3 -0
- package/dist/module/form/form-editor/preview/autocomplete.js.map +1 -1
- package/dist/module/form/form-editor/preview/component-elements.js +2 -10
- package/dist/module/form/form-editor/preview/component-elements.js.map +1 -1
- package/dist/module/form/form-editor/preview/content.js +2 -3
- package/dist/module/form/form-editor/preview/content.js.map +1 -1
- package/dist/module/form/form-editor/preview/controller/page-controller.js +91 -6
- package/dist/module/form/form-editor/preview/controller/page-controller.js.map +1 -1
- package/dist/module/form/form-editor/preview/helpers.js +10 -8
- package/dist/module/form/form-editor/preview/helpers.js.map +1 -1
- package/dist/module/form/form-editor/preview/list.js +60 -8
- package/dist/module/form/form-editor/preview/list.js.map +1 -1
- package/dist/module/form/form-editor/preview/preview.js +3 -8
- 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/select-sortable.js +5 -1
- package/dist/module/form/form-editor/preview/select-sortable.js.map +1 -1
- package/dist/module/form/form-editor/preview/select.js +32 -0
- package/dist/module/form/form-editor/preview/select.js.map +1 -1
- package/dist/module/form/form-editor/preview/types.js.map +1 -1
- package/dist/module/stubs.js +3 -0
- package/dist/module/stubs.js.map +1 -1
- package/dist/types/form/form-editor/__stubs__/preview.d.ts +4 -3
- package/dist/types/form/form-editor/__stubs__/preview.d.ts.map +1 -1
- package/dist/types/form/form-editor/macros/types.d.ts +13 -5
- package/dist/types/form/form-editor/macros/types.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/autocomplete.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/component-elements.d.ts +1 -7
- package/dist/types/form/form-editor/preview/component-elements.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/content.d.ts +1 -2
- 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 +27 -0
- package/dist/types/form/form-editor/preview/controller/page-controller.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/fieldset-question.d.ts +2 -5
- package/dist/types/form/form-editor/preview/fieldset-question.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/helpers.d.ts +1 -2
- package/dist/types/form/form-editor/preview/helpers.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/list.d.ts +33 -8
- package/dist/types/form/form-editor/preview/list.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/preview.d.ts +4 -5
- 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/select-sortable.d.ts +1 -1
- package/dist/types/form/form-editor/preview/select-sortable.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/select.d.ts +14 -0
- package/dist/types/form/form-editor/preview/select.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/types.d.ts +17 -4
- package/dist/types/form/form-editor/preview/types.d.ts.map +1 -1
- package/dist/types/stubs.d.ts +3 -0
- package/dist/types/stubs.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/form/form-editor/__stubs__/preview.js +6 -14
- package/src/form/form-editor/macros/types.ts +12 -1
- package/src/form/form-editor/preview/autocomplete.js +1 -0
- package/src/form/form-editor/preview/component-elements.js +2 -10
- package/src/form/form-editor/preview/content.js +2 -3
- package/src/form/form-editor/preview/controller/page-controller.js +109 -10
- package/src/form/form-editor/preview/helpers.js +16 -12
- package/src/form/form-editor/preview/list.js +73 -17
- package/src/form/form-editor/preview/preview.js +3 -11
- package/src/form/form-editor/preview/question.js +2 -2
- package/src/form/form-editor/preview/select-sortable.js +5 -1
- package/src/form/form-editor/preview/select.js +38 -0
- package/src/form/form-editor/preview/types.ts +23 -4
- package/src/stubs.ts +3 -0
@@ -13,6 +13,7 @@ export class PagePreviewElements implements PageOverviewElements {
|
|
13
13
|
private _page;
|
14
14
|
get heading(): string;
|
15
15
|
get guidance(): string;
|
16
|
+
get addHeading(): boolean;
|
16
17
|
}
|
17
18
|
/**
|
18
19
|
* @implements {PagePreviewPanelMacro}
|
@@ -70,6 +71,11 @@ export class PreviewPageController implements PagePreviewPanelMacro {
|
|
70
71
|
* @protected
|
71
72
|
*/
|
72
73
|
protected _guidanceComponent: Markdown;
|
74
|
+
/**
|
75
|
+
* @type {boolean}
|
76
|
+
* @private
|
77
|
+
*/
|
78
|
+
private _showTitle;
|
73
79
|
/**
|
74
80
|
* @returns {Markdown[]}
|
75
81
|
* @private
|
@@ -79,8 +85,23 @@ export class PreviewPageController implements PagePreviewPanelMacro {
|
|
79
85
|
* @returns {PagePreviewComponent[]}
|
80
86
|
*/
|
81
87
|
get components(): PagePreviewComponent[];
|
88
|
+
/**
|
89
|
+
* @returns {boolean}
|
90
|
+
*/
|
91
|
+
get showLargeTitle(): boolean;
|
92
|
+
/**
|
93
|
+
* @param {PreviewComponent} component
|
94
|
+
* @returns {QuestionBaseModel}
|
95
|
+
*/
|
96
|
+
_overrideComponentHeading(component: PreviewComponent): QuestionBaseModel;
|
82
97
|
set guidanceText(text: string);
|
83
98
|
get guidanceText(): string;
|
99
|
+
/**
|
100
|
+
*
|
101
|
+
* @param {boolean} showTitle
|
102
|
+
*/
|
103
|
+
set showTitle(showTitle: boolean);
|
104
|
+
get showTitle(): boolean;
|
84
105
|
get guidance(): {
|
85
106
|
text: string;
|
86
107
|
classes: string;
|
@@ -93,6 +114,10 @@ export class PreviewPageController implements PagePreviewPanelMacro {
|
|
93
114
|
classes: string;
|
94
115
|
};
|
95
116
|
render(): void;
|
117
|
+
/**
|
118
|
+
* @returns {boolean}
|
119
|
+
*/
|
120
|
+
get titleAndFirstTitleSame(): boolean;
|
96
121
|
/**
|
97
122
|
* @param {string} value
|
98
123
|
*/
|
@@ -116,6 +141,8 @@ import type { PagePreviewPanelMacro } from '../../../../form/form-editor/macros/
|
|
116
141
|
import type { Question } from '../../../../form/form-editor/preview/question.js';
|
117
142
|
import { Markdown } from '../../../../form/form-editor/preview/markdown.js';
|
118
143
|
import type { PagePreviewComponent } from '../../../../form/form-editor/macros/types.js';
|
144
|
+
import type { PreviewComponent } from '../../../../form/form-editor/preview/preview.js';
|
145
|
+
import type { QuestionBaseModel } from '../../../../form/form-editor/preview/types.js';
|
119
146
|
import type { ComponentDef } from '../../../../components/types.js';
|
120
147
|
import type { FormDefinition } from '../../../../form/form-definition/types.js';
|
121
148
|
import type { PageRenderer } from '../../../../form/form-editor/preview/types.js';
|
@@ -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;
|
1
|
+
{"version":3,"file":"page-controller.d.ts","sourceRoot":"","sources":["../../../../../../src/form/form-editor/preview/controller/page-controller.js"],"names":[],"mappings":"AAmBA;;GAEG;AACH;IAOE;;OAEG;IACH,kBAFW,IAAI,EAId;IAXD;;;OAGG;IACH,cAAK;IASL,sBAEC;IAED,uBAUC;IAED,0BAEC;CACF;AAED;;GAEG;AACH;IACE,oBAAoC;IA2PpC;;;;OAIG;IACH,kCAFa,QAAQ,CAepB;IAED;;;;;OAKG;IACH,4CAKC;IA5OD;;;;;OAKG;IACH,wBALW,YAAY,EAAE,YACd,oBAAoB,cACpB,cAAc,YACd,YAAY,EAkBtB;IAnED;;;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;IAClB;;;OAGG;IACH,mBAAiB;IAoCjB;;;OAGG;IACH,kCAQC;IAED;;OAEG;IACH,kBAFa,oBAAoB,EAAE,CAclC;IAED;;OAEG;IACH,sBAFa,OAAO,CAgBnB;IAED;;;OAGG;IACH,qCAHW,gBAAgB,GACd,iBAAiB,CAgC7B;IAED,+BAIC;IAED,2BAKC;IAED;;;OAGG;IACH,yBAFW,OAAO,EAKjB;IAED,iBAPW,OAAO,CASjB;IAED;;;MAKC;IAED;;OAEG;IACH,iBAFa;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAO7C;IAED,eAEC;IAED;;OAEG;IACH,8BAFa,OAAO,CASnB;IAeD;;OAEG;IACH,iBAFW,MAAM,EAKhB;IAnBD;;OAEG;IACH,aAFa,MAAM,CAUlB;IAUD,uBAEC;IAmCD,0BAGC;IAED;;OAEG;IACH,iCAFW,OAAO,GAAC,UAAU,QAK5B;IAED,uBAKC;;CACF;0CAG2F,yCAAyC;0BAG5F,qCAAqC;2CAEd,wCAAwC;8BAJ3E,4CAA4C;yBA5WhD,4CAA4C;0CAgXL,wCAAwC;sCAHnE,2CAA2C;uCAFY,yCAAyC;kCAIjF,2BAA2B;oCADtC,qCAAqC;kCAHc,yCAAyC"}
|
@@ -7,16 +7,13 @@ export class FieldsetQuestion extends Question {
|
|
7
7
|
id: string;
|
8
8
|
name: string;
|
9
9
|
content?: string | undefined;
|
10
|
+
attributes?: Record<string, string> | undefined;
|
10
11
|
label?: import("./types.js").DefaultComponent | undefined;
|
11
12
|
hint: import("./types.js").DefaultComponent;
|
12
13
|
fieldset: import("./types.js").GovukFieldset;
|
13
14
|
items?: import("../types.js").ListItemReadonly[] | import("../types.js").DateItem[];
|
14
15
|
text?: string | undefined;
|
15
|
-
formGroup?:
|
16
|
-
afterInputs: {
|
17
|
-
html: string;
|
18
|
-
};
|
19
|
-
} | undefined;
|
16
|
+
formGroup?: import("../macros/types.js").FormGroupAfterInput | undefined;
|
20
17
|
type?: "text" | "number" | "boolean" | undefined;
|
21
18
|
classes?: string | undefined;
|
22
19
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fieldset-question.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/fieldset-question.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH;IAME
|
1
|
+
{"version":3,"file":"fieldset-question.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/fieldset-question.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH;IAME;;;;;;;;;;;;;MAQC;CACF;yBArBwB,4CAA4C"}
|
@@ -1,10 +1,9 @@
|
|
1
1
|
/**
|
2
2
|
* @param {QuestionRenderer} questionRenderer
|
3
3
|
* @param {FormDefinition} definition
|
4
|
-
* @param {boolean} hasTitle
|
5
4
|
* @returns {(component: ComponentDef) => Question}
|
6
5
|
*/
|
7
|
-
export function mapComponentToPreviewQuestion(questionRenderer: QuestionRenderer, definition: FormDefinition
|
6
|
+
export function mapComponentToPreviewQuestion(questionRenderer: QuestionRenderer, definition: FormDefinition): (component: ComponentDef) => Question;
|
8
7
|
import type { QuestionRenderer } from '../../../form/form-editor/preview/types.js';
|
9
8
|
import type { FormDefinition } from '../../../form/form-definition/types.js';
|
10
9
|
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":"
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/helpers.js"],"names":[],"mappings":"AAyDA;;;;GAIG;AACH,gEAJW,gBAAgB,cAChB,cAAc,GACZ,CAAC,SAAS,EAAE,YAAY,KAAK,QAAQ,CAmCjD;sCAGsD,yCAAyC;oCAGvD,qCAAqC;kCAC1B,2BAA2B;8BAHlD,4CAA4C"}
|
@@ -21,15 +21,19 @@ export class ListComponentElements extends QuestionComponentElements implements
|
|
21
21
|
/**
|
22
22
|
* @param {SelectionComponentsDef} component
|
23
23
|
* @param {List} list
|
24
|
-
* @param {boolean} largeTitle
|
25
24
|
*/
|
26
|
-
constructor(component: SelectionComponentsDef, list: List
|
25
|
+
constructor(component: SelectionComponentsDef, list: List);
|
27
26
|
/**
|
28
27
|
* @type {List}
|
29
28
|
* @protected
|
30
29
|
*/
|
31
30
|
protected _list: List;
|
32
31
|
}
|
32
|
+
/**
|
33
|
+
* @implements {QuestionElements}
|
34
|
+
*/
|
35
|
+
export class SelectComponentElements extends ListComponentElements implements QuestionElements {
|
36
|
+
}
|
33
37
|
export class ListQuestion extends Question {
|
34
38
|
/**
|
35
39
|
* @param {ListElements} listElements
|
@@ -45,9 +49,28 @@ export class ListQuestion extends Question {
|
|
45
49
|
* @protected
|
46
50
|
*/
|
47
51
|
protected _list: Map<string, ListElement>;
|
52
|
+
/**
|
53
|
+
* @protected
|
54
|
+
* @returns {{
|
55
|
+
* formGroup?: FormGroupAfterInput;
|
56
|
+
* hint: DefaultComponent;
|
57
|
+
* name: string;
|
58
|
+
* fieldset?: GovukFieldset;
|
59
|
+
* id: string;
|
60
|
+
* items: ListItemReadonly[]
|
61
|
+
* }}
|
62
|
+
*/
|
63
|
+
protected _renderInput(): {
|
64
|
+
formGroup?: FormGroupAfterInput;
|
65
|
+
hint: DefaultComponent;
|
66
|
+
name: string;
|
67
|
+
fieldset?: GovukFieldset;
|
68
|
+
id: string;
|
69
|
+
items: ListItemReadonly[];
|
70
|
+
};
|
48
71
|
/**
|
49
72
|
* @returns {{
|
50
|
-
* formGroup?:
|
73
|
+
* formGroup?: FormGroupAfterInput;
|
51
74
|
* hint: DefaultComponent;
|
52
75
|
* name: string;
|
53
76
|
* fieldset?: GovukFieldset;
|
@@ -56,11 +79,7 @@ export class ListQuestion extends Question {
|
|
56
79
|
* }}
|
57
80
|
*/
|
58
81
|
get renderInput(): {
|
59
|
-
formGroup?:
|
60
|
-
afterInputs: {
|
61
|
-
html: string;
|
62
|
-
};
|
63
|
-
};
|
82
|
+
formGroup?: FormGroupAfterInput;
|
64
83
|
hint: DefaultComponent;
|
65
84
|
name: string;
|
66
85
|
fieldset?: GovukFieldset;
|
@@ -81,6 +100,11 @@ export class ListQuestion extends Question {
|
|
81
100
|
* @returns {Map<string, ListElement>}
|
82
101
|
*/
|
83
102
|
createListFromElements(listElements: ListElement[]): Map<string, ListElement>;
|
103
|
+
/**
|
104
|
+
* @protected
|
105
|
+
* @returns {ListItemReadonly[]}
|
106
|
+
*/
|
107
|
+
protected _getList(): ListItemReadonly[];
|
84
108
|
/**
|
85
109
|
* @returns {ListItemReadonly[]}
|
86
110
|
*/
|
@@ -111,6 +135,7 @@ import type { List } from '../../../form/form-definition/types.js';
|
|
111
135
|
import type { SelectionComponentsDef } from '../../../components/types.js';
|
112
136
|
import { Question } from '../../../form/form-editor/preview/question.js';
|
113
137
|
import type { ListElements } from '../../../form/form-editor/preview/types.js';
|
138
|
+
import type { FormGroupAfterInput } from '../../../form/form-editor/macros/types.js';
|
114
139
|
import type { DefaultComponent } from '../../../form/form-editor/preview/types.js';
|
115
140
|
import type { GovukFieldset } from '../../../form/form-editor/preview/types.js';
|
116
141
|
import type { ListItemReadonly } from '../../../form/form-editor/types.js';
|
@@ -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;;;OAGG;IACH,uBAHW,sBAAsB,QACtB,IAAI,EAKd;IAbD;;;OAGG;IACH,iBAHU,IAAI,CAGT;CAqBN;AAED;;GAEG;AACH;CAoBC;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;;;;;;;;;;OAUG;IACH,0BATa;QACT,SAAS,CAAC,EAAE,mBAAmB,CAAC;QAChC,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,CAuBH;IAED;;;;;;;;;OASG;IACH,mBATa;QACT,SAAS,CAAC,EAAE,mBAAmB,CAAC;QAChC,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,CAIH;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;;;OAGG;IACH,sBAFa,gBAAgB,EAAE,CAiC9B;IAED;;OAEG;IACH,YAFa,gBAAgB,EAAE,CAa9B;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;sCAEgD,yCAAyC;0CAhUtJ,4CAA4C;0BA8TpB,qCAAqC;4CADN,2BAA2B;yBA7TlF,4CAA4C;kCAgUiE,yCAAyC;yCADpH,wCAAwC;sCACmC,yCAAyC;mCAAzC,yCAAyC;sCAJ3G,iCAAiC;sCAIiC,yCAAyC"}
|
@@ -3,6 +3,10 @@
|
|
3
3
|
*/
|
4
4
|
export class PreviewComponent {
|
5
5
|
static PATH: string;
|
6
|
+
/**
|
7
|
+
* @type {boolean}
|
8
|
+
* @protected
|
9
|
+
*/
|
6
10
|
/**
|
7
11
|
* @param {QuestionElements} htmlElements
|
8
12
|
* @param {QuestionRenderer} questionRenderer
|
@@ -45,11 +49,6 @@ export class PreviewComponent {
|
|
45
49
|
* @protected
|
46
50
|
*/
|
47
51
|
protected _highlighted: boolean;
|
48
|
-
/**
|
49
|
-
* @type {boolean}
|
50
|
-
* @protected
|
51
|
-
*/
|
52
|
-
protected _largeTitle: boolean;
|
53
52
|
/**
|
54
53
|
* @type {string}
|
55
54
|
* @private
|
@@ -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;IAuCnC;;;OAGG;IAEH;;;OAGG;IACH,0BAHW,gBAAgB,oBAChB,gBAAgB,EA0B1B;IAvED;;;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;IAkBlB;;;OAGG;IACH,kBAAyB;IACzB;;;OAGG;IACH,kBAAyB;IAS3B;;;;OAIG;IACH,gCAJW,MAAM,GACJ,MAAM,CAKlB;IAED,wBAGC;IAED;;;OAGG;IACH,uBAFU,gBAAgB,CAOzB;IAED;;;OAGG;IACH,0BAFU,aAAa,CAStB;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;8BAhN6B,2BAA2B;sCAmN6E,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);
|
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,EAK3B;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"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"select-sortable.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/select-sortable.js"],"names":[],"mappings":"AAIA;IAGE,8DAIC;IAOD;oBAE6B;YAAE,
|
1
|
+
{"version":3,"file":"select-sortable.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/select-sortable.js"],"names":[],"mappings":"AAIA;IAGE,8DAIC;IAOD;oBAE6B;YAAE,UAAU,EAAE;gBAAE,IAAI,EAAE,MAAM,CAAA;aAAE,CAAA;SAAC;;;;;;;MAqB3D;CACF;qCA1CoC,iDAAiD"}
|
@@ -1,4 +1,18 @@
|
|
1
1
|
export class SelectQuestion extends ListQuestion {
|
2
|
+
get renderInput(): {
|
3
|
+
formGroup?: {
|
4
|
+
afterInput: {
|
5
|
+
html: string;
|
6
|
+
};
|
7
|
+
};
|
8
|
+
id: string;
|
9
|
+
name: string;
|
10
|
+
hint: import("./types.js").DefaultComponent;
|
11
|
+
label: import("./types.js").DefaultComponent;
|
12
|
+
items: ListItemReadonly[];
|
13
|
+
classes: string;
|
14
|
+
};
|
2
15
|
}
|
3
16
|
import { ListQuestion } from '../../../form/form-editor/preview/list.js';
|
17
|
+
import type { ListItemReadonly } from '../../../form/form-editor/types.js';
|
4
18
|
//# sourceMappingURL=select.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/select.js"],"names":[],"mappings":"AAIA;
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/select.js"],"names":[],"mappings":"AAIA;IAeE;oBAE6B;YAAE,UAAU,EAAE;gBAAE,IAAI,EAAE,MAAM,CAAA;aAAE,CAAA;SAAC;;;;;;;MAqB3D;CACF;6BA1C4B,wCAAwC;sCA6ChC,iCAAiC"}
|
@@ -13,13 +13,13 @@ 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;
|
17
16
|
question: string;
|
18
17
|
hintText: string;
|
19
18
|
optional: boolean;
|
20
19
|
shortDesc: string;
|
21
20
|
items: ListElement[];
|
22
21
|
content: string;
|
22
|
+
attributes?: Record<string, string>;
|
23
23
|
}
|
24
24
|
export interface DefaultComponent {
|
25
25
|
id?: string;
|
@@ -34,17 +34,28 @@ export type ListenerRow = [
|
|
34
34
|
(target: HTMLInputElement, e: Event) => void,
|
35
35
|
keyof HTMLElementEventMap
|
36
36
|
];
|
37
|
-
export interface
|
38
|
-
readonly values
|
37
|
+
export interface DomElementsBase {
|
38
|
+
readonly values?: BaseSettings;
|
39
|
+
autocompleteOptions?: string;
|
39
40
|
setPreviewHTML(value: string): void;
|
40
41
|
setPreviewDOM(element: HTMLElement): void;
|
41
42
|
}
|
43
|
+
export interface QuestionElements extends DomElementsBase {
|
44
|
+
readonly values: BaseSettings;
|
45
|
+
}
|
42
46
|
export interface AutocompleteElements extends QuestionElements {
|
43
47
|
autocompleteOptions: string;
|
44
48
|
}
|
45
|
-
export interface
|
49
|
+
export interface RenderBase {
|
50
|
+
render(questionTemplate: string, renderContext: RenderContext): void;
|
51
|
+
}
|
52
|
+
export interface QuestionRenderContext {
|
46
53
|
model: QuestionBaseModel;
|
47
54
|
}
|
55
|
+
export interface PageRenderContext {
|
56
|
+
params: PagePreviewPanelMacro;
|
57
|
+
}
|
58
|
+
export type RenderContext = QuestionRenderContext | PageRenderContext;
|
48
59
|
export interface HTMLBuilder {
|
49
60
|
buildHTML(questionTemplate: string, renderContext: RenderContext): string;
|
50
61
|
}
|
@@ -54,12 +65,14 @@ export interface QuestionRenderer {
|
|
54
65
|
export interface PageRenderer {
|
55
66
|
render(pageTemplate: string, pagePreview: PagePreviewPanelMacro): void;
|
56
67
|
}
|
68
|
+
export type Renderer = QuestionRenderer | PageRenderer;
|
57
69
|
export interface ListElements extends QuestionElements {
|
58
70
|
afterInputsHTML: string;
|
59
71
|
}
|
60
72
|
export interface PageOverviewElements {
|
61
73
|
heading: string;
|
62
74
|
guidance: string;
|
75
|
+
addHeading: boolean;
|
63
76
|
}
|
64
77
|
export type PreviewQuestion = DateInputQuestion | EmailAddressQuestion | ListSortableQuestion | LongAnswerQuestion | PhoneNumberQuestion | Question | RadioSortableQuestion | SelectSortableQuestion | ShortAnswerQuestion | UkAddressQuestion | AutocompleteQuestion;
|
65
78
|
//# sourceMappingURL=types.d.ts.map
|
@@ -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,CAAA;AAC/F,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,gDAAgD,CAAA;AACzF,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,8CAA8C,CAAA;AACrF,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAClE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAC/E,MAAM,WAAW,YAAY;IAC3B,
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/types.ts"],"names":[],"mappings":"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"}
|
package/dist/types/stubs.d.ts
CHANGED
@@ -11,4 +11,7 @@ export { buildFileUploadPage } from './__stubs__/pages.js';
|
|
11
11
|
export { buildSummaryPage } from './__stubs__/pages.js';
|
12
12
|
export { buildQuestionPage } from './__stubs__/pages.js';
|
13
13
|
export { buildMarkdownComponent } from './__stubs__/components.js';
|
14
|
+
export { QuestionRendererStub } from './form/form-editor/__stubs__/preview.js';
|
15
|
+
export { PageRendererStub } from './form/form-editor/__stubs__/preview.js';
|
16
|
+
export { QuestionPreviewElements } from './form/form-editor/__stubs__/preview.js';
|
14
17
|
//# sourceMappingURL=stubs.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"stubs.d.ts","sourceRoot":"","sources":["../../src/stubs.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAA;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA"}
|
1
|
+
{"version":3,"file":"stubs.d.ts","sourceRoot":"","sources":["../../src/stubs.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAA;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAA;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAA;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAA"}
|
package/package.json
CHANGED
@@ -96,28 +96,18 @@ export class QuestionPreviewElements {
|
|
96
96
|
* @private
|
97
97
|
*/
|
98
98
|
_items = []
|
99
|
-
_largeTitle = true
|
100
99
|
afterInputsHTML = '<div class="govuk-inset-text">No items added yet.</div>'
|
101
100
|
|
102
101
|
/**
|
103
102
|
* @param {BaseSettings} baseSettings
|
104
103
|
*/
|
105
|
-
constructor({
|
106
|
-
question,
|
107
|
-
hintText,
|
108
|
-
optional,
|
109
|
-
shortDesc,
|
110
|
-
items,
|
111
|
-
content,
|
112
|
-
largeTitle = true
|
113
|
-
}) {
|
104
|
+
constructor({ question, hintText, optional, shortDesc, items, content }) {
|
114
105
|
this._question = question
|
115
106
|
this._hintText = hintText
|
116
107
|
this._optional = optional
|
117
108
|
this._shortDesc = shortDesc
|
118
109
|
this._items = items
|
119
110
|
this._content = content
|
120
|
-
this._largeTitle = largeTitle
|
121
111
|
}
|
122
112
|
|
123
113
|
/**
|
@@ -130,8 +120,7 @@ export class QuestionPreviewElements {
|
|
130
120
|
optional: this._optional,
|
131
121
|
shortDesc: this._shortDesc,
|
132
122
|
items: this._items,
|
133
|
-
content: this._content
|
134
|
-
largeTitle: this._largeTitle
|
123
|
+
content: this._content
|
135
124
|
}
|
136
125
|
}
|
137
126
|
|
@@ -169,14 +158,17 @@ export class AutocompletePreviewElements extends QuestionPreviewElements {
|
|
169
158
|
export class PagePreviewElements {
|
170
159
|
guidance
|
171
160
|
heading
|
161
|
+
addHeading
|
172
162
|
|
173
163
|
/**
|
174
164
|
* @param {string} heading
|
175
165
|
* @param {string} guidance
|
166
|
+
* @param {boolean} [addHeading]
|
176
167
|
*/
|
177
|
-
constructor(heading, guidance = '') {
|
168
|
+
constructor(heading, guidance = '', addHeading = undefined) {
|
178
169
|
this.heading = heading
|
179
170
|
this.guidance = guidance
|
171
|
+
this.addHeading = addHeading ?? heading.length > 0
|
180
172
|
}
|
181
173
|
}
|
182
174
|
|
@@ -29,16 +29,27 @@ export interface AppPreviewPanelTabsMacro {
|
|
29
29
|
basePageFields: GovukField[]
|
30
30
|
}
|
31
31
|
|
32
|
+
export interface SelectAfterInput {
|
33
|
+
afterInput: { html: string }
|
34
|
+
}
|
35
|
+
export interface RadioAndCheckboxAfterInputs {
|
36
|
+
afterInputs: { html: string }
|
37
|
+
}
|
38
|
+
|
39
|
+
// GDS components - Select uses afterInput, while Radio uses afterInputs
|
40
|
+
export type FormGroupAfterInput = SelectAfterInput | RadioAndCheckboxAfterInputs
|
41
|
+
|
32
42
|
export interface QuestionBaseModel {
|
33
43
|
id?: string
|
34
44
|
name?: string
|
35
45
|
content?: string
|
46
|
+
attributes?: Record<string, string>
|
36
47
|
label?: DefaultComponent
|
37
48
|
hint?: DefaultComponent
|
38
49
|
fieldset?: GovukFieldset
|
39
50
|
readonly items?: ListItemReadonly[] | DateItem[]
|
40
51
|
text?: string
|
41
|
-
formGroup?:
|
52
|
+
formGroup?: FormGroupAfterInput
|
42
53
|
type?: 'text' | 'number' | 'boolean'
|
43
54
|
classes?: string
|
44
55
|
}
|
@@ -7,18 +7,11 @@ export class ComponentElements {
|
|
7
7
|
* @protected
|
8
8
|
*/
|
9
9
|
_component
|
10
|
-
/**
|
11
|
-
* @type {boolean}
|
12
|
-
* @private
|
13
|
-
*/
|
14
|
-
_largeTitle = true
|
15
10
|
/**
|
16
11
|
* @param {ComponentDef} component
|
17
|
-
* @param {boolean} [largeTitle]
|
18
12
|
*/
|
19
|
-
constructor(component
|
13
|
+
constructor(component) {
|
20
14
|
this._component = component
|
21
|
-
this._largeTitle = largeTitle
|
22
15
|
}
|
23
16
|
|
24
17
|
/**
|
@@ -34,8 +27,7 @@ export class ComponentElements {
|
|
34
27
|
optional: !required,
|
35
28
|
shortDesc: '',
|
36
29
|
items: [],
|
37
|
-
content: ''
|
38
|
-
largeTitle: this._largeTitle
|
30
|
+
content: ''
|
39
31
|
}
|
40
32
|
}
|
41
33
|
|
@@ -12,10 +12,9 @@ export class ContentElements extends ComponentElements {
|
|
12
12
|
_component
|
13
13
|
/**
|
14
14
|
* @param {Exclude<ContentComponentsDef, ListComponent>} component
|
15
|
-
* @param {boolean} largeTitle
|
16
15
|
*/
|
17
|
-
constructor(component
|
18
|
-
super(component
|
16
|
+
constructor(component) {
|
17
|
+
super(component)
|
19
18
|
this._component = component
|
20
19
|
}
|
21
20
|
|