@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.
Files changed (70) hide show
  1. package/dist/module/form/form-editor/__stubs__/preview.js +6 -7
  2. package/dist/module/form/form-editor/__stubs__/preview.js.map +1 -1
  3. package/dist/module/form/form-editor/macros/types.js.map +1 -1
  4. package/dist/module/form/form-editor/preview/autocomplete.js +3 -0
  5. package/dist/module/form/form-editor/preview/autocomplete.js.map +1 -1
  6. package/dist/module/form/form-editor/preview/component-elements.js +2 -10
  7. package/dist/module/form/form-editor/preview/component-elements.js.map +1 -1
  8. package/dist/module/form/form-editor/preview/content.js +2 -3
  9. package/dist/module/form/form-editor/preview/content.js.map +1 -1
  10. package/dist/module/form/form-editor/preview/controller/page-controller.js +91 -6
  11. package/dist/module/form/form-editor/preview/controller/page-controller.js.map +1 -1
  12. package/dist/module/form/form-editor/preview/helpers.js +10 -8
  13. package/dist/module/form/form-editor/preview/helpers.js.map +1 -1
  14. package/dist/module/form/form-editor/preview/list.js +60 -8
  15. package/dist/module/form/form-editor/preview/list.js.map +1 -1
  16. package/dist/module/form/form-editor/preview/preview.js +3 -8
  17. package/dist/module/form/form-editor/preview/preview.js.map +1 -1
  18. package/dist/module/form/form-editor/preview/question.js +2 -2
  19. package/dist/module/form/form-editor/preview/question.js.map +1 -1
  20. package/dist/module/form/form-editor/preview/select-sortable.js +5 -1
  21. package/dist/module/form/form-editor/preview/select-sortable.js.map +1 -1
  22. package/dist/module/form/form-editor/preview/select.js +32 -0
  23. package/dist/module/form/form-editor/preview/select.js.map +1 -1
  24. package/dist/module/form/form-editor/preview/types.js.map +1 -1
  25. package/dist/module/stubs.js +3 -0
  26. package/dist/module/stubs.js.map +1 -1
  27. package/dist/types/form/form-editor/__stubs__/preview.d.ts +4 -3
  28. package/dist/types/form/form-editor/__stubs__/preview.d.ts.map +1 -1
  29. package/dist/types/form/form-editor/macros/types.d.ts +13 -5
  30. package/dist/types/form/form-editor/macros/types.d.ts.map +1 -1
  31. package/dist/types/form/form-editor/preview/autocomplete.d.ts.map +1 -1
  32. package/dist/types/form/form-editor/preview/component-elements.d.ts +1 -7
  33. package/dist/types/form/form-editor/preview/component-elements.d.ts.map +1 -1
  34. package/dist/types/form/form-editor/preview/content.d.ts +1 -2
  35. package/dist/types/form/form-editor/preview/content.d.ts.map +1 -1
  36. package/dist/types/form/form-editor/preview/controller/page-controller.d.ts +27 -0
  37. package/dist/types/form/form-editor/preview/controller/page-controller.d.ts.map +1 -1
  38. package/dist/types/form/form-editor/preview/fieldset-question.d.ts +2 -5
  39. package/dist/types/form/form-editor/preview/fieldset-question.d.ts.map +1 -1
  40. package/dist/types/form/form-editor/preview/helpers.d.ts +1 -2
  41. package/dist/types/form/form-editor/preview/helpers.d.ts.map +1 -1
  42. package/dist/types/form/form-editor/preview/list.d.ts +33 -8
  43. package/dist/types/form/form-editor/preview/list.d.ts.map +1 -1
  44. package/dist/types/form/form-editor/preview/preview.d.ts +4 -5
  45. package/dist/types/form/form-editor/preview/preview.d.ts.map +1 -1
  46. package/dist/types/form/form-editor/preview/question.d.ts +1 -1
  47. package/dist/types/form/form-editor/preview/question.d.ts.map +1 -1
  48. package/dist/types/form/form-editor/preview/select-sortable.d.ts +1 -1
  49. package/dist/types/form/form-editor/preview/select-sortable.d.ts.map +1 -1
  50. package/dist/types/form/form-editor/preview/select.d.ts +14 -0
  51. package/dist/types/form/form-editor/preview/select.d.ts.map +1 -1
  52. package/dist/types/form/form-editor/preview/types.d.ts +17 -4
  53. package/dist/types/form/form-editor/preview/types.d.ts.map +1 -1
  54. package/dist/types/stubs.d.ts +3 -0
  55. package/dist/types/stubs.d.ts.map +1 -1
  56. package/package.json +1 -1
  57. package/src/form/form-editor/__stubs__/preview.js +6 -14
  58. package/src/form/form-editor/macros/types.ts +12 -1
  59. package/src/form/form-editor/preview/autocomplete.js +1 -0
  60. package/src/form/form-editor/preview/component-elements.js +2 -10
  61. package/src/form/form-editor/preview/content.js +2 -3
  62. package/src/form/form-editor/preview/controller/page-controller.js +109 -10
  63. package/src/form/form-editor/preview/helpers.js +16 -12
  64. package/src/form/form-editor/preview/list.js +73 -17
  65. package/src/form/form-editor/preview/preview.js +3 -11
  66. package/src/form/form-editor/preview/question.js +2 -2
  67. package/src/form/form-editor/preview/select-sortable.js +5 -1
  68. package/src/form/form-editor/preview/select.js +38 -0
  69. package/src/form/form-editor/preview/types.ts +23 -4
  70. package/src/stubs.ts +3 -0
@@ -57,10 +57,9 @@ export class ListComponentElements extends QuestionComponentElements {
57
57
  /**
58
58
  * @param {SelectionComponentsDef} component
59
59
  * @param {List} list
60
- * @param {boolean} largeTitle
61
60
  */
62
- constructor(component, list, largeTitle = true) {
63
- super(component, largeTitle);
61
+ constructor(component, list) {
62
+ super(component);
64
63
  this._list = list;
65
64
  }
66
65
 
@@ -75,6 +74,28 @@ export class ListComponentElements extends QuestionComponentElements {
75
74
  };
76
75
  }
77
76
  }
77
+
78
+ /**
79
+ * @implements {QuestionElements}
80
+ */
81
+ export class SelectComponentElements extends ListComponentElements {
82
+ /**
83
+ * @returns {BaseSettings}
84
+ * @protected
85
+ */
86
+ _getValues() {
87
+ const emptyItem = /** @type {ListElement} */{
88
+ id: 'da310b6e-2513-4d14-a7a1-63a93231891d',
89
+ text: '',
90
+ value: ''
91
+ };
92
+ const items = /** @type {ListElement[]} */[emptyItem, ...super._getValues().items];
93
+ return {
94
+ ...super._getValues(),
95
+ items
96
+ };
97
+ }
98
+ }
78
99
  export class ListQuestion extends Question {
79
100
  /**
80
101
  * @type {ComponentType}
@@ -108,8 +129,9 @@ export class ListQuestion extends Question {
108
129
  }
109
130
 
110
131
  /**
132
+ * @protected
111
133
  * @returns {{
112
- * formGroup?: {afterInputs: {html: string}};
134
+ * formGroup?: FormGroupAfterInput;
113
135
  * hint: DefaultComponent;
114
136
  * name: string;
115
137
  * fieldset?: GovukFieldset;
@@ -117,8 +139,8 @@ export class ListQuestion extends Question {
117
139
  * items: ListItemReadonly[]
118
140
  * }}
119
141
  */
120
- get renderInput() {
121
- const afterInputs = /** @type {{ formGroup?: { afterInputs: { html: string } } }} */
142
+ _renderInput() {
143
+ const afterInputs = /** @type {{ formGroup?: FormGroupAfterInput }} */
122
144
  this.list.length ? {} : {
123
145
  formGroup: {
124
146
  afterInputs: {
@@ -136,6 +158,20 @@ export class ListQuestion extends Question {
136
158
  };
137
159
  }
138
160
 
161
+ /**
162
+ * @returns {{
163
+ * formGroup?: FormGroupAfterInput;
164
+ * hint: DefaultComponent;
165
+ * name: string;
166
+ * fieldset?: GovukFieldset;
167
+ * id: string;
168
+ * items: ListItemReadonly[]
169
+ * }}
170
+ */
171
+ get renderInput() {
172
+ return this._renderInput();
173
+ }
174
+
139
175
  /**
140
176
  *
141
177
  * @param {ListElement} listElement
@@ -163,9 +199,10 @@ export class ListQuestion extends Question {
163
199
  }
164
200
 
165
201
  /**
202
+ * @protected
166
203
  * @returns {ListItemReadonly[]}
167
204
  */
168
- get list() {
205
+ _getList() {
169
206
  const iterator = /** @type {MapIterator<ListElement>} */
170
207
  this._list.values();
171
208
  return Array.from(iterator).map(listItem => {
@@ -176,7 +213,7 @@ export class ListQuestion extends Question {
176
213
  classes: this.getHighlight(listItem.id + '-hint')
177
214
  } : undefined
178
215
  };
179
- const text = listItem.text.length ? listItem.text : 'Item text';
216
+ const text = listItem.text;
180
217
  return {
181
218
  ...listItem,
182
219
  text,
@@ -189,6 +226,20 @@ export class ListQuestion extends Question {
189
226
  });
190
227
  }
191
228
 
229
+ /**
230
+ * @returns {ListItemReadonly[]}
231
+ */
232
+ get list() {
233
+ const list = this._getList();
234
+ return list.map(listItem => {
235
+ const text = listItem.text.length ? listItem.text : 'Item text';
236
+ return {
237
+ ...listItem,
238
+ text
239
+ };
240
+ });
241
+ }
242
+
192
243
  /**
193
244
  *
194
245
  * @param {string | undefined} id
@@ -244,6 +295,7 @@ export class ListQuestion extends Question {
244
295
  * @import { ListElement, ListItemReadonly } from '~/src/form/form-editor/types.js'
245
296
  * @import { SelectionComponentsDef, ListComponentsDef } from '~/src/components/types.js'
246
297
  * @import { List, Item } from '~/src/form/form-definition/types.js'
298
+ * @import { FormGroupAfterInput } from '~/src/form/form-editor/macros/types.js'
247
299
  * @import { ListElements, QuestionRenderer, DefaultComponent, GovukFieldset, BaseSettings, QuestionElements } from '~/src/form/form-editor/preview/types.js'
248
300
  */
249
301
  //# sourceMappingURL=list.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","names":["ComponentType","PreviewComponent","Question","QuestionComponentElements","DefaultListConst","TextElementId","HintElementId","Template","PATH","Input","RenderName","listItemMapper","listElement","id","listsElementToMap","listElements","entries","map","Map","listItemToListElement","item","text","label","classes","value","hint","ListComponentElements","_list","constructor","component","list","largeTitle","_getValues","items","ListQuestion","componentType","List","_questionTemplate","_listElements","listRenderId","listRenderName","questionRenderer","values","createListFromElements","renderInput","afterInputs","length","formGroup","html","afterInputsHTML","name","fieldset","fieldSet","push","set","render","delete","key","iterator","Array","from","listItem","hintText","_highlight","getHighlight","undefined","updateText","get","updateHint","updateValue"],"sources":["../../../../../src/form/form-editor/preview/list.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\nimport {\n Question,\n QuestionComponentElements\n} from '~/src/form/form-editor/preview/question.js'\n\nconst DefaultListConst = {\n TextElementId: 'radioText',\n HintElementId: 'radioHint',\n Template: PreviewComponent.PATH + 'radios.njk',\n Input: 'listInput',\n RenderName: 'listInputField'\n}\n\n/**\n * @param {ListElement} listElement\n * @returns {[string, ListElement]}\n */\nexport function listItemMapper(listElement) {\n return [listElement.id, listElement]\n}\n\n/**\n *\n * @param { ListElement[]| undefined } listElements\n * @returns {Map<string, ListElement>}\n */\nexport function listsElementToMap(listElements) {\n const entries = listElements ? listElements.map(listItemMapper) : []\n return new Map(entries)\n}\n\n/**\n * @param {Item} item\n * @returns {ListElement}\n */\nexport function listItemToListElement(item) {\n return {\n text: item.text,\n label: {\n text: item.text,\n classes: ''\n },\n value: item.value,\n id: item.id ?? '',\n hint: item.hint\n }\n}\n\n/**\n * @implements {QuestionElements}\n */\nexport class ListComponentElements extends QuestionComponentElements {\n /**\n * @type {List}\n * @protected\n */\n _list\n\n /**\n * @param {SelectionComponentsDef} component\n * @param {List} list\n * @param {boolean} largeTitle\n */\n constructor(component, list, largeTitle = true) {\n super(component, largeTitle)\n this._list = list\n }\n\n /**\n * @returns {BaseSettings}\n * @protected\n */\n _getValues() {\n return {\n ...super._getValues(),\n items: this._list.items.map(listItemToListElement)\n }\n }\n}\n\nexport class ListQuestion extends Question {\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.List\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = DefaultListConst.Template\n /** @type {ListElements} */\n _listElements\n listRenderId = DefaultListConst.Input\n listRenderName = DefaultListConst.RenderName\n\n /**\n * @type {Map<string, ListElement>}\n * @protected\n */\n _list\n\n /**\n * @param {ListElements} listElements\n * @param {QuestionRenderer} questionRenderer\n */\n constructor(listElements, questionRenderer) {\n super(listElements, questionRenderer)\n\n const items = /** @type {ListElement[]} */ (listElements.values.items)\n this._list = this.createListFromElements(items)\n this._listElements = listElements\n }\n\n /**\n * @returns {{\n * formGroup?: {afterInputs: {html: string}};\n * hint: DefaultComponent;\n * name: string;\n * fieldset?: GovukFieldset;\n * id: string;\n * items: ListItemReadonly[]\n * }}\n */\n get renderInput() {\n const afterInputs =\n /** @type {{ formGroup?: { afterInputs: { html: string } } }} */ (\n this.list.length\n ? {}\n : {\n formGroup: {\n afterInputs: {\n html: this._listElements.afterInputsHTML\n }\n }\n }\n )\n\n return {\n id: this.listRenderId,\n name: this.listRenderName,\n fieldset: this.fieldSet,\n hint: this.hint,\n items: this.list,\n ...afterInputs\n }\n }\n\n /**\n *\n * @param {ListElement} listElement\n */\n push(listElement) {\n this._list.set(listElement.id, listElement)\n this.render()\n }\n\n /**\n * @param {string} key\n */\n delete(key) {\n this._list.delete(key)\n this.render()\n }\n\n /**\n * @param {ListElement[]} listElements\n * @returns {Map<string, ListElement>}\n */\n createListFromElements(listElements) {\n this._list = listsElementToMap(listElements)\n return this._list\n }\n\n /**\n * @returns {ListItemReadonly[]}\n */\n get list() {\n const iterator = /** @type {MapIterator<ListElement>} */ (\n this._list.values()\n )\n return Array.from(iterator).map((listItem) => {\n const hintText =\n this._highlight === `${listItem.id}-hint` && !listItem.hint?.text.length\n ? 'Hint text'\n : (listItem.hint?.text ?? '')\n\n const hint = {\n hint: hintText\n ? {\n text: hintText,\n classes: this.getHighlight(listItem.id + '-hint')\n }\n : undefined\n }\n\n const text = listItem.text.length ? listItem.text : 'Item text'\n\n return {\n ...listItem,\n text,\n ...hint,\n label: {\n text: listItem.text,\n classes: this.getHighlight(listItem.id + '-label')\n }\n }\n })\n }\n\n /**\n *\n * @param {string | undefined} id\n * @param {string} text\n */\n updateText(id, text) {\n if (!id) {\n return\n }\n\n const listItem = this._list.get(id)\n if (listItem) {\n listItem.text = text\n this.render()\n }\n }\n\n /**\n *\n * @param {string | undefined} id\n * @param {string} hint\n */\n updateHint(id, hint) {\n if (!id) {\n return\n }\n\n const listItem = this._list.get(id)\n if (listItem) {\n listItem.hint = {\n ...listItem.hint,\n text: hint\n }\n this.render()\n }\n }\n\n /**\n * @param {string | undefined} id\n * @param {string} value\n */\n updateValue(id, value) {\n if (!id) {\n return\n }\n\n const listItem = this._list.get(id)\n if (listItem) {\n listItem.value = value\n this.render()\n }\n }\n}\n\n/**\n * @import { ListElement, ListItemReadonly } from '~/src/form/form-editor/types.js'\n * @import { SelectionComponentsDef, ListComponentsDef } from '~/src/components/types.js'\n * @import { List, Item } from '~/src/form/form-definition/types.js'\n * @import { ListElements, QuestionRenderer, DefaultComponent, GovukFieldset, BaseSettings, QuestionElements } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,gBAAgB;AACzB,SACEC,QAAQ,EAC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List":[]}
1
+ {"version":3,"file":"list.js","names":["ComponentType","PreviewComponent","Question","QuestionComponentElements","DefaultListConst","TextElementId","HintElementId","Template","PATH","Input","RenderName","listItemMapper","listElement","id","listsElementToMap","listElements","entries","map","Map","listItemToListElement","item","text","label","classes","value","hint","ListComponentElements","_list","constructor","component","list","_getValues","items","SelectComponentElements","emptyItem","ListQuestion","componentType","List","_questionTemplate","_listElements","listRenderId","listRenderName","questionRenderer","values","createListFromElements","_renderInput","afterInputs","length","formGroup","html","afterInputsHTML","name","fieldset","fieldSet","renderInput","push","set","render","delete","key","_getList","iterator","Array","from","listItem","hintText","_highlight","getHighlight","undefined","updateText","get","updateHint","updateValue"],"sources":["../../../../../src/form/form-editor/preview/list.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\nimport {\n Question,\n QuestionComponentElements\n} from '~/src/form/form-editor/preview/question.js'\n\nconst DefaultListConst = {\n TextElementId: 'radioText',\n HintElementId: 'radioHint',\n Template: PreviewComponent.PATH + 'radios.njk',\n Input: 'listInput',\n RenderName: 'listInputField'\n}\n\n/**\n * @param {ListElement} listElement\n * @returns {[string, ListElement]}\n */\nexport function listItemMapper(listElement) {\n return [listElement.id, listElement]\n}\n\n/**\n *\n * @param { ListElement[]| undefined } listElements\n * @returns {Map<string, ListElement>}\n */\nexport function listsElementToMap(listElements) {\n const entries = listElements ? listElements.map(listItemMapper) : []\n return new Map(entries)\n}\n\n/**\n * @param {Item} item\n * @returns {ListElement}\n */\nexport function listItemToListElement(item) {\n return {\n text: item.text,\n label: {\n text: item.text,\n classes: ''\n },\n value: item.value,\n id: item.id ?? '',\n hint: item.hint\n }\n}\n\n/**\n * @implements {QuestionElements}\n */\nexport class ListComponentElements extends QuestionComponentElements {\n /**\n * @type {List}\n * @protected\n */\n _list\n\n /**\n * @param {SelectionComponentsDef} component\n * @param {List} list\n */\n constructor(component, list) {\n super(component)\n this._list = list\n }\n\n /**\n * @returns {BaseSettings}\n * @protected\n */\n _getValues() {\n return {\n ...super._getValues(),\n items: this._list.items.map(listItemToListElement)\n }\n }\n}\n\n/**\n * @implements {QuestionElements}\n */\nexport class SelectComponentElements extends ListComponentElements {\n /**\n * @returns {BaseSettings}\n * @protected\n */\n _getValues() {\n const emptyItem = /** @type {ListElement} */ ({\n id: 'da310b6e-2513-4d14-a7a1-63a93231891d',\n text: '',\n value: ''\n })\n const items = /** @type {ListElement[]} */ ([\n emptyItem,\n ...super._getValues().items\n ])\n return {\n ...super._getValues(),\n items\n }\n }\n}\n\nexport class ListQuestion extends Question {\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.List\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = DefaultListConst.Template\n /** @type {ListElements} */\n _listElements\n listRenderId = DefaultListConst.Input\n listRenderName = DefaultListConst.RenderName\n\n /**\n * @type {Map<string, ListElement>}\n * @protected\n */\n _list\n\n /**\n * @param {ListElements} listElements\n * @param {QuestionRenderer} questionRenderer\n */\n constructor(listElements, questionRenderer) {\n super(listElements, questionRenderer)\n\n const items = /** @type {ListElement[]} */ (listElements.values.items)\n this._list = this.createListFromElements(items)\n this._listElements = listElements\n }\n\n /**\n * @protected\n * @returns {{\n * formGroup?: FormGroupAfterInput;\n * hint: DefaultComponent;\n * name: string;\n * fieldset?: GovukFieldset;\n * id: string;\n * items: ListItemReadonly[]\n * }}\n */\n _renderInput() {\n const afterInputs = /** @type {{ formGroup?: FormGroupAfterInput }} */ (\n this.list.length\n ? {}\n : {\n formGroup: {\n afterInputs: {\n html: this._listElements.afterInputsHTML\n }\n }\n }\n )\n\n return {\n id: this.listRenderId,\n name: this.listRenderName,\n fieldset: this.fieldSet,\n hint: this.hint,\n items: this.list,\n ...afterInputs\n }\n }\n\n /**\n * @returns {{\n * formGroup?: FormGroupAfterInput;\n * hint: DefaultComponent;\n * name: string;\n * fieldset?: GovukFieldset;\n * id: string;\n * items: ListItemReadonly[]\n * }}\n */\n get renderInput() {\n return this._renderInput()\n }\n\n /**\n *\n * @param {ListElement} listElement\n */\n push(listElement) {\n this._list.set(listElement.id, listElement)\n this.render()\n }\n\n /**\n * @param {string} key\n */\n delete(key) {\n this._list.delete(key)\n this.render()\n }\n\n /**\n * @param {ListElement[]} listElements\n * @returns {Map<string, ListElement>}\n */\n createListFromElements(listElements) {\n this._list = listsElementToMap(listElements)\n return this._list\n }\n\n /**\n * @protected\n * @returns {ListItemReadonly[]}\n */\n _getList() {\n const iterator = /** @type {MapIterator<ListElement>} */ (\n this._list.values()\n )\n return Array.from(iterator).map((listItem) => {\n const hintText =\n this._highlight === `${listItem.id}-hint` && !listItem.hint?.text.length\n ? 'Hint text'\n : (listItem.hint?.text ?? '')\n\n const hint = {\n hint: hintText\n ? {\n text: hintText,\n classes: this.getHighlight(listItem.id + '-hint')\n }\n : undefined\n }\n\n const text = listItem.text\n\n return {\n ...listItem,\n text,\n ...hint,\n label: {\n text: listItem.text,\n classes: this.getHighlight(listItem.id + '-label')\n }\n }\n })\n }\n\n /**\n * @returns {ListItemReadonly[]}\n */\n get list() {\n const list = this._getList()\n\n return list.map((listItem) => {\n const text = listItem.text.length ? listItem.text : 'Item text'\n\n return {\n ...listItem,\n text\n }\n })\n }\n\n /**\n *\n * @param {string | undefined} id\n * @param {string} text\n */\n updateText(id, text) {\n if (!id) {\n return\n }\n\n const listItem = this._list.get(id)\n if (listItem) {\n listItem.text = text\n this.render()\n }\n }\n\n /**\n *\n * @param {string | undefined} id\n * @param {string} hint\n */\n updateHint(id, hint) {\n if (!id) {\n return\n }\n\n const listItem = this._list.get(id)\n if (listItem) {\n listItem.hint = {\n ...listItem.hint,\n text: hint\n }\n this.render()\n }\n }\n\n /**\n * @param {string | undefined} id\n * @param {string} value\n */\n updateValue(id, value) {\n if (!id) {\n return\n }\n\n const listItem = this._list.get(id)\n if (listItem) {\n listItem.value = value\n this.render()\n }\n }\n}\n\n/**\n * @import { ListElement, ListItemReadonly } from '~/src/form/form-editor/types.js'\n * @import { SelectionComponentsDef, ListComponentsDef } from '~/src/components/types.js'\n * @import { List, Item } from '~/src/form/form-definition/types.js'\n * @import { FormGroupAfterInput } from '~/src/form/form-editor/macros/types.js'\n * @import { ListElements, QuestionRenderer, DefaultComponent, GovukFieldset, BaseSettings, QuestionElements } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,gBAAgB;AACzB,SACEC,QAAQ,EACRC,yBAAyB;AAG3B,MAAMC,gBAAgB,GAAG;EACvBC,aAAa,EAAE,WAAW;EAC1BC,aAAa,EAAE,WAAW;EAC1BC,QAAQ,EAAEN,gBAAgB,CAACO,IAAI,GAAG,YAAY;EAC9CC,KAAK,EAAE,WAAW;EAClBC,UAAU,EAAE;AACd,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAACC,WAAW,EAAE;EAC1C,OAAO,CAACA,WAAW,CAACC,EAAE,EAAED,WAAW,CAAC;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,iBAAiBA,CAACC,YAAY,EAAE;EAC9C,MAAMC,OAAO,GAAGD,YAAY,GAAGA,YAAY,CAACE,GAAG,CAACN,cAAc,CAAC,GAAG,EAAE;EACpE,OAAO,IAAIO,GAAG,CAACF,OAAO,CAAC;AACzB;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASG,qBAAqBA,CAACC,IAAI,EAAE;EAC1C,OAAO;IACLC,IAAI,EAAED,IAAI,CAACC,IAAI;IACfC,KAAK,EAAE;MACLD,IAAI,EAAED,IAAI,CAACC,IAAI;MACfE,OAAO,EAAE;IACX,CAAC;IACDC,KAAK,EAAEJ,IAAI,CAACI,KAAK;IACjBX,EAAE,EAAEO,IAAI,CAACP,EAAE,IAAI,EAAE;IACjBY,IAAI,EAAEL,IAAI,CAACK;EACb,CAAC;AACH;;AAEA;AACA;AACA;AACA,OAAO,MAAMC,qBAAqB,SAASvB,yBAAyB,CAAC;EACnE;AACF;AACA;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ACL,GAAG2C,QAAQ;QACX3C;MACF,CAAC;IACH,CAAC,CAAC;EACJ;;EAEA;AACF;AACA;AACA;AACA;EACEgD,UAAUA,CAACxD,EAAE,EAAEQ,IAAI,EAAE;IACnB,IAAI,CAACR,EAAE,EAAE;MACP;IACF;IAEA,MAAMmD,QAAQ,GAAG,IAAI,CAACrC,KAAK,CAAC2C,GAAG,CAACzD,EAAE,CAAC;IACnC,IAAImD,QAAQ,EAAE;MACZA,QAAQ,CAAC3C,IAAI,GAAGA,IAAI;MACpB,IAAI,CAACoC,MAAM,CAAC,CAAC;IACf;EACF;;EAEA;AACF;AACA;AACA;AACA;EACEc,UAAUA,CAAC1D,EAAE,EAAEY,IAAI,EAAE;IACnB,IAAI,CAACZ,EAAE,EAAE;MACP;IACF;IAEA,MAAMmD,QAAQ,GAAG,IAAI,CAACrC,KAAK,CAAC2C,GAAG,CAACzD,EAAE,CAAC;IACnC,IAAImD,QAAQ,EAAE;MACZA,QAAQ,CAACvC,IAAI,GAAG;QACd,GAAGuC,QAAQ,CAACvC,IAAI;QAChBJ,IAAI,EAAEI;MACR,CAAC;MACD,IAAI,CAACgC,MAAM,CAAC,CAAC;IACf;EACF;;EAEA;AACF;AACA;AACA;EACEe,WAAWA,CAAC3D,EAAE,EAAEW,KAAK,EAAE;IACrB,IAAI,CAACX,EAAE,EAAE;MACP;IACF;IAEA,MAAMmD,QAAQ,GAAG,IAAI,CAACrC,KAAK,CAAC2C,GAAG,CAACzD,EAAE,CAAC;IACnC,IAAImD,QAAQ,EAAE;MACZA,QAAQ,CAACxC,KAAK,GAAGA,KAAK;MACtB,IAAI,CAACiC,MAAM,CAAC,CAAC;IACf;EACF;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
@@ -48,7 +48,6 @@ export class PreviewComponent {
48
48
  * @type {boolean}
49
49
  * @protected
50
50
  */
51
- _largeTitle = true;
52
51
 
53
52
  /**
54
53
  * @param {QuestionElements} htmlElements
@@ -57,8 +56,7 @@ export class PreviewComponent {
57
56
  constructor(htmlElements, questionRenderer) {
58
57
  const {
59
58
  question,
60
- optional,
61
- largeTitle
59
+ optional
62
60
  } = htmlElements.values;
63
61
 
64
62
  /**
@@ -82,7 +80,6 @@ export class PreviewComponent {
82
80
  * @protected
83
81
  */
84
82
  this._questionRenderer = questionRenderer;
85
- this._largeTitle = largeTitle;
86
83
  }
87
84
 
88
85
  /**
@@ -103,10 +100,9 @@ export class PreviewComponent {
103
100
  * @type {DefaultComponent}
104
101
  */
105
102
  get label() {
106
- const titleClass = this._largeTitle ? 'govuk-label--l' : 'govuk-label--m';
107
103
  return {
108
104
  text: this.titleText,
109
- classes: titleClass + this.getHighlight('question')
105
+ classes: 'govuk-label--l' + this.getHighlight('question')
110
106
  };
111
107
  }
112
108
 
@@ -115,11 +111,10 @@ export class PreviewComponent {
115
111
  * @type {GovukFieldset}
116
112
  */
117
113
  get fieldSet() {
118
- const titleClass = this._largeTitle ? 'govuk-fieldset__legend--l' : 'govuk-fieldset__legend--m';
119
114
  return {
120
115
  legend: {
121
116
  text: this.titleText,
122
- classes: titleClass + this.getHighlight('question')
117
+ classes: 'govuk-fieldset__legend--l' + this.getHighlight('question')
123
118
  }
124
119
  };
125
120
  }
@@ -1 +1 @@
1
- {"version":3,"file":"preview.js","names":["ComponentType","HIGHLIGHT_CLASS","PreviewComponent","PATH","componentType","Details","_questionTemplate","_highlight","_fieldName","_questionRenderer","_htmlElements","_highlighted","_largeTitle","constructor","htmlElements","questionRenderer","question","optional","largeTitle","values","_question","_optional","getHighlight","element","titleText","optionalText","label","titleClass","text","classes","fieldSet","legend","customRenderFields","_renderInput","id","name","renderInput","render","value","highlight","highlightContent","unHighlightContent"],"sources":["../../../../../src/form/form-editor/preview/preview.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { HIGHLIGHT_CLASS } from '~/src/form/form-editor/preview/constants.js'\n\n/**\n * @abstract\n */\nexport class PreviewComponent {\n static PATH = 'preview-components/'\n /**\n * @abstract\n * @type {ComponentType}\n */\n componentType = ComponentType.Details\n /**\n * @abstract\n * @type {string}\n * @protected\n */\n _questionTemplate = ''\n /**\n * @type { string|null }\n * @protected\n */\n _highlight = null\n /**\n * @abstract\n * @type {string}\n * @protected\n */\n _fieldName = ''\n /**\n * @type {QuestionRenderer}\n * @protected\n */\n _questionRenderer\n\n /**\n * @type {QuestionElements}\n * @protected\n */\n _htmlElements\n /**\n * @type {boolean}\n * @protected\n */\n _highlighted = false\n /**\n * @type {boolean}\n * @protected\n */\n _largeTitle = true\n\n /**\n * @param {QuestionElements} htmlElements\n * @param {QuestionRenderer} questionRenderer\n */\n constructor(htmlElements, questionRenderer) {\n const { question, optional, largeTitle } = htmlElements.values\n\n /**\n * @type {QuestionElements}\n * @protected\n */\n this._htmlElements = htmlElements\n /**\n * @type {string}\n * @private\n */\n this._question = question\n /**\n * @type {boolean}\n * @private\n */\n this._optional = optional\n /**\n *\n * @type {QuestionRenderer}\n * @protected\n */\n this._questionRenderer = questionRenderer\n this._largeTitle = largeTitle\n }\n\n /**\n * @param {string} element\n * @returns {string}\n * @protected\n */\n getHighlight(element) {\n return this._highlight === element ? ' highlight' : ''\n }\n\n get titleText() {\n const optionalText = this._optional ? ' (optional)' : ''\n return (!this._question ? 'Question' : this._question) + optionalText\n }\n\n /**\n * @protected\n * @type {DefaultComponent}\n */\n get label() {\n const titleClass = this._largeTitle ? 'govuk-label--l' : 'govuk-label--m'\n\n return {\n text: this.titleText,\n classes: titleClass + this.getHighlight('question')\n }\n }\n\n /**\n * @protected\n * @type {GovukFieldset}\n */\n get fieldSet() {\n const titleClass = this._largeTitle\n ? 'govuk-fieldset__legend--l'\n : 'govuk-fieldset__legend--m'\n\n return {\n legend: {\n text: this.titleText,\n classes: titleClass + this.getHighlight('question')\n }\n }\n }\n\n /**\n * @returns {Partial<QuestionBaseModel>}\n */\n get customRenderFields() {\n return {}\n }\n\n /**\n *\n * @returns {QuestionBaseModel}\n * @protected\n */\n _renderInput() {\n return {\n id: this._fieldName,\n name: this._fieldName,\n classes: this._highlighted ? HIGHLIGHT_CLASS : ''\n }\n }\n\n /**\n * @type {QuestionBaseModel}\n */\n get renderInput() {\n return {\n ...this._renderInput(),\n ...this.customRenderFields\n }\n }\n\n render() {\n this._questionRenderer.render(this._questionTemplate, this.renderInput)\n }\n\n /**\n * @type {string}\n */\n get question() {\n return this._question\n }\n\n /**\n * @param {string} value\n */\n set question(value) {\n this._question = value\n this.render()\n }\n\n get optional() {\n return this._optional\n }\n\n /**\n * @param {boolean} value\n */\n set optional(value) {\n this._optional = value\n this.render()\n }\n\n /**\n * @type {string | null}\n */\n get highlight() {\n return this._highlight\n }\n\n /**\n * @param {string | null} value\n */\n set highlight(value) {\n this._highlight = value\n this.render()\n }\n\n /**\n * no render\n */\n highlightContent() {\n this._highlighted = true\n }\n\n /**\n * no render\n */\n unHighlightContent() {\n this._highlighted = false\n }\n}\n\n/**\n * @import { ListenerRow, BaseSettings, QuestionElements, QuestionBaseModel, GovukFieldset, DefaultComponent, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { FormComponentsDef, ContentComponentsDef, ComponentDef } from '~/src/components/types.js'\n * @import { ListElement, ListItemReadonly } from '~/src/form/form-editor/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,eAAe;;AAExB;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,CAAC;EAC5B,OAAOC,IAAI,GAAG,qBAAqB;EACnC;AACF;AACA;AACA;EACEC,aAAa,GAAGJ,aAAa,CAACK,OAAO;EACrC;AACF;AACA;AACA;AACA;EACEC,iBAAiB,GAAG,EAAE;EACtB;AACF;AACA;AACA;EACEC,UAAU,GAAG,IAAI;EACjB;AACF;AACA;AACA;AACA;EACEC,UAAU,GAAG,EAAE;EACf;AACF;AACA;AACA;EACEC,iBAAiB;;EAEjB;AACF;AACA;AACA;EACEC,aAAa;EACb;AACF;AACA;AACA;EACEC,YAAY,GAAG,KAAK;EACpB;AACF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SAASA,CAACD,KAAK,EAAE;IACnB,IAAI,CAAC/B,UAAU,GAAG+B,KAAK;IACvB,IAAI,CAACD,MAAM,CAAC,CAAC;EACf;;EAEA;AACF;AACA;EACEG,gBAAgBA,CAAA,EAAG;IACjB,IAAI,CAAC7B,YAAY,GAAG,IAAI;EAC1B;;EAEA;AACF;AACA;EACE8B,kBAAkBA,CAAA,EAAG;IACnB,IAAI,CAAC9B,YAAY,GAAG,KAAK;EAC3B;AACF;;AAEA;AACA;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"preview.js","names":["ComponentType","HIGHLIGHT_CLASS","PreviewComponent","PATH","componentType","Details","_questionTemplate","_highlight","_fieldName","_questionRenderer","_htmlElements","_highlighted","constructor","htmlElements","questionRenderer","question","optional","values","_question","_optional","getHighlight","element","titleText","optionalText","label","text","classes","fieldSet","legend","customRenderFields","_renderInput","id","name","renderInput","render","value","highlight","highlightContent","unHighlightContent"],"sources":["../../../../../src/form/form-editor/preview/preview.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { HIGHLIGHT_CLASS } from '~/src/form/form-editor/preview/constants.js'\n\n/**\n * @abstract\n */\nexport class PreviewComponent {\n static PATH = 'preview-components/'\n /**\n * @abstract\n * @type {ComponentType}\n */\n componentType = ComponentType.Details\n /**\n * @abstract\n * @type {string}\n * @protected\n */\n _questionTemplate = ''\n /**\n * @type { string|null }\n * @protected\n */\n _highlight = null\n /**\n * @abstract\n * @type {string}\n * @protected\n */\n _fieldName = ''\n /**\n * @type {QuestionRenderer}\n * @protected\n */\n _questionRenderer\n\n /**\n * @type {QuestionElements}\n * @protected\n */\n _htmlElements\n /**\n * @type {boolean}\n * @protected\n */\n _highlighted = false\n /**\n * @type {boolean}\n * @protected\n */\n\n /**\n * @param {QuestionElements} htmlElements\n * @param {QuestionRenderer} questionRenderer\n */\n constructor(htmlElements, questionRenderer) {\n const { question, optional } = htmlElements.values\n\n /**\n * @type {QuestionElements}\n * @protected\n */\n this._htmlElements = htmlElements\n /**\n * @type {string}\n * @private\n */\n this._question = question\n /**\n * @type {boolean}\n * @private\n */\n this._optional = optional\n /**\n *\n * @type {QuestionRenderer}\n * @protected\n */\n this._questionRenderer = questionRenderer\n }\n\n /**\n * @param {string} element\n * @returns {string}\n * @protected\n */\n getHighlight(element) {\n return this._highlight === element ? ' highlight' : ''\n }\n\n get titleText() {\n const optionalText = this._optional ? ' (optional)' : ''\n return (!this._question ? 'Question' : this._question) + optionalText\n }\n\n /**\n * @protected\n * @type {DefaultComponent}\n */\n get label() {\n return {\n text: this.titleText,\n classes: 'govuk-label--l' + this.getHighlight('question')\n }\n }\n\n /**\n * @protected\n * @type {GovukFieldset}\n */\n get fieldSet() {\n return {\n legend: {\n text: this.titleText,\n classes: 'govuk-fieldset__legend--l' + this.getHighlight('question')\n }\n }\n }\n\n /**\n * @returns {Partial<QuestionBaseModel>}\n */\n get customRenderFields() {\n return {}\n }\n\n /**\n *\n * @returns {QuestionBaseModel}\n * @protected\n */\n _renderInput() {\n return {\n id: this._fieldName,\n name: this._fieldName,\n classes: this._highlighted ? HIGHLIGHT_CLASS : ''\n }\n }\n\n /**\n * @type {QuestionBaseModel}\n */\n get renderInput() {\n return {\n ...this._renderInput(),\n ...this.customRenderFields\n }\n }\n\n render() {\n this._questionRenderer.render(this._questionTemplate, this.renderInput)\n }\n\n /**\n * @type {string}\n */\n get question() {\n return this._question\n }\n\n /**\n * @param {string} value\n */\n set question(value) {\n this._question = value\n this.render()\n }\n\n get optional() {\n return this._optional\n }\n\n /**\n * @param {boolean} value\n */\n set optional(value) {\n this._optional = value\n this.render()\n }\n\n /**\n * @type {string | null}\n */\n get highlight() {\n return this._highlight\n }\n\n /**\n * @param {string | null} value\n */\n set highlight(value) {\n this._highlight = value\n this.render()\n }\n\n /**\n * no render\n */\n highlightContent() {\n this._highlighted = true\n }\n\n /**\n * no render\n */\n unHighlightContent() {\n this._highlighted = false\n }\n}\n\n/**\n * @import { ListenerRow, BaseSettings, QuestionElements, QuestionBaseModel, GovukFieldset, DefaultComponent, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { FormComponentsDef, ContentComponentsDef, ComponentDef } from '~/src/components/types.js'\n * @import { ListElement, ListItemReadonly } from '~/src/form/form-editor/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,eAAe;;AAExB;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,CAAC;EAC5B,OAAOC,IAAI,GAAG,qBAAqB;EACnC;AACF;AACA;AACA;EACEC,aAAa,GAAGJ,aAAa,CAACK,OAAO;EACrC;AACF;AACA;AACA;AACA;EACEC,iBAAiB,GAAG,EAAE;EACtB;AACF;AACA;AACA;EACEC,UAAU,GAAG,IAAI;EACjB;AACF;AACA;AACA;AACA;EACEC,UAAU,GAAG,EAAE;EACf;AACF;AACA;AACA;EACEC,iBAAiB;;EAEjB;AACF;AACA;AACA;EACEC,aAAa;EACb;AACF;AACA;AACA;EACEC,YAAY,GAAG,KAAK;EACpB;AACF;AACA;AACA;;EAEE;AACF;AACA;AACA;EACEC,WAAWA,CAACC,YAAY,EAAEC,gBAAgB,EAAE;IAC1C,MAAM;MAAEC,QAAQ;MAAEC;IAAS,CAAC,GAAGH,YAAY,CAACI,MAAM;;IAElD;AACJ;AACA;AACA;IACI,IAAI,CAACP,aAAa,GAAGG,YAAY;IACjC;AACJ;AACA;AACA;IACI,IAAI,CAACK,SAAS,GAAGH,QAAQ;IACzB;AACJ;AACA;AACA;IACI,IAAI,CAACI,SAAS,GAAGH,QAAQ;IACzB;AACJ;AACA;AACA;AACA;IACI,IAAI,CAACP,iBAAiB,GAAGK,gBAAgB;EAC3C;;EAEA;AACF;AACA;AACA;AACA;EACEM,YAAYA,CAACC,OAAO,EAAE;IACpB,OAAO,IAAI,CAACd,UAAU,KAAKc,OAAO,GAAG,YAAY,GAAG,EAAE;EACxD;EAEA,IAAIC,SAASA,CAAA,EAAG;IACd,MAAMC,YAAY,GAAG,IAAI,CAACJ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I,CAACjB,SAAS,GAAGiB,KAAK;IACtB,IAAI,CAACD,MAAM,CAAC,CAAC;EACf;EAEA,IAAIlB,QAAQA,CAAA,EAAG;IACb,OAAO,IAAI,CAACG,SAAS;EACvB;;EAEA;AACF;AACA;EACE,IAAIH,QAAQA,CAACmB,KAAK,EAAE;IAClB,IAAI,CAAChB,SAAS,GAAGgB,KAAK;IACtB,IAAI,CAACD,MAAM,CAAC,CAAC;EACf;;EAEA;AACF;AACA;EACE,IAAIE,SAASA,CAAA,EAAG;IACd,OAAO,IAAI,CAAC7B,UAAU;EACxB;;EAEA;AACF;AACA;EACE,IAAI6B,SAASA,CAACD,KAAK,EAAE;IACnB,IAAI,CAAC5B,UAAU,GAAG4B,KAAK;IACvB,IAAI,CAACD,MAAM,CAAC,CAAC;EACf;;EAEA;AACF;AACA;EACEG,gBAAgBA,CAAA,EAAG;IACjB,IAAI,CAAC1B,YAAY,GAAG,IAAI;EAC1B;;EAEA;AACF;AACA;EACE2B,kBAAkBA,CAAA,EAAG;IACnB,IAAI,CAAC3B,YAAY,GAAG,KAAK;EAC3B;AACF;;AAEA;AACA;AACA;AACA;AACA","ignoreList":[]}
@@ -14,8 +14,8 @@ export class QuestionComponentElements extends ComponentElements {
14
14
  /**
15
15
  * @param {FormComponentsDef} component
16
16
  */
17
- constructor(component, largeTitle = true) {
18
- super(component, largeTitle);
17
+ constructor(component) {
18
+ super(component);
19
19
  this._component = component;
20
20
  }
21
21
 
@@ -1 +1 @@
1
- {"version":3,"file":"question.js","names":["ComponentType","ComponentElements","PreviewComponent","QuestionComponentElements","_component","constructor","component","largeTitle","_getValues","hintText","hint","shortDesc","shortDescription","Question","componentType","TextField","_questionTemplate","PATH","_fieldName","htmlElements","questionRenderer","values","_hintText","text","_highlight","length","classes","getHighlight","_renderInput","label","value","render"],"sources":["../../../../../src/form/form-editor/preview/question.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { ComponentElements } from '~/src/form/form-editor/preview/component-elements.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n\n/**\n * @implements {QuestionElements}\n */\nexport class QuestionComponentElements extends ComponentElements {\n /**\n * @type {FormComponentsDef}\n * @protected\n */\n _component\n /**\n * @param {FormComponentsDef} component\n */\n constructor(component, largeTitle = true) {\n super(component, largeTitle)\n this._component = component\n }\n\n /**\n * @protected\n * @returns {BaseSettings}\n */\n _getValues() {\n return {\n ...super._getValues(),\n hintText: this._component.hint ?? '',\n shortDesc: this._component.shortDescription ?? ''\n }\n }\n}\n\n/**\n * @class Question\n * @classdesc\n * A data object that has access to the underlying data via the QuestionElements object interface\n * and the templating mechanism to render the HTML for the data.\n *\n * It does not have access to the DOM, but has access to QuestionElements.setPreviewHTML to update\n * the HTML. Question classes should only be responsible for data and rendering as are reused in the\n * server side.\n */\nexport class Question extends PreviewComponent {\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.TextField\n\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = PreviewComponent.PATH + 'textfield.njk'\n /**\n * @type {string}\n * @protected\n */\n _fieldName = 'inputField'\n\n /**\n * @param {QuestionElements} htmlElements\n * @param {QuestionRenderer} questionRenderer\n */\n constructor(htmlElements, questionRenderer) {\n super(htmlElements, questionRenderer)\n const { hintText } = htmlElements.values\n /**\n * @type {string}\n * @private\n */\n this._hintText = hintText\n }\n\n /**\n * @type {DefaultComponent}\n * @protected\n */\n get hint() {\n const text =\n this._highlight === 'hintText' && !this._hintText.length\n ? 'Hint text'\n : this._hintText\n\n return {\n text,\n classes: this.getHighlight('hintText')\n }\n }\n\n /**\n * @returns {QuestionBaseModel}\n * @protected\n */\n _renderInput() {\n return { ...super._renderInput(), label: this.label, hint: this.hint }\n }\n\n /**\n * @type {string}\n */\n get hintText() {\n return this._hintText\n }\n\n /**\n * @param {string} value\n */\n set hintText(value) {\n this._hintText = value\n this.render()\n }\n}\n\n/**\n * @import { ListenerRow, BaseSettings, QuestionElements, QuestionBaseModel, GovukFieldset, DefaultComponent, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { FormComponentsDef, ContentComponentsDef, ComponentDef } from '~/src/components/types.js'\n * @import { ListElement, ListItemReadonly } from '~/src/form/form-editor/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,iBAAiB;AAC1B,SAASC,gBAAgB;;AAEzB;AACA;AACA;AACA,OAAO,MAAMC,yBAAyB,SAASF,iBAAiB,CAAC;EAC/D;AACF;AACA;AACA;EACEG,UAAU;EACV;AACF;AACA;EACEC,WAAWA,CAACC,SAAS,EAAEC,UAAU,GAAG,IAAI,EAAE;IACxC,KAAK,CAACD,SAAS,EAAEC,UAAU,CAAC;IAC5B,IAAI,CAACH,UAAU,GAAGE,SAAS;EAC7B;;EAEA;AACF;AACA;AACA;EACEE,UAAUA,CAAA,EAAG;IACX,OAAO;MACL,GAAG,KAAK,CAACA,UAAU,CAAC,CAAC;MACrBC,QAAQ,EAAE,IAAI,CAACL,UAAU,CAACM,IAAI,IAAI,EAAE;MACpCC,SAAS,EAAE,IAAI,CAACP,UAAU,CAACQ,gBAAgB,IAAI;IACjD,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,QAAQ,SAASX,gBAAgB,CAAC;EAC7C;AACF;AACA;EACEY,aAAa,GAAGd,aAAa,CAACe,SAAS;;EAEvC;AACF;AACA;AACA;EACEC,iBAAiB,GAAGd,gBAAgB,CAACe,IAAI,GAAG,eAAe;EAC3D;AACF;AACA;AACA;EACEC,UAAU,GAAG,YAAY;;EAEzB;AACF;AACA;AACA;EACEb,WAAWA,CAACc,YAAY,EAAEC,gBAAgB,EAAE;IAC1C,KAAK,CAACD,YAAY,EAAEC,gBAAgB,CAAC;IACrC,MAAM;MAAEX;IAAS,CAAC,GAAGU,YAAY,CAACE,MAAM;IACxC;AACJ;AACA;AACA;IACI,IAAI,CAACC,SAAS,GAAGb,QAAQ;EAC3B;;EAEA;AACF;AACA;AACA;EACE,IAAIC,IAAIA,CAAA,EAAG;IACT,MAAMa,IAAI,GACR,IAAI,CAACC,UAAU,KAAK,UAAU,IAAI,CAAC,IAAI,CAACF,SAAS,CAACG,MAAM,GACpD,WAAW,GACX,IAAI,CAACH,SAAS;IAEpB,OAAO;MACLC,IAAI;MACJG,OAAO,EAAE,IAAI,CAACC,YAAY,CAAC,UAAU;IACvC,CAAC;EACH;;EAEA;AACF;AACA;AACA;EACEC,YAAYA,CAAA,EAAG;IACb,OAAO;MAAE,GAAG,KAAK,CAACA,YAAY,CAAC,CAAC;MAAEC,KAAK,EAAE,IAAI,CAACA,KAAK;MAAEnB,IAAI,EAAE,IAAI,CAACA;IAAK,CAAC;EACxE;;EAEA;AACF;AACA;EACE,IAAID,QAAQA,CAAA,EAAG;IACb,OAAO,IAAI,CAACa,SAAS;EACvB;;EAEA;AACF;AACA;EACE,IAAIb,QAAQA,CAACqB,KAAK,EAAE;IAClB,IAAI,CAACR,SAAS,GAAGQ,KAAK;IACtB,IAAI,CAACC,MAAM,CAAC,CAAC;EACf;AACF;;AAEA;AACA;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"question.js","names":["ComponentType","ComponentElements","PreviewComponent","QuestionComponentElements","_component","constructor","component","_getValues","hintText","hint","shortDesc","shortDescription","Question","componentType","TextField","_questionTemplate","PATH","_fieldName","htmlElements","questionRenderer","values","_hintText","text","_highlight","length","classes","getHighlight","_renderInput","label","value","render"],"sources":["../../../../../src/form/form-editor/preview/question.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { ComponentElements } from '~/src/form/form-editor/preview/component-elements.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n\n/**\n * @implements {QuestionElements}\n */\nexport class QuestionComponentElements extends ComponentElements {\n /**\n * @type {FormComponentsDef}\n * @protected\n */\n _component\n /**\n * @param {FormComponentsDef} component\n */\n constructor(component) {\n super(component)\n this._component = component\n }\n\n /**\n * @protected\n * @returns {BaseSettings}\n */\n _getValues() {\n return {\n ...super._getValues(),\n hintText: this._component.hint ?? '',\n shortDesc: this._component.shortDescription ?? ''\n }\n }\n}\n\n/**\n * @class Question\n * @classdesc\n * A data object that has access to the underlying data via the QuestionElements object interface\n * and the templating mechanism to render the HTML for the data.\n *\n * It does not have access to the DOM, but has access to QuestionElements.setPreviewHTML to update\n * the HTML. Question classes should only be responsible for data and rendering as are reused in the\n * server side.\n */\nexport class Question extends PreviewComponent {\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.TextField\n\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = PreviewComponent.PATH + 'textfield.njk'\n /**\n * @type {string}\n * @protected\n */\n _fieldName = 'inputField'\n\n /**\n * @param {QuestionElements} htmlElements\n * @param {QuestionRenderer} questionRenderer\n */\n constructor(htmlElements, questionRenderer) {\n super(htmlElements, questionRenderer)\n const { hintText } = htmlElements.values\n /**\n * @type {string}\n * @private\n */\n this._hintText = hintText\n }\n\n /**\n * @type {DefaultComponent}\n * @protected\n */\n get hint() {\n const text =\n this._highlight === 'hintText' && !this._hintText.length\n ? 'Hint text'\n : this._hintText\n\n return {\n text,\n classes: this.getHighlight('hintText')\n }\n }\n\n /**\n * @returns {QuestionBaseModel}\n * @protected\n */\n _renderInput() {\n return { ...super._renderInput(), label: this.label, hint: this.hint }\n }\n\n /**\n * @type {string}\n */\n get hintText() {\n return this._hintText\n }\n\n /**\n * @param {string} value\n */\n set hintText(value) {\n this._hintText = value\n this.render()\n }\n}\n\n/**\n * @import { ListenerRow, BaseSettings, QuestionElements, QuestionBaseModel, GovukFieldset, DefaultComponent, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { FormComponentsDef, ContentComponentsDef, ComponentDef } from '~/src/components/types.js'\n * @import { ListElement, ListItemReadonly } from '~/src/form/form-editor/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,iBAAiB;AAC1B,SAASC,gBAAgB;;AAEzB;AACA;AACA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EAEA;AACF;AACA;AACA;EACEC,YAAYA,CAAA,EAAG;IACb,OAAO;MAAE,GAAG,KAAK,CAACA,YAAY,CAAC,CAAC;MAAEC,KAAK,EAAE,IAAI,CAACA,KAAK;MAAEnB,IAAI,EAAE,IAAI,CAACA;IAAK,CAAC;EACxE;;EAEA;AACF;AACA;EACE,IAAID,QAAQA,CAAA,EAAG;IACb,OAAO,IAAI,CAACa,SAAS;EACvB;;EAEA;AACF;AACA;EACE,IAAIb,QAAQA,CAACqB,KAAK,EAAE;IAClB,IAAI,CAACR,SAAS,GAAGQ,KAAK;IACtB,IAAI,CAACC,MAAM,CAAC,CAAC;EACf;AACF;;AAEA;AACA;AACA;AACA;AACA","ignoreList":[]}
@@ -16,7 +16,7 @@ export class SelectSortableQuestion extends ListSortableQuestion {
16
16
  */
17
17
  componentType = ComponentType.SelectField;
18
18
  get renderInput() {
19
- const afterInput = /** @type {{ formGroup?: { afterInputs: { html: string } } }} */
19
+ const afterInput = /** @type {{ formGroup?: { afterInput: { html: string }} }} */
20
20
  this.list.length ? {} : {
21
21
  formGroup: {
22
22
  afterInput: {
@@ -35,4 +35,8 @@ export class SelectSortableQuestion extends ListSortableQuestion {
35
35
  };
36
36
  }
37
37
  }
38
+
39
+ /**
40
+ * @import { FormGroupAfterInput } from '~/src/form/form-editor/macros/types.js'
41
+ */
38
42
  //# sourceMappingURL=select-sortable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"select-sortable.js","names":["ListSortableQuestion","PreviewComponent","ComponentType","SelectSortableQuestion","_questionTemplate","PATH","selectList","list","length","id","value","text","componentType","SelectField","renderInput","afterInput","formGroup","html","_listElements","afterInputsHTML","_fieldName","name","hint","label","items","classes"],"sources":["../../../../../src/form/form-editor/preview/select-sortable.js"],"sourcesContent":["import { ListSortableQuestion } from '~/src/form/form-editor/preview/list-sortable.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\nimport { ComponentType } from '~/src/index.js'\n\nexport class SelectSortableQuestion extends ListSortableQuestion {\n _questionTemplate = PreviewComponent.PATH + 'selectfield.njk'\n\n get selectList() {\n return this.list.length\n ? [{ id: '', value: '', text: ' ' }, ...this.list]\n : this.list\n }\n\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.SelectField\n\n get renderInput() {\n const afterInput =\n /** @type {{ formGroup?: { afterInputs: { html: string } } }} */ (\n this.list.length\n ? {}\n : {\n formGroup: {\n afterInput: {\n html: this._listElements.afterInputsHTML\n }\n }\n }\n )\n\n return {\n id: this._fieldName,\n name: this._fieldName,\n hint: this.hint,\n label: this.label,\n items: this.selectList,\n classes: this.list.length ? '' : 'govuk-visually-hidden',\n ...afterInput\n }\n }\n}\n"],"mappings":"AAAA,SAASA,oBAAoB;AAC7B,SAASC,gBAAgB;AACzB,SAASC,aAAa;AAEtB,OAAO,MAAMC,sBAAsB,SAASH,oBAAoB,CAAC;EAC/DI,iBAAiB,GAAGH,gBAAgB,CAACI,IAAI,GAAG,iBAAiB;EAE7D,IAAIC,UAAUA,CAAA,EAAG;IACf,OAAO,IAAI,CAACC,IAAI,CAACC,MAAM,GACnB,CAAC;MAAEC,EAAE,EAAE,EAAE;MAAEC,KAAK,EAAE,EAAE;MAAEC,IAAI,EAAE;IAAI,CAAC,EAAE,GAAG,IAAI,CAACJ,IAAI,CAAC,GAChD,IAAI,CAACA,IAAI;EACf;;EAEA;AACF;AACA;EACEK,aAAa,GAAGV,aAAa,CAACW,WAAW;EAEzC,IAAIC,WAAWA,CAAA,EAAG;IAChB,MAAMC,UAAU,GACd;IACE,IAAI,CAACR,IAAI,CAACC,MAAM,GACZ,CAAC,CAAC,GACF;MACEQ,SAAS,EAAE;QACTD,UAAU,EAAE;UACVE,IAAI,EAAE,IAAI,CAACC,aAAa,CAACC;QAC3B;MACF;IACF,CACL;IAEH,OAAO;MACLV,EAAE,EAAE,IAAI,CAACW,UAAU;MACnBC,IAAI,EAAE,IAAI,CAACD,UAAU;MACrBE,IAAI,EAAE,IAAI,CAACA,IAAI;MACfC,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBC,KAAK,EAAE,IAAI,CAAClB,UAAU;MACtBmB,OAAO,EAAE,IAAI,CAAClB,IAAI,CAACC,MAAM,GAAG,EAAE,GAAG,uBAAuB;MACxD,GAAGO;IACL,CAAC;EACH;AACF","ignoreList":[]}
1
+ {"version":3,"file":"select-sortable.js","names":["ListSortableQuestion","PreviewComponent","ComponentType","SelectSortableQuestion","_questionTemplate","PATH","selectList","list","length","id","value","text","componentType","SelectField","renderInput","afterInput","formGroup","html","_listElements","afterInputsHTML","_fieldName","name","hint","label","items","classes"],"sources":["../../../../../src/form/form-editor/preview/select-sortable.js"],"sourcesContent":["import { ListSortableQuestion } from '~/src/form/form-editor/preview/list-sortable.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\nimport { ComponentType } from '~/src/index.js'\n\nexport class SelectSortableQuestion extends ListSortableQuestion {\n _questionTemplate = PreviewComponent.PATH + 'selectfield.njk'\n\n get selectList() {\n return this.list.length\n ? [{ id: '', value: '', text: ' ' }, ...this.list]\n : this.list\n }\n\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.SelectField\n\n get renderInput() {\n const afterInput =\n /** @type {{ formGroup?: { afterInput: { html: string }} }} */ (\n this.list.length\n ? {}\n : {\n formGroup: {\n afterInput: {\n html: this._listElements.afterInputsHTML\n }\n }\n }\n )\n\n return {\n id: this._fieldName,\n name: this._fieldName,\n hint: this.hint,\n label: this.label,\n items: this.selectList,\n classes: this.list.length ? '' : 'govuk-visually-hidden',\n ...afterInput\n }\n }\n}\n\n/**\n * @import { FormGroupAfterInput } from '~/src/form/form-editor/macros/types.js'\n */\n"],"mappings":"AAAA,SAASA,oBAAoB;AAC7B,SAASC,gBAAgB;AACzB,SAASC,aAAa;AAEtB,OAAO,MAAMC,sBAAsB,SAASH,oBAAoB,CAAC;EAC/DI,iBAAiB,GAAGH,gBAAgB,CAACI,IAAI,GAAG,iBAAiB;EAE7D,IAAIC,UAAUA,CAAA,EAAG;IACf,OAAO,IAAI,CAACC,IAAI,CAACC,MAAM,GACnB,CAAC;MAAEC,EAAE,EAAE,EAAE;MAAEC,KAAK,EAAE,EAAE;MAAEC,IAAI,EAAE;IAAI,CAAC,EAAE,GAAG,IAAI,CAACJ,IAAI,CAAC,GAChD,IAAI,CAACA,IAAI;EACf;;EAEA;AACF;AACA;EACEK,aAAa,GAAGV,aAAa,CAACW,WAAW;EAEzC,IAAIC,WAAWA,CAAA,EAAG;IAChB,MAAMC,UAAU,GACd;IACE,IAAI,CAACR,IAAI,CAACC,MAAM,GACZ,CAAC,CAAC,GACF;MACEQ,SAAS,EAAE;QACTD,UAAU,EAAE;UACVE,IAAI,EAAE,IAAI,CAACC,aAAa,CAACC;QAC3B;MACF;IACF,CACL;IAEH,OAAO;MACLV,EAAE,EAAE,IAAI,CAACW,UAAU;MACnBC,IAAI,EAAE,IAAI,CAACD,UAAU;MACrBE,IAAI,EAAE,IAAI,CAACA,IAAI;MACfC,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBC,KAAK,EAAE,IAAI,CAAClB,UAAU;MACtBmB,OAAO,EAAE,IAAI,CAAClB,IAAI,CAACC,MAAM,GAAG,EAAE,GAAG,uBAAuB;MACxD,GAAGO;IACL,CAAC;EACH;AACF;;AAEA;AACA;AACA","ignoreList":[]}
@@ -3,9 +3,41 @@ import { ListQuestion } from "./list.js";
3
3
  import { PreviewComponent } from "./preview.js";
4
4
  export class SelectQuestion extends ListQuestion {
5
5
  _questionTemplate = PreviewComponent.PATH + 'selectfield.njk';
6
+ _fieldName = 'selectInput';
6
7
  /**
7
8
  * @type {ComponentType}
8
9
  */
9
10
  componentType = ComponentType.SelectField;
11
+
12
+ /**
13
+ * @returns {ListItemReadonly[]}
14
+ */
15
+ get list() {
16
+ return this._getList();
17
+ }
18
+ get renderInput() {
19
+ const afterInput = /** @type {{ formGroup?: { afterInput: { html: string }} }} */
20
+ this.list.length ? {} : {
21
+ formGroup: {
22
+ afterInput: {
23
+ html: this._listElements.afterInputsHTML
24
+ }
25
+ }
26
+ };
27
+ return {
28
+ id: this._fieldName,
29
+ name: this._fieldName,
30
+ hint: this.hint,
31
+ label: this.label,
32
+ items: this.list,
33
+ classes: this.list.length ? '' : 'govuk-visually-hidden',
34
+ ...afterInput
35
+ };
36
+ }
10
37
  }
38
+
39
+ /**
40
+ * @import { ListItemReadonly } from '~/src/form/form-editor/types.js'
41
+ * @import { FormGroupAfterInput } from '~/src/form/form-editor/macros/types.js'
42
+ */
11
43
  //# sourceMappingURL=select.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"select.js","names":["ComponentType","ListQuestion","PreviewComponent","SelectQuestion","_questionTemplate","PATH","componentType","SelectField"],"sources":["../../../../../src/form/form-editor/preview/select.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { ListQuestion } from '~/src/form/form-editor/preview/list.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n\nexport class SelectQuestion extends ListQuestion {\n _questionTemplate = PreviewComponent.PATH + 'selectfield.njk'\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.SelectField\n}\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,YAAY;AACrB,SAASC,gBAAgB;AAEzB,OAAO,MAAMC,cAAc,SAASF,YAAY,CAAC;EAC/CG,iBAAiB,GAAGF,gBAAgB,CAACG,IAAI,GAAG,iBAAiB;EAC7D;AACF;AACA;EACEC,aAAa,GAAGN,aAAa,CAACO,WAAW;AAC3C","ignoreList":[]}
1
+ {"version":3,"file":"select.js","names":["ComponentType","ListQuestion","PreviewComponent","SelectQuestion","_questionTemplate","PATH","_fieldName","componentType","SelectField","list","_getList","renderInput","afterInput","length","formGroup","html","_listElements","afterInputsHTML","id","name","hint","label","items","classes"],"sources":["../../../../../src/form/form-editor/preview/select.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { ListQuestion } from '~/src/form/form-editor/preview/list.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n\nexport class SelectQuestion extends ListQuestion {\n _questionTemplate = PreviewComponent.PATH + 'selectfield.njk'\n _fieldName = 'selectInput'\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.SelectField\n\n /**\n * @returns {ListItemReadonly[]}\n */\n get list() {\n return this._getList()\n }\n\n get renderInput() {\n const afterInput =\n /** @type {{ formGroup?: { afterInput: { html: string }} }} */ (\n this.list.length\n ? {}\n : {\n formGroup: {\n afterInput: {\n html: this._listElements.afterInputsHTML\n }\n }\n }\n )\n\n return {\n id: this._fieldName,\n name: this._fieldName,\n hint: this.hint,\n label: this.label,\n items: this.list,\n classes: this.list.length ? '' : 'govuk-visually-hidden',\n ...afterInput\n }\n }\n}\n\n/**\n * @import { ListItemReadonly } from '~/src/form/form-editor/types.js'\n * @import { FormGroupAfterInput } from '~/src/form/form-editor/macros/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,YAAY;AACrB,SAASC,gBAAgB;AAEzB,OAAO,MAAMC,cAAc,SAASF,YAAY,CAAC;EAC/CG,iBAAiB,GAAGF,gBAAgB,CAACG,IAAI,GAAG,iBAAiB;EAC7DC,UAAU,GAAG,aAAa;EAC1B;AACF;AACA;EACEC,aAAa,GAAGP,aAAa,CAACQ,WAAW;;EAEzC;AACF;AACA;EACE,IAAIC,IAAIA,CAAA,EAAG;IACT,OAAO,IAAI,CAACC,QAAQ,CAAC,CAAC;EACxB;EAEA,IAAIC,WAAWA,CAAA,EAAG;IAChB,MAAMC,UAAU,GACd;IACE,IAAI,CAACH,IAAI,CAACI,MAAM,GACZ,CAAC,CAAC,GACF;MACEC,SAAS,EAAE;QACTF,UAAU,EAAE;UACVG,IAAI,EAAE,IAAI,CAACC,aAAa,CAACC;QAC3B;MACF;IACF,CACL;IAEH,OAAO;MACLC,EAAE,EAAE,IAAI,CAACZ,UAAU;MACnBa,IAAI,EAAE,IAAI,CAACb,UAAU;MACrBc,IAAI,EAAE,IAAI,CAACA,IAAI;MACfC,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBC,KAAK,EAAE,IAAI,CAACb,IAAI;MAChBc,OAAO,EAAE,IAAI,CAACd,IAAI,CAACI,MAAM,GAAG,EAAE,GAAG,uBAAuB;MACxD,GAAGD;IACL,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA","ignoreList":[]}
@@ -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 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":[]}
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 attributes?: Record<string, 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 DomElementsBase {\n readonly values?: BaseSettings\n autocompleteOptions?: string\n setPreviewHTML(value: string): void\n setPreviewDOM(element: HTMLElement): void\n}\n\nexport interface QuestionElements extends DomElementsBase {\n readonly values: BaseSettings\n}\n\nexport interface AutocompleteElements extends QuestionElements {\n autocompleteOptions: string\n}\n\nexport interface RenderBase {\n render(questionTemplate: string, renderContext: RenderContext): void\n}\n\nexport interface QuestionRenderContext {\n model: QuestionBaseModel\n}\n\nexport interface PageRenderContext {\n params: PagePreviewPanelMacro\n}\n\nexport type RenderContext = QuestionRenderContext | PageRenderContext\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 type Renderer = QuestionRenderer | PageRenderer\n\nexport interface ListElements extends QuestionElements {\n afterInputsHTML: string\n}\n\nexport interface PageOverviewElements {\n heading: string\n guidance: string\n addHeading: boolean\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":[]}
@@ -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.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stubs.js","names":["buildList","buildListItem","buildCheckboxComponent","buildRadioComponent","buildAutoCompleteComponent","buildFileUploadComponent","buildTextFieldComponent","buildRepeaterPage","buildFileUploadPage","buildSummaryPage","buildQuestionPage","buildMarkdownComponent"],"sources":["../../src/stubs.ts"],"sourcesContent":["export * from '~/src/__stubs__/form-definition.js'\nexport { buildList } from '~/src/__stubs__/components.js'\nexport { buildListItem } from '~/src/__stubs__/components.js'\nexport { buildCheckboxComponent } from '~/src/__stubs__/components.js'\nexport { buildRadioComponent } from '~/src/__stubs__/components.js'\nexport { buildAutoCompleteComponent } from '~/src/__stubs__/components.js'\nexport { buildFileUploadComponent } from '~/src/__stubs__/components.js'\nexport { buildTextFieldComponent } from '~/src/__stubs__/components.js'\nexport { buildRepeaterPage } from '~/src/__stubs__/pages.js'\nexport { buildFileUploadPage } from '~/src/__stubs__/pages.js'\nexport { buildSummaryPage } from '~/src/__stubs__/pages.js'\nexport { buildQuestionPage } from '~/src/__stubs__/pages.js'\nexport { buildMarkdownComponent } from '~/src/__stubs__/components.js'\n"],"mappings":"AAAA;AACA,SAASA,SAAS;AAClB,SAASC,aAAa;AACtB,SAASC,sBAAsB;AAC/B,SAASC,mBAAmB;AAC5B,SAASC,0BAA0B;AACnC,SAASC,wBAAwB;AACjC,SAASC,uBAAuB;AAChC,SAASC,iBAAiB;AAC1B,SAASC,mBAAmB;AAC5B,SAASC,gBAAgB;AACzB,SAASC,iBAAiB;AAC1B,SAASC,sBAAsB","ignoreList":[]}
1
+ {"version":3,"file":"stubs.js","names":["buildList","buildListItem","buildCheckboxComponent","buildRadioComponent","buildAutoCompleteComponent","buildFileUploadComponent","buildTextFieldComponent","buildRepeaterPage","buildFileUploadPage","buildSummaryPage","buildQuestionPage","buildMarkdownComponent","QuestionRendererStub","PageRendererStub","QuestionPreviewElements"],"sources":["../../src/stubs.ts"],"sourcesContent":["export * from '~/src/__stubs__/form-definition.js'\nexport { buildList } from '~/src/__stubs__/components.js'\nexport { buildListItem } from '~/src/__stubs__/components.js'\nexport { buildCheckboxComponent } from '~/src/__stubs__/components.js'\nexport { buildRadioComponent } from '~/src/__stubs__/components.js'\nexport { buildAutoCompleteComponent } from '~/src/__stubs__/components.js'\nexport { buildFileUploadComponent } from '~/src/__stubs__/components.js'\nexport { buildTextFieldComponent } from '~/src/__stubs__/components.js'\nexport { buildRepeaterPage } from '~/src/__stubs__/pages.js'\nexport { buildFileUploadPage } from '~/src/__stubs__/pages.js'\nexport { buildSummaryPage } from '~/src/__stubs__/pages.js'\nexport { buildQuestionPage } from '~/src/__stubs__/pages.js'\nexport { buildMarkdownComponent } from '~/src/__stubs__/components.js'\nexport { QuestionRendererStub } from '~/src/form/form-editor/__stubs__/preview.js'\nexport { PageRendererStub } from '~/src/form/form-editor/__stubs__/preview.js'\nexport { QuestionPreviewElements } from '~/src/form/form-editor/__stubs__/preview.js'\n"],"mappings":"AAAA;AACA,SAASA,SAAS;AAClB,SAASC,aAAa;AACtB,SAASC,sBAAsB;AAC/B,SAASC,mBAAmB;AAC5B,SAASC,0BAA0B;AACnC,SAASC,wBAAwB;AACjC,SAASC,uBAAuB;AAChC,SAASC,iBAAiB;AAC1B,SAASC,mBAAmB;AAC5B,SAASC,gBAAgB;AACzB,SAASC,iBAAiB;AAC1B,SAASC,sBAAsB;AAC/B,SAASC,oBAAoB;AAC7B,SAASC,gBAAgB;AACzB,SAASC,uBAAuB","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, largeTitle }: BaseSettings);
62
+ constructor({ question, hintText, optional, shortDesc, items, content }: BaseSettings);
63
63
  /**
64
64
  * @protected
65
65
  */
@@ -84,7 +84,6 @@ export class QuestionPreviewElements implements ListElements {
84
84
  * @private
85
85
  */
86
86
  private _items;
87
- _largeTitle: boolean;
88
87
  afterInputsHTML: string;
89
88
  /**
90
89
  * @returns {BaseSettings}
@@ -118,10 +117,12 @@ export class PagePreviewElements implements PageOverviewElements {
118
117
  /**
119
118
  * @param {string} heading
120
119
  * @param {string} guidance
120
+ * @param {boolean} [addHeading]
121
121
  */
122
- constructor(heading: string, guidance?: string);
122
+ constructor(heading: string, guidance?: string, addHeading?: boolean);
123
123
  guidance: string;
124
124
  heading: string;
125
+ addHeading: boolean;
125
126
  }
126
127
  export const baseElements: BaseSettings;
127
128
  export namespace listElementsStub {
@@ -1 +1 @@
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,MA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ACtD,uBAAgB,sCAAsC,CAAA;AACtD,uBAAgB,sCAAsC,CAAA;AACtD,uBAAgB,sCAAsC,CAAA;AAEtD,gCAAoC,YAAY,CA4B9C"}
1
+ {"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/__stubs__/preview.js"],"names":[],"mappings":"AAmOA;;;;GAIG;AACH,6DAJW,OAAO,CAAC,YAAY,CAAC,cACrB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,GAC1C,QAAQ,CAUpB;AA9OD;;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;IA2BE;;OAEG;IACH,yEAFW,YAAY,EAStB;IApCD;;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,wBAA2E;IAc3E;;OAEG;IACH,cAFa,YAAY,CAWxB;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;IAKE;;;;OAIG;IACH,qBAJW,MAAM,aACN,MAAM,eACN,OAAO,EAMjB;IAbD,iBAAQ;IACR,gBAAO;IACP,oBAAU;CAYX;AAED,2BAAuC,YAAY,CAQjD;;;;;;;;kCA+D8K,yCAAyC;uCAAzC,yCAAyC;yBArPhM,4CAA4C;sCAqP2G,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"}
@@ -24,20 +24,28 @@ export interface AppPreviewPanelTabsMacro {
24
24
  extraFields: GovukField[];
25
25
  basePageFields: GovukField[];
26
26
  }
27
+ export interface SelectAfterInput {
28
+ afterInput: {
29
+ html: string;
30
+ };
31
+ }
32
+ export interface RadioAndCheckboxAfterInputs {
33
+ afterInputs: {
34
+ html: string;
35
+ };
36
+ }
37
+ export type FormGroupAfterInput = SelectAfterInput | RadioAndCheckboxAfterInputs;
27
38
  export interface QuestionBaseModel {
28
39
  id?: string;
29
40
  name?: string;
30
41
  content?: string;
42
+ attributes?: Record<string, string>;
31
43
  label?: DefaultComponent;
32
44
  hint?: DefaultComponent;
33
45
  fieldset?: GovukFieldset;
34
46
  readonly items?: ListItemReadonly[] | DateItem[];
35
47
  text?: string;
36
- formGroup?: {
37
- afterInputs: {
38
- html: string;
39
- };
40
- };
48
+ formGroup?: FormGroupAfterInput;
41
49
  type?: 'text' | 'number' | 'boolean';
42
50
  classes?: string;
43
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/macros/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,gBAAgB,EACtB,MAAM,iCAAiC,CAAA;AACxC,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAE1E,MAAM,WAAW,sCAAsC;IACrD,sBAAsB,EAAE,EAAE,CAAA;IAC1B,UAAU,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAClD;AAED,MAAM,WAAW,yBAAyB;IACxC,cAAc,EAAE,sCAAsC,CAAA;IACtD,YAAY,EAAE;QACZ,WAAW,EAAE,UAAU,EAAE,CAAA;QACzB,cAAc,EAAE,UAAU,EAAE,CAAA;KAC7B,CAAA;IACD,YAAY,EAAE,aAAa,CAAA;CAC5B;AAED,MAAM,WAAW,wBAAwB;IACvC,YAAY,EAAE,aAAa,CAAA;IAC3B,cAAc,EAAE,MAAM,CAAA;IACtB,gBAAgB,EAAE,MAAM,CAAA;IACxB,cAAc,EAAE,sCAAsC,CAAA;IACtD,WAAW,EAAE,UAAU,EAAE,CAAA;IACzB,cAAc,EAAE,UAAU,EAAE,CAAA;CAC7B;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KA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IACb,SAAS,CAAC,EAAE,mBAAmB,CAAA;IAC/B,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAA;IACpC,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,oBAAqB,SAAQ,wBAAwB;IACpE,KAAK,EAAE,iBAAiB,CAAA;CACzB;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,iBAAiB,CAAA;IACxB,YAAY,EAAE,aAAa,CAAA;CAC5B;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,SAAS,EAAE;QAClB,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;IACD,QAAQ,CAAC,QAAQ,EAAE;QACjB,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;IACD,QAAQ,CAAC,UAAU,EAAE,oBAAoB,EAAE,CAAA;CAC5C"}
@@ -1 +1 @@
1
- {"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/autocomplete.js"],"names":[],"mappings":"AAKA;CAoBC;AAED;IAME;;;OAGG;IACH,kCAHW,oBAAoB,oBACpB,gBAAgB,EAK1B;IAZD;;;OAGG;IACH,0BAAsB;IAUtB,sCAEC;IAED;;OAEG;IACH,8BAFW,MAAM,QAkBhB;IAED;;;;;;;;;MASC;CACF;yBA1EwB,4CAA4C;iCA8ErC,iCAAiC;0CACa,yCAAyC;sCAAzC,yCAAyC"}
1
+ {"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/autocomplete.js"],"names":[],"mappings":"AAKA;CAqBC;AAED;IAME;;;OAGG;IACH,kCAHW,oBAAoB,oBACpB,gBAAgB,EAK1B;IAZD;;;OAGG;IACH,0BAAsB;IAUtB,sCAEC;IAED;;OAEG;IACH,8BAFW,MAAM,QAkBhB;IAED;;;;;;;;;MASC;CACF;yBA3EwB,4CAA4C;iCA+ErC,iCAAiC;0CACa,yCAAyC;sCAAzC,yCAAyC"}
@@ -4,19 +4,13 @@
4
4
  export class ComponentElements implements QuestionElements {
5
5
  /**
6
6
  * @param {ComponentDef} component
7
- * @param {boolean} [largeTitle]
8
7
  */
9
- constructor(component: ComponentDef, largeTitle?: boolean);
8
+ constructor(component: ComponentDef);
10
9
  /**
11
10
  * @type {ComponentDef}
12
11
  * @protected
13
12
  */
14
13
  protected _component: ComponentDef;
15
- /**
16
- * @type {boolean}
17
- * @private
18
- */
19
- private _largeTitle;
20
14
  /**
21
15
  * @protected
22
16
  * @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;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"}
1
+ {"version":3,"file":"component-elements.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/component-elements.js"],"names":[],"mappings":"AAAA;;GAEG;AACH;IAME;;OAEG;IACH,uBAFW,YAAY,EAItB;IAVD;;;OAGG;IACH,sBAHU,YAAY,CAGZ;IAQV;;;OAGG;IACH,wBAFa,YAAY,CAaxB;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,9 +4,8 @@
4
4
  export class ContentElements extends ComponentElements implements QuestionElements {
5
5
  /**
6
6
  * @param {Exclude<ContentComponentsDef, ListComponent>} component
7
- * @param {boolean} largeTitle
8
7
  */
9
- constructor(component: Exclude<ContentComponentsDef, ListComponent>, largeTitle?: boolean);
8
+ constructor(component: Exclude<ContentComponentsDef, ListComponent>);
10
9
  /**
11
10
  * @type {Exclude<ContentComponentsDef, ListComponent>}
12
11
  * @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;;;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"}
1
+ {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/content.js"],"names":[],"mappings":"AAGA;;GAEG;AACH;IAME;;OAEG;IACH,uBAFW,OAAO,CAAC,oBAAoB,EAAE,aAAa,CAAC,EAKtD;IAXD;;;OAGG;IACH,sBAHU,OAAO,CAAC,oBAAoB,EAAE,aAAa,CAAC,CAG5C;CAmBX;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;kCAzF7I,sDAAsD;0CA0FC,2BAA2B;mCAA3B,2BAA2B;iCAzFnF,2CAA2C"}