@defra/forms-model 3.0.452 → 3.0.453

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 (52) hide show
  1. package/dist/module/form/form-editor/__stubs__/preview.js +43 -0
  2. package/dist/module/form/form-editor/__stubs__/preview.js.map +1 -1
  3. package/dist/module/form/form-editor/preview/checkbox-sortable.js +12 -0
  4. package/dist/module/form/form-editor/preview/checkbox-sortable.js.map +1 -0
  5. package/dist/module/form/form-editor/preview/date-input.js +2 -1
  6. package/dist/module/form/form-editor/preview/date-input.js.map +1 -1
  7. package/dist/module/form/form-editor/preview/email-address.js +1 -1
  8. package/dist/module/form/form-editor/preview/email-address.js.map +1 -1
  9. package/dist/module/form/form-editor/preview/index.js +1 -0
  10. package/dist/module/form/form-editor/preview/index.js.map +1 -1
  11. package/dist/module/form/form-editor/preview/long-answer.js +1 -1
  12. package/dist/module/form/form-editor/preview/long-answer.js.map +1 -1
  13. package/dist/module/form/form-editor/preview/month-year.js +2 -1
  14. package/dist/module/form/form-editor/preview/month-year.js.map +1 -1
  15. package/dist/module/form/form-editor/preview/phone-number.js +1 -1
  16. package/dist/module/form/form-editor/preview/phone-number.js.map +1 -1
  17. package/dist/module/form/form-editor/preview/question.js +3 -1
  18. package/dist/module/form/form-editor/preview/question.js.map +1 -1
  19. package/dist/module/form/form-editor/preview/radio-sortable.js +2 -1
  20. package/dist/module/form/form-editor/preview/radio-sortable.js.map +1 -1
  21. package/dist/module/form/form-editor/preview/radio.js +2 -1
  22. package/dist/module/form/form-editor/preview/radio.js.map +1 -1
  23. package/dist/module/form/form-editor/preview/uk-address.js +2 -1
  24. package/dist/module/form/form-editor/preview/uk-address.js.map +1 -1
  25. package/dist/module/form/form-editor/preview/yes-no.js +2 -1
  26. package/dist/module/form/form-editor/preview/yes-no.js.map +1 -1
  27. package/dist/types/form/form-editor/__stubs__/preview.d.ts +13 -0
  28. package/dist/types/form/form-editor/__stubs__/preview.d.ts.map +1 -1
  29. package/dist/types/form/form-editor/preview/checkbox-sortable.d.ts +4 -0
  30. package/dist/types/form/form-editor/preview/checkbox-sortable.d.ts.map +1 -0
  31. package/dist/types/form/form-editor/preview/index.d.ts +1 -0
  32. package/dist/types/form/form-editor/preview/month-year.d.ts.map +1 -1
  33. package/dist/types/form/form-editor/preview/question.d.ts +1 -0
  34. package/dist/types/form/form-editor/preview/question.d.ts.map +1 -1
  35. package/dist/types/form/form-editor/preview/radio-sortable.d.ts.map +1 -1
  36. package/dist/types/form/form-editor/preview/radio.d.ts.map +1 -1
  37. package/dist/types/form/form-editor/preview/uk-address.d.ts.map +1 -1
  38. package/dist/types/form/form-editor/preview/yes-no.d.ts.map +1 -1
  39. package/package.json +1 -1
  40. package/src/form/form-editor/__stubs__/preview.js +43 -0
  41. package/src/form/form-editor/preview/checkbox-sortable.js +12 -0
  42. package/src/form/form-editor/preview/date-input.js +2 -2
  43. package/src/form/form-editor/preview/email-address.js +1 -1
  44. package/src/form/form-editor/preview/index.js +1 -0
  45. package/src/form/form-editor/preview/long-answer.js +1 -1
  46. package/src/form/form-editor/preview/month-year.js +2 -1
  47. package/src/form/form-editor/preview/phone-number.js +1 -1
  48. package/src/form/form-editor/preview/question.js +3 -1
  49. package/src/form/form-editor/preview/radio-sortable.js +2 -1
  50. package/src/form/form-editor/preview/radio.js +2 -1
  51. package/src/form/form-editor/preview/uk-address.js +2 -1
  52. package/src/form/form-editor/preview/yes-no.js +2 -1
@@ -97,6 +97,49 @@ export const baseElements = /** @type {BaseSettings} */{
97
97
  hintText: 'Choose one adventure that best suits you.',
98
98
  shortDesc: ''
99
99
  };
100
+ const list1Id = '414d82a3-4cab-416a-bd54-6b86fbd51120';
101
+ const list2Id = '801385a4-81e6-4171-96c3-6c6727d97f22';
102
+ const list3Id = 'e6e3f621-b875-4ca3-a054-cca9149149dd';
103
+ const list4Id = 'd71b3909-582f-4e90-b6f5-490b89a6eb8f';
104
+ const listElementsBase = /** @type {BaseSettings} */{
105
+ ...baseElements,
106
+ items: [{
107
+ label: {
108
+ text: 'Treasure Hunting'
109
+ },
110
+ text: 'Treasure Hunting',
111
+ value: 'Treasure Hunting',
112
+ id: list1Id
113
+ }, {
114
+ label: {
115
+ text: 'Rescuing the princess'
116
+ },
117
+ text: 'Rescuing the princess',
118
+ value: 'Rescuing the princess',
119
+ id: list2Id
120
+ }, {
121
+ label: {
122
+ text: 'Saving a city'
123
+ },
124
+ text: 'Saving a city',
125
+ value: 'Saving a city',
126
+ id: list3Id
127
+ }, {
128
+ label: {
129
+ text: 'Defeating the baron'
130
+ },
131
+ text: 'Defeating the baron',
132
+ value: 'Defeating the baron',
133
+ id: list4Id
134
+ }]
135
+ };
136
+ export const listElementsStub = {
137
+ list1Id,
138
+ list2Id,
139
+ list3Id,
140
+ list4Id,
141
+ baseElements: listElementsBase
142
+ };
100
143
 
101
144
  /**
102
145
  * @import { ListElement } from '~/src/form/form-editor/types.js'
@@ -1 +1 @@
1
- {"version":3,"file":"preview.js","names":["QuestionRendererStub","renderMock","constructor","render","questionTemplate","questionBaseModel","buildHTML","_questionTemplate","_renderContext","QuestionPreviewElements","_question","_hintText","_optional","_shortDesc","_items","afterInputsHTML","question","hintText","optional","shortDesc","items","values","setPreviewHTML","_value","baseElements"],"sources":["../../../../../src/form/form-editor/__stubs__/preview.js"],"sourcesContent":["/**\n * @implements {QuestionRenderer}\n */\nexport class QuestionRendererStub {\n /**\n * @type {jest.Mock<void, [string, QuestionBaseModel]>}\n */\n renderMock\n\n /**\n * @param {jest.Mock<void, [string, QuestionBaseModel]>} renderMock\n */\n constructor(renderMock) {\n this.renderMock = renderMock\n }\n\n /**\n * @param {string} questionTemplate\n * @param {QuestionBaseModel} questionBaseModel\n */\n render(questionTemplate, questionBaseModel) {\n this.renderMock(questionTemplate, questionBaseModel)\n }\n\n /**\n * @returns {string}\n * @param {string} _questionTemplate\n * @param {RenderContext} _renderContext\n */\n static buildHTML(_questionTemplate, _renderContext) {\n return '**** BUILT HTML ****'\n }\n}\n\n/**\n * @implements {ListElements}\n */\nexport class QuestionPreviewElements {\n /**\n * @protected\n */\n _question = ''\n /** @protected */\n _hintText = ''\n /** @protected */\n _optional = false\n /**\n * @type {string}\n * @protected\n */\n _shortDesc = ''\n /**\n *\n * @type {ListElement[]}\n * @private\n */\n _items = []\n\n afterInputsHTML = '<div class=\"govuk-inset-text\">No items added yet.</div>'\n\n /**\n * @param {BaseSettings} baseSettings\n */\n constructor({ question, hintText, optional, shortDesc, items }) {\n this._question = question\n this._hintText = hintText\n this._optional = optional\n this._shortDesc = shortDesc\n this._items = items\n }\n\n get values() {\n return {\n question: this._question,\n hintText: this._hintText,\n optional: this._optional,\n shortDesc: this._shortDesc,\n items: this._items\n }\n }\n\n /**\n * @param {string} _value\n */\n setPreviewHTML(_value) {\n // Not implemented for server side render\n }\n}\n\nexport const baseElements = /** @type {BaseSettings} */ ({\n items: [],\n optional: false,\n question: 'Which quest would you like to pick?',\n hintText: 'Choose one adventure that best suits you.',\n shortDesc: ''\n})\n\n/**\n * @import { ListElement } from '~/src/form/form-editor/types.js'\n * @import { BaseSettings, ListElements, RenderContext, QuestionBaseModel, QuestionElements, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,MAAMA,oBAAoB,CAAC;EAChC;AACF;AACA;EACEC,UAAU;;EAEV;AACF;AACA;EACEC,WAAWA,CAACD,UAAU,EAAE;IACtB,IAAI,CAACA,UAAU,GAAGA,UAAU;EAC9B;;EAEA;AACF;AACA;AACA;EACEE,MAAMA,CAACC,gBAAgB,EAAEC,iBAAiB,EAAE;IAC1C,IAAI,CAACJ,UAAU,CAACG,gBAAgB,EAAEC,iBAAiB,CAAC;EACtD;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAOC,SAASA,CAACC,iBAAiB,EAAEC,cAAc,EAAE;IAClD,OAAO,sBAAsB;EAC/B;AACF;;AAEA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,CAAC;EACnC;AACF;AACA;EACEC,SAAS,GAAG,EAAE;EACd;EACAC,SAAS,GAAG,EAAE;EACd;EACAC,SAAS,GAAG,KAAK;EACjB;AACF;AACA;AACA;EACEC,UAAU,GAAG,EAAE;EACf;AACF;AACA;AACA;AACA;EACEC,MAAM,GAAG,EAAE;EAEXC,eAAe,GAAG,yDAAyD;;EAE3E;AACF;AACA;EACEb,WAAWA,CAAC;IAAEc,QAAQ;IAAEC,QAAQ;IAAEC,QAAQ;IAAEC,SAAS;IAAEC;EAAM,CAAC,EAAE;IAC9D,IAAI,CAACV,SAAS,GAAGM,QAAQ;IACzB,IAAI,CAACL,SAAS,GAAGM,QAAQ;IACzB,IAAI,CAACL,SAAS,GAAGM,QAAQ;IACzB,IAAI,CAACL,UAAU,GAAGM,SAAS;IAC3B,IAAI,CAACL,MAAM,GAAGM,KAAK;EACrB;EAEA,IAAIC,MAAMA,CAAA,EAAG;IACX,OAAO;MACLL,QAAQ,EAAE,IAAI,CAACN,SAAS;MACxBO,QAAQ,EAAE,IAAI,CAACN,SAAS;MACxBO,QAAQ,EAAE,IAAI,CAACN,SAAS;MACxBO,SAAS,EAAE,IAAI,CAACN,UAAU;MAC1BO,KAAK,EAAE,IAAI,CAACN;IACd,CAAC;EACH;;EAEA;AACF;AACA;EACEQ,cAAcA,CAACC,MAAM,EAAE;IACrB;EAAA;AAEJ;AAEA,OAAO,MAAMC,YAAY,GAAG,2BAA6B;EACvDJ,KAAK,EAAE,EAAE;EACTF,QAAQ,EAAE,KAAK;EACfF,QAAQ,EAAE,qCAAqC;EAC/CC,QAAQ,EAAE,2CAA2C;EACrDE,SAAS,EAAE;AACb,CAAE;;AAEF;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"preview.js","names":["QuestionRendererStub","renderMock","constructor","render","questionTemplate","questionBaseModel","buildHTML","_questionTemplate","_renderContext","QuestionPreviewElements","_question","_hintText","_optional","_shortDesc","_items","afterInputsHTML","question","hintText","optional","shortDesc","items","values","setPreviewHTML","_value","baseElements","list1Id","list2Id","list3Id","list4Id","listElementsBase","label","text","value","id","listElementsStub"],"sources":["../../../../../src/form/form-editor/__stubs__/preview.js"],"sourcesContent":["/**\n * @implements {QuestionRenderer}\n */\nexport class QuestionRendererStub {\n /**\n * @type {jest.Mock<void, [string, QuestionBaseModel]>}\n */\n renderMock\n\n /**\n * @param {jest.Mock<void, [string, QuestionBaseModel]>} renderMock\n */\n constructor(renderMock) {\n this.renderMock = renderMock\n }\n\n /**\n * @param {string} questionTemplate\n * @param {QuestionBaseModel} questionBaseModel\n */\n render(questionTemplate, questionBaseModel) {\n this.renderMock(questionTemplate, questionBaseModel)\n }\n\n /**\n * @returns {string}\n * @param {string} _questionTemplate\n * @param {RenderContext} _renderContext\n */\n static buildHTML(_questionTemplate, _renderContext) {\n return '**** BUILT HTML ****'\n }\n}\n\n/**\n * @implements {ListElements}\n */\nexport class QuestionPreviewElements {\n /**\n * @protected\n */\n _question = ''\n /** @protected */\n _hintText = ''\n /** @protected */\n _optional = false\n /**\n * @type {string}\n * @protected\n */\n _shortDesc = ''\n /**\n *\n * @type {ListElement[]}\n * @private\n */\n _items = []\n\n afterInputsHTML = '<div class=\"govuk-inset-text\">No items added yet.</div>'\n\n /**\n * @param {BaseSettings} baseSettings\n */\n constructor({ question, hintText, optional, shortDesc, items }) {\n this._question = question\n this._hintText = hintText\n this._optional = optional\n this._shortDesc = shortDesc\n this._items = items\n }\n\n get values() {\n return {\n question: this._question,\n hintText: this._hintText,\n optional: this._optional,\n shortDesc: this._shortDesc,\n items: this._items\n }\n }\n\n /**\n * @param {string} _value\n */\n setPreviewHTML(_value) {\n // Not implemented for server side render\n }\n}\n\nexport const baseElements = /** @type {BaseSettings} */ ({\n items: [],\n optional: false,\n question: 'Which quest would you like to pick?',\n hintText: 'Choose one adventure that best suits you.',\n shortDesc: ''\n})\n\nconst list1Id = '414d82a3-4cab-416a-bd54-6b86fbd51120'\nconst list2Id = '801385a4-81e6-4171-96c3-6c6727d97f22'\nconst list3Id = 'e6e3f621-b875-4ca3-a054-cca9149149dd'\nconst list4Id = 'd71b3909-582f-4e90-b6f5-490b89a6eb8f'\n\nconst listElementsBase = /** @type {BaseSettings} */ ({\n ...baseElements,\n items: [\n {\n label: { text: 'Treasure Hunting' },\n text: 'Treasure Hunting',\n value: 'Treasure Hunting',\n id: list1Id\n },\n {\n label: { text: 'Rescuing the princess' },\n text: 'Rescuing the princess',\n value: 'Rescuing the princess',\n id: list2Id\n },\n {\n label: { text: 'Saving a city' },\n text: 'Saving a city',\n value: 'Saving a city',\n id: list3Id\n },\n {\n label: { text: 'Defeating the baron' },\n text: 'Defeating the baron',\n value: 'Defeating the baron',\n id: list4Id\n }\n ]\n})\n\nexport const listElementsStub = {\n list1Id,\n list2Id,\n list3Id,\n list4Id,\n baseElements: listElementsBase\n}\n\n/**\n * @import { ListElement } from '~/src/form/form-editor/types.js'\n * @import { BaseSettings, ListElements, RenderContext, QuestionBaseModel, QuestionElements, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,MAAMA,oBAAoB,CAAC;EAChC;AACF;AACA;EACEC,UAAU;;EAEV;AACF;AACA;EACEC,WAAWA,CAACD,UAAU,EAAE;IACtB,IAAI,CAACA,UAAU,GAAGA,UAAU;EAC9B;;EAEA;AACF;AACA;AACA;EACEE,MAAMA,CAACC,gBAAgB,EAAEC,iBAAiB,EAAE;IAC1C,IAAI,CAACJ,UAAU,CAACG,gBAAgB,EAAEC,iBAAiB,CAAC;EACtD;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAOC,SAASA,CAACC,iBAAiB,EAAEC,cAAc,EAAE;IAClD,OAAO,sBAAsB;EAC/B;AACF;;AAEA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,CAAC;EACnC;AACF;AACA;EACEC,SAAS,GAAG,EAAE;EACd;EACAC,SAAS,GAAG,EAAE;EACd;EACAC,SAAS,GAAG,KAAK;EACjB;AACF;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BAAkB;IACzBC,EAAE,EAAER;EACN,CAAC,EACD;IACEK,KAAK,EAAE;MAAEC,IAAI,EAAE;IAAwB,CAAC;IACxCA,IAAI,EAAE,uBAAuB;IAC7BC,KAAK,EAAE,uBAAuB;IAC9BC,EAAE,EAAEP;EACN,CAAC,EACD;IACEI,KAAK,EAAE;MAAEC,IAAI,EAAE;IAAgB,CAAC;IAChCA,IAAI,EAAE,eAAe;IACrBC,KAAK,EAAE,eAAe;IACtBC,EAAE,EAAEN;EACN,CAAC,EACD;IACEG,KAAK,EAAE;MAAEC,IAAI,EAAE;IAAsB,CAAC;IACtCA,IAAI,EAAE,qBAAqB;IAC3BC,KAAK,EAAE,qBAAqB;IAC5BC,EAAE,EAAEL;EACN,CAAC;AAEL,CAAE;AAEF,OAAO,MAAMM,gBAAgB,GAAG;EAC9BT,OAAO;EACPC,OAAO;EACPC,OAAO;EACPC,OAAO;EACPJ,YAAY,EAAEK;AAChB,CAAC;;AAED;AACA;AACA;AACA","ignoreList":[]}
@@ -0,0 +1,12 @@
1
+ import { ListSortableQuestion } from "./list-sortable.js";
2
+ import { Question } from "./question.js";
3
+ export class CheckboxSortableQuestion extends ListSortableQuestion {
4
+ /**
5
+ * @type {string}
6
+ * @protected
7
+ */
8
+ _questionTemplate = Question.PATH + 'checkboxesfield.njk';
9
+ listRenderId = 'checkboxField';
10
+ listRenderName = 'checkboxField';
11
+ }
12
+ //# sourceMappingURL=checkbox-sortable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox-sortable.js","names":["ListSortableQuestion","Question","CheckboxSortableQuestion","_questionTemplate","PATH","listRenderId","listRenderName"],"sources":["../../../../../src/form/form-editor/preview/checkbox-sortable.js"],"sourcesContent":["import { ListSortableQuestion } from '~/src/form/form-editor/preview/list-sortable.js'\nimport { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class CheckboxSortableQuestion extends ListSortableQuestion {\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = Question.PATH + 'checkboxesfield.njk'\n listRenderId = 'checkboxField'\n listRenderName = 'checkboxField'\n}\n"],"mappings":"AAAA,SAASA,oBAAoB;AAC7B,SAASC,QAAQ;AAEjB,OAAO,MAAMC,wBAAwB,SAASF,oBAAoB,CAAC;EACjE;AACF;AACA;AACA;EACEG,iBAAiB,GAAGF,QAAQ,CAACG,IAAI,GAAG,qBAAqB;EACzDC,YAAY,GAAG,eAAe;EAC9BC,cAAc,GAAG,eAAe;AAClC","ignoreList":[]}
@@ -1,10 +1,11 @@
1
1
  import { FieldsetQuestion } from "./fieldset-question.js";
2
+ import { Question } from "./question.js";
2
3
  export class DateInputQuestion extends FieldsetQuestion {
3
4
  /**
4
5
  * @type {string}
5
6
  * @protected
6
7
  */
7
- _questionTemplate = 'date-input.njk';
8
+ _questionTemplate = Question.PATH + 'date-input.njk';
8
9
  _fieldName = 'dateInput';
9
10
  }
10
11
  //# sourceMappingURL=date-input.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"date-input.js","names":["FieldsetQuestion","DateInputQuestion","_questionTemplate","_fieldName"],"sources":["../../../../../src/form/form-editor/preview/date-input.js"],"sourcesContent":["import { FieldsetQuestion } from '~/src/form/form-editor/preview/fieldset-question.js'\n\nexport class DateInputQuestion extends FieldsetQuestion {\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = 'date-input.njk'\n _fieldName = 'dateInput'\n}\n"],"mappings":"AAAA,SAASA,gBAAgB;AAEzB,OAAO,MAAMC,iBAAiB,SAASD,gBAAgB,CAAC;EACtD;AACF;AACA;AACA;EACEE,iBAAiB,GAAG,gBAAgB;EACpCC,UAAU,GAAG,WAAW;AAC1B","ignoreList":[]}
1
+ {"version":3,"file":"date-input.js","names":["FieldsetQuestion","Question","DateInputQuestion","_questionTemplate","PATH","_fieldName"],"sources":["../../../../../src/form/form-editor/preview/date-input.js"],"sourcesContent":["import { FieldsetQuestion } from '~/src/form/form-editor/preview/fieldset-question.js'\nimport { Question } from '~/src/form/form-editor/preview/question.js'\nexport class DateInputQuestion extends FieldsetQuestion {\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = Question.PATH + 'date-input.njk'\n _fieldName = 'dateInput'\n}\n"],"mappings":"AAAA,SAASA,gBAAgB;AACzB,SAASC,QAAQ;AACjB,OAAO,MAAMC,iBAAiB,SAASF,gBAAgB,CAAC;EACtD;AACF;AACA;AACA;EACEG,iBAAiB,GAAGF,QAAQ,CAACG,IAAI,GAAG,gBAAgB;EACpDC,UAAU,GAAG,WAAW;AAC1B","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import { Question } from "./question.js";
2
2
  export class EmailAddressQuestion extends Question {
3
- _questionTemplate = 'emailaddressfield.njk';
3
+ _questionTemplate = Question.PATH + 'emailaddressfield.njk';
4
4
  _fieldName = 'emailAddressField';
5
5
  }
6
6
  //# sourceMappingURL=email-address.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"email-address.js","names":["Question","EmailAddressQuestion","_questionTemplate","_fieldName"],"sources":["../../../../../src/form/form-editor/preview/email-address.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class EmailAddressQuestion extends Question {\n _questionTemplate = 'emailaddressfield.njk'\n _fieldName = 'emailAddressField'\n}\n"],"mappings":"AAAA,SAASA,QAAQ;AAEjB,OAAO,MAAMC,oBAAoB,SAASD,QAAQ,CAAC;EACjDE,iBAAiB,GAAG,uBAAuB;EAC3CC,UAAU,GAAG,mBAAmB;AAClC","ignoreList":[]}
1
+ {"version":3,"file":"email-address.js","names":["Question","EmailAddressQuestion","_questionTemplate","PATH","_fieldName"],"sources":["../../../../../src/form/form-editor/preview/email-address.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class EmailAddressQuestion extends Question {\n _questionTemplate = Question.PATH + 'emailaddressfield.njk'\n _fieldName = 'emailAddressField'\n}\n"],"mappings":"AAAA,SAASA,QAAQ;AAEjB,OAAO,MAAMC,oBAAoB,SAASD,QAAQ,CAAC;EACjDE,iBAAiB,GAAGF,QAAQ,CAACG,IAAI,GAAG,uBAAuB;EAC3DC,UAAU,GAAG,mBAAmB;AAClC","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ export * from "./checkbox-sortable.js";
1
2
  export * from "./date-input.js";
2
3
  export * from "./email-address.js";
3
4
  export * from "./list.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/form/form-editor/preview/index.js"],"sourcesContent":["export * from '~/src/form/form-editor/preview/date-input.js'\nexport * from '~/src/form/form-editor/preview/email-address.js'\nexport * from '~/src/form/form-editor/preview/list.js'\nexport * from '~/src/form/form-editor/preview/list-sortable.js'\nexport * from '~/src/form/form-editor/preview/month-year.js'\nexport * from '~/src/form/form-editor/preview/number-only.js'\nexport * from '~/src/form/form-editor/preview/phone-number.js'\nexport * from '~/src/form/form-editor/preview/question.js'\nexport * from '~/src/form/form-editor/preview/radio.js'\nexport * from '~/src/form/form-editor/preview/radio-sortable.js'\nexport * from '~/src/form/form-editor/preview/short-answer.js'\nexport * from '~/src/form/form-editor/preview/long-answer.js'\nexport * from '~/src/form/form-editor/preview/uk-address.js'\nexport * from '~/src/form/form-editor/preview/yes-no.js'\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/form/form-editor/preview/index.js"],"sourcesContent":["export * from '~/src/form/form-editor/preview/checkbox-sortable.js'\nexport * from '~/src/form/form-editor/preview/date-input.js'\nexport * from '~/src/form/form-editor/preview/email-address.js'\nexport * from '~/src/form/form-editor/preview/list.js'\nexport * from '~/src/form/form-editor/preview/list-sortable.js'\nexport * from '~/src/form/form-editor/preview/month-year.js'\nexport * from '~/src/form/form-editor/preview/number-only.js'\nexport * from '~/src/form/form-editor/preview/phone-number.js'\nexport * from '~/src/form/form-editor/preview/question.js'\nexport * from '~/src/form/form-editor/preview/radio.js'\nexport * from '~/src/form/form-editor/preview/radio-sortable.js'\nexport * from '~/src/form/form-editor/preview/short-answer.js'\nexport * from '~/src/form/form-editor/preview/long-answer.js'\nexport * from '~/src/form/form-editor/preview/uk-address.js'\nexport * from '~/src/form/form-editor/preview/yes-no.js'\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
@@ -4,7 +4,7 @@ export class LongAnswerQuestion extends Question {
4
4
  * @type {string}
5
5
  * @protected
6
6
  */
7
- _questionTemplate = 'textarea.njk';
7
+ _questionTemplate = Question.PATH + 'textarea.njk';
8
8
  /**
9
9
  * @type {string}
10
10
  * @protected
@@ -1 +1 @@
1
- {"version":3,"file":"long-answer.js","names":["Question","LongAnswerQuestion","_questionTemplate","_fieldName"],"sources":["../../../../../src/form/form-editor/preview/long-answer.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class LongAnswerQuestion extends Question {\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = 'textarea.njk'\n /**\n * @type {string}\n * @protected\n */\n _fieldName = 'longAnswerField'\n}\n"],"mappings":"AAAA,SAASA,QAAQ;AAEjB,OAAO,MAAMC,kBAAkB,SAASD,QAAQ,CAAC;EAC/C;AACF;AACA;AACA;EACEE,iBAAiB,GAAG,cAAc;EAClC;AACF;AACA;AACA;EACEC,UAAU,GAAG,iBAAiB;AAChC","ignoreList":[]}
1
+ {"version":3,"file":"long-answer.js","names":["Question","LongAnswerQuestion","_questionTemplate","PATH","_fieldName"],"sources":["../../../../../src/form/form-editor/preview/long-answer.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class LongAnswerQuestion extends Question {\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = Question.PATH + 'textarea.njk'\n /**\n * @type {string}\n * @protected\n */\n _fieldName = 'longAnswerField'\n}\n"],"mappings":"AAAA,SAASA,QAAQ;AAEjB,OAAO,MAAMC,kBAAkB,SAASD,QAAQ,CAAC;EAC/C;AACF;AACA;AACA;EACEE,iBAAiB,GAAGF,QAAQ,CAACG,IAAI,GAAG,cAAc;EAClD;AACF;AACA;AACA;EACEC,UAAU,GAAG,iBAAiB;AAChC","ignoreList":[]}
@@ -1,10 +1,11 @@
1
1
  import { FieldsetQuestion } from "./fieldset-question.js";
2
+ import { Question } from "../../../index.js";
2
3
  export class MonthYearQuestion extends FieldsetQuestion {
3
4
  /**
4
5
  * @type {string}
5
6
  * @protected
6
7
  */
7
- _questionTemplate = 'monthyearfield.njk';
8
+ _questionTemplate = Question.PATH + 'monthyearfield.njk';
8
9
  _fieldName = 'monthYear';
9
10
 
10
11
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"month-year.js","names":["FieldsetQuestion","MonthYearQuestion","_questionTemplate","_fieldName","customRenderFields","items","name","classes"],"sources":["../../../../../src/form/form-editor/preview/month-year.js"],"sourcesContent":["import { FieldsetQuestion } from '~/src/form/form-editor/preview/fieldset-question.js'\n\nexport class MonthYearQuestion extends FieldsetQuestion {\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = 'monthyearfield.njk'\n _fieldName = 'monthYear'\n\n /**\n * @returns {Partial<QuestionBaseModel>}\n */\n get customRenderFields() {\n return {\n items: [\n { name: 'month', classes: 'govuk-input--width-2' },\n { name: 'year', classes: 'govuk-input--width-4' }\n ]\n }\n }\n}\n/**\n * @import { QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SAASA,gBAAgB;AAEzB,OAAO,MAAMC,iBAAiB,SAASD,gBAAgB,CAAC;EACtD;AACF;AACA;AACA;EACEE,iBAAiB,GAAG,oBAAoB;EACxCC,UAAU,GAAG,WAAW;;EAExB;AACF;AACA;EACE,IAAIC,kBAAkBA,CAAA,EAAG;IACvB,OAAO;MACLC,KAAK,EAAE,CACL;QAAEC,IAAI,EAAE,OAAO;QAAEC,OAAO,EAAE;MAAuB,CAAC,EAClD;QAAED,IAAI,EAAE,MAAM;QAAEC,OAAO,EAAE;MAAuB,CAAC;IAErD,CAAC;EACH;AACF;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"month-year.js","names":["FieldsetQuestion","Question","MonthYearQuestion","_questionTemplate","PATH","_fieldName","customRenderFields","items","name","classes"],"sources":["../../../../../src/form/form-editor/preview/month-year.js"],"sourcesContent":["import { FieldsetQuestion } from '~/src/form/form-editor/preview/fieldset-question.js'\nimport { Question } from '~/src/index.js'\n\nexport class MonthYearQuestion extends FieldsetQuestion {\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = Question.PATH + 'monthyearfield.njk'\n _fieldName = 'monthYear'\n\n /**\n * @returns {Partial<QuestionBaseModel>}\n */\n get customRenderFields() {\n return {\n items: [\n { name: 'month', classes: 'govuk-input--width-2' },\n { name: 'year', classes: 'govuk-input--width-4' }\n ]\n }\n }\n}\n/**\n * @import { QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SAASA,gBAAgB;AACzB,SAASC,QAAQ;AAEjB,OAAO,MAAMC,iBAAiB,SAASF,gBAAgB,CAAC;EACtD;AACF;AACA;AACA;EACEG,iBAAiB,GAAGF,QAAQ,CAACG,IAAI,GAAG,oBAAoB;EACxDC,UAAU,GAAG,WAAW;;EAExB;AACF;AACA;EACE,IAAIC,kBAAkBA,CAAA,EAAG;IACvB,OAAO;MACLC,KAAK,EAAE,CACL;QAAEC,IAAI,EAAE,OAAO;QAAEC,OAAO,EAAE;MAAuB,CAAC,EAClD;QAAED,IAAI,EAAE,MAAM;QAAEC,OAAO,EAAE;MAAuB,CAAC;IAErD,CAAC;EACH;AACF;AACA;AACA;AACA","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import { Question } from "./question.js";
2
2
  export class PhoneNumberQuestion extends Question {
3
- _questionTemplate = 'telephonenumberfield.njk';
3
+ _questionTemplate = Question.PATH + 'telephonenumberfield.njk';
4
4
  _fieldName = 'phoneNumberField';
5
5
  }
6
6
 
@@ -1 +1 @@
1
- {"version":3,"file":"phone-number.js","names":["Question","PhoneNumberQuestion","_questionTemplate","_fieldName"],"sources":["../../../../../src/form/form-editor/preview/phone-number.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class PhoneNumberQuestion extends Question {\n _questionTemplate = 'telephonenumberfield.njk'\n _fieldName = 'phoneNumberField'\n}\n\n/**\n * @import { QuestionBaseModel } from '~/src/form/form-editor/preview/question.js'\n */\n"],"mappings":"AAAA,SAASA,QAAQ;AAEjB,OAAO,MAAMC,mBAAmB,SAASD,QAAQ,CAAC;EAChDE,iBAAiB,GAAG,0BAA0B;EAC9CC,UAAU,GAAG,kBAAkB;AACjC;;AAEA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"phone-number.js","names":["Question","PhoneNumberQuestion","_questionTemplate","PATH","_fieldName"],"sources":["../../../../../src/form/form-editor/preview/phone-number.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class PhoneNumberQuestion extends Question {\n _questionTemplate = Question.PATH + 'telephonenumberfield.njk'\n _fieldName = 'phoneNumberField'\n}\n\n/**\n * @import { QuestionBaseModel } from '~/src/form/form-editor/preview/question.js'\n */\n"],"mappings":"AAAA,SAASA,QAAQ;AAEjB,OAAO,MAAMC,mBAAmB,SAASD,QAAQ,CAAC;EAChDE,iBAAiB,GAAGF,QAAQ,CAACG,IAAI,GAAG,0BAA0B;EAC9DC,UAAU,GAAG,kBAAkB;AACjC;;AAEA;AACA;AACA","ignoreList":[]}
@@ -9,11 +9,13 @@
9
9
  * server side.
10
10
  */
11
11
  export class Question {
12
+ static PATH = '';
13
+
12
14
  /**
13
15
  * @type {string}
14
16
  * @protected
15
17
  */
16
- _questionTemplate = 'textfield.njk';
18
+ _questionTemplate = Question.PATH + 'textfield.njk';
17
19
  /**
18
20
  * @type { string|null }
19
21
  * @protected
@@ -1 +1 @@
1
- {"version":3,"file":"question.js","names":["Question","_questionTemplate","_highlight","_fieldName","_questionRenderer","constructor","htmlElements","questionRenderer","question","hintText","optional","values","_htmlElements","_question","_hintText","_optional","getHighlight","element","titleText","optionalText","label","text","classes","fieldSet","legend","hint","length","customRenderFields","renderInput","id","name","render","value","highlight"],"sources":["../../../../../src/form/form-editor/preview/question.js"],"sourcesContent":["/**\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 {\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = 'textfield.njk'\n /**\n * @type { string|null }\n * @protected\n */\n _highlight = null\n /**\n * @type {string}\n * @protected\n */\n _fieldName = 'inputField'\n /**\n * @type {QuestionRenderer}\n * @protected\n */\n _questionRenderer\n\n /**\n * @param {QuestionElements} htmlElements\n * @param {QuestionRenderer} questionRenderer\n */\n constructor(htmlElements, questionRenderer) {\n const { question, hintText, optional } = htmlElements.values\n\n /**\n * @type {QuestionElements}\n * @private\n */\n this._htmlElements = htmlElements\n /**\n * @type {string}\n * @private\n */\n this._question = question\n /**\n * @type {string}\n * @private\n */\n this._hintText = hintText\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 * @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 {Partial<QuestionBaseModel>}\n */\n get customRenderFields() {\n return {}\n }\n\n /**\n * @type {QuestionBaseModel}\n */\n get renderInput() {\n return {\n id: this._fieldName,\n name: this._fieldName,\n label: this.label,\n hint: this.hint,\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 /**\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 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/**\n * @import { ListenerRow, BaseSettings, QuestionElements, QuestionBaseModel, GovukFieldset, DefaultComponent, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { ListElement, ListItemReadonly } from '~/src/form/form-editor/types.js'\n */\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,QAAQ,CAAC;EACpB;AACF;AACA;AACA;EACEC,iBAAiB,GAAG,eAAe;EACnC;AACF;AACA;AACA;EACEC,UAAU,GAAG,IAAI;EACjB;AACF;AACA;AACA;EACEC,UAAU,GAAG,YAAY;EACzB;AACF;AACA;AACA;EACEC,iBAAiB;;EAEjB;AACF;AACA;AACA;EACEC,WAAWA,CAACC,YAAY,EAAEC,gBAAgB,EAA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tB,IAAI,CAACD,MAAM,CAAC,CAAC;EACf;;EAEA;AACF;AACA;EACE,IAAIE,SAASA,CAAA,EAAG;IACd,OAAO,IAAI,CAAC/B,UAAU;EACxB;;EAEA;AACF;AACA;EACE,IAAI+B,SAASA,CAACD,KAAK,EAAE;IACnB,IAAI,CAAC9B,UAAU,GAAG8B,KAAK;IACvB,IAAI,CAACD,MAAM,CAAC,CAAC;EACf;AACF;;AAEA;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"question.js","names":["Question","PATH","_questionTemplate","_highlight","_fieldName","_questionRenderer","constructor","htmlElements","questionRenderer","question","hintText","optional","values","_htmlElements","_question","_hintText","_optional","getHighlight","element","titleText","optionalText","label","text","classes","fieldSet","legend","hint","length","customRenderFields","renderInput","id","name","render","value","highlight"],"sources":["../../../../../src/form/form-editor/preview/question.js"],"sourcesContent":["/**\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 {\n static PATH = ''\n\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = Question.PATH + 'textfield.njk'\n /**\n * @type { string|null }\n * @protected\n */\n _highlight = null\n /**\n * @type {string}\n * @protected\n */\n _fieldName = 'inputField'\n /**\n * @type {QuestionRenderer}\n * @protected\n */\n _questionRenderer\n\n /**\n * @param {QuestionElements} htmlElements\n * @param {QuestionRenderer} questionRenderer\n */\n constructor(htmlElements, questionRenderer) {\n const { question, hintText, optional } = htmlElements.values\n\n /**\n * @type {QuestionElements}\n * @private\n */\n this._htmlElements = htmlElements\n /**\n * @type {string}\n * @private\n */\n this._question = question\n /**\n * @type {string}\n * @private\n */\n this._hintText = hintText\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 * @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 {Partial<QuestionBaseModel>}\n */\n get customRenderFields() {\n return {}\n }\n\n /**\n * @type {QuestionBaseModel}\n */\n get renderInput() {\n return {\n id: this._fieldName,\n name: this._fieldName,\n label: this.label,\n hint: this.hint,\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 /**\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 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/**\n * @import { ListenerRow, BaseSettings, QuestionElements, QuestionBaseModel, GovukFieldset, DefaultComponent, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { ListElement, ListItemReadonly } from '~/src/form/form-editor/types.js'\n */\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,QAAQ,CAAC;EACpB,OAAOC,IAAI,GAAG,EAAE;;EAEhB;AACF;AACA;AACA;EACEC,iBAAiB,GAAGF,QAAQ,CAACC,IAAI,GAAG,eAAe;EACnD;AACF;AACA;AACA;EACEE,UAAU,GAAG,IAAI;EACjB;AACF;AACA;AACA;EACEC,UAAU,GAAG,YAAY;EACzB;AACF;AACA;AACA;EACEC,iBAAiB;;EAEjB;AACF;AACA;AACA;EACEC,WAAWA,CAACC,YAAY,EAAEC,gBAAgB,EAAE;IAC1C,MAAM;MAAEC,QAAQ;MAAEC,QAAQ;MAAEC;IAAS,CAAC,GAAGJ,YAAY,CAACK,MAAM;;IAE5D;AACJ;AACA;AACA;IACI,IAAI,CAACC,aAAa,GAAGN,YAAY;IACjC;AACJ;AACA;AACA;IACI,IAAI,CAACO,SAAS,GAAGL,QAAQ;IACzB;AACJ;AACA;AACA;IACI,IAAI,CAACM,SAAS,GAAGL,QAAQ;IACzB;AACJ;AACA;AACA;IACI,IAAI,CAACM,SAAS,GAAGL,QAAQ;IACzB;AACJ;AACA;AACA;AACA;IACI,IAAI,CAACN,iBAAiB,GAAGG,gBAAgB;EAC3C;;EAEA;AACF;AACA;AACA;AACA;EACES,YAAYA,CAACC,OAAO,EAAE;IACpB,OAAO,IAAI,CAACf,UAAU,KAAKe,OAAO,GAAG,YAAY,GAAG,EAAE;EACxD;EAEA,IAAIC,SAASA,CAAA,EAAG;IACd,MAAMC,YAAY,GAAG,IAAI,CAACJ,SAAS,GAAG,aAAa,GAAG,EAAE;IACxD,OAAO,CAAC,CAAC,IAAI,CAACF,SAAS,GAAG,UAAU,GAAG,IAAI,CAACA,SAAS,IAAIM,YAAY;EACvE;;EAEA;AACF;AACA;AACA;EACE,IAAIC,KAAKA,CAAA,EAAG;IACV,OAAO;MACLC,IAAI,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K;IACtB,IAAI,CAACD,MAAM,CAAC,CAAC;EACf;;EAEA;AACF;AACA;EACE,IAAItB,QAAQA,CAAA,EAAG;IACb,OAAO,IAAI,CAACK,SAAS;EACvB;;EAEA;AACF;AACA;EACE,IAAIL,QAAQA,CAACuB,KAAK,EAAE;IAClB,IAAI,CAAClB,SAAS,GAAGkB,KAAK;IACtB,IAAI,CAACD,MAAM,CAAC,CAAC;EACf;EAEA,IAAIrB,QAAQA,CAAA,EAAG;IACb,OAAO,IAAI,CAACK,SAAS;EACvB;;EAEA;AACF;AACA;EACE,IAAIL,QAAQA,CAACsB,KAAK,EAAE;IAClB,IAAI,CAACjB,SAAS,GAAGiB,KAAK;IACtB,IAAI,CAACD,MAAM,CAAC,CAAC;EACf;;EAEA;AACF;AACA;EACE,IAAIE,SAASA,CAAA,EAAG;IACd,OAAO,IAAI,CAAC/B,UAAU;EACxB;;EAEA;AACF;AACA;EACE,IAAI+B,SAASA,CAACD,KAAK,EAAE;IACnB,IAAI,CAAC9B,UAAU,GAAG8B,KAAK;IACvB,IAAI,CAACD,MAAM,CAAC,CAAC;EACf;AACF;;AAEA;AACA;AACA;AACA","ignoreList":[]}
@@ -1,5 +1,6 @@
1
1
  import { ListSortableQuestion } from "./list-sortable.js";
2
+ import { Question } from "../../../index.js";
2
3
  export class RadioSortableQuestion extends ListSortableQuestion {
3
- _questionTemplate = 'radios.njk';
4
+ _questionTemplate = Question.PATH + 'radios.njk';
4
5
  }
5
6
  //# sourceMappingURL=radio-sortable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"radio-sortable.js","names":["ListSortableQuestion","RadioSortableQuestion","_questionTemplate"],"sources":["../../../../../src/form/form-editor/preview/radio-sortable.js"],"sourcesContent":["import { ListSortableQuestion } from '~/src/form/form-editor/preview/list-sortable.js'\n\nexport class RadioSortableQuestion extends ListSortableQuestion {\n _questionTemplate = 'radios.njk'\n}\n"],"mappings":"AAAA,SAASA,oBAAoB;AAE7B,OAAO,MAAMC,qBAAqB,SAASD,oBAAoB,CAAC;EAC9DE,iBAAiB,GAAG,YAAY;AAClC","ignoreList":[]}
1
+ {"version":3,"file":"radio-sortable.js","names":["ListSortableQuestion","Question","RadioSortableQuestion","_questionTemplate","PATH"],"sources":["../../../../../src/form/form-editor/preview/radio-sortable.js"],"sourcesContent":["import { ListSortableQuestion } from '~/src/form/form-editor/preview/list-sortable.js'\nimport { Question } from '~/src/index.js'\n\nexport class RadioSortableQuestion extends ListSortableQuestion {\n _questionTemplate = Question.PATH + 'radios.njk'\n}\n"],"mappings":"AAAA,SAASA,oBAAoB;AAC7B,SAASC,QAAQ;AAEjB,OAAO,MAAMC,qBAAqB,SAASF,oBAAoB,CAAC;EAC9DG,iBAAiB,GAAGF,QAAQ,CAACG,IAAI,GAAG,YAAY;AAClD","ignoreList":[]}
@@ -1,5 +1,6 @@
1
1
  import { ListQuestion } from "./list.js";
2
+ import { Question } from "../../../index.js";
2
3
  export class RadioQuestion extends ListQuestion {
3
- _questionTemplate = 'radios.njk';
4
+ _questionTemplate = Question.PATH + 'radios.njk';
4
5
  }
5
6
  //# sourceMappingURL=radio.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"radio.js","names":["ListQuestion","RadioQuestion","_questionTemplate"],"sources":["../../../../../src/form/form-editor/preview/radio.js"],"sourcesContent":["import { ListQuestion } from '~/src/form/form-editor/preview/list.js'\n\nexport class RadioQuestion extends ListQuestion {\n _questionTemplate = 'radios.njk'\n}\n"],"mappings":"AAAA,SAASA,YAAY;AAErB,OAAO,MAAMC,aAAa,SAASD,YAAY,CAAC;EAC9CE,iBAAiB,GAAG,YAAY;AAClC","ignoreList":[]}
1
+ {"version":3,"file":"radio.js","names":["ListQuestion","Question","RadioQuestion","_questionTemplate","PATH"],"sources":["../../../../../src/form/form-editor/preview/radio.js"],"sourcesContent":["import { ListQuestion } from '~/src/form/form-editor/preview/list.js'\nimport { Question } from '~/src/index.js'\n\nexport class RadioQuestion extends ListQuestion {\n _questionTemplate = Question.PATH + 'radios.njk'\n}\n"],"mappings":"AAAA,SAASA,YAAY;AACrB,SAASC,QAAQ;AAEjB,OAAO,MAAMC,aAAa,SAASF,YAAY,CAAC;EAC9CG,iBAAiB,GAAGF,QAAQ,CAACG,IAAI,GAAG,YAAY;AAClD","ignoreList":[]}
@@ -1,6 +1,7 @@
1
1
  import { FieldsetQuestion } from "./fieldset-question.js";
2
+ import { Question } from "../../../index.js";
2
3
  export class UkAddressQuestion extends FieldsetQuestion {
3
- _questionTemplate = 'ukaddressfield.njk';
4
+ _questionTemplate = Question.PATH + 'ukaddressfield.njk';
4
5
  _fieldName = 'addressField';
5
6
  }
6
7
 
@@ -1 +1 @@
1
- {"version":3,"file":"uk-address.js","names":["FieldsetQuestion","UkAddressQuestion","_questionTemplate","_fieldName"],"sources":["../../../../../src/form/form-editor/preview/uk-address.js"],"sourcesContent":["import { FieldsetQuestion } from '~/src/form/form-editor/preview/fieldset-question.js'\n\nexport class UkAddressQuestion extends FieldsetQuestion {\n _questionTemplate = 'ukaddressfield.njk'\n _fieldName = 'addressField'\n}\n\n/**\n * @import { QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SAASA,gBAAgB;AAEzB,OAAO,MAAMC,iBAAiB,SAASD,gBAAgB,CAAC;EACtDE,iBAAiB,GAAG,oBAAoB;EACxCC,UAAU,GAAG,cAAc;AAC7B;;AAEA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"uk-address.js","names":["FieldsetQuestion","Question","UkAddressQuestion","_questionTemplate","PATH","_fieldName"],"sources":["../../../../../src/form/form-editor/preview/uk-address.js"],"sourcesContent":["import { FieldsetQuestion } from '~/src/form/form-editor/preview/fieldset-question.js'\nimport { Question } from '~/src/index.js'\n\nexport class UkAddressQuestion extends FieldsetQuestion {\n _questionTemplate = Question.PATH + 'ukaddressfield.njk'\n _fieldName = 'addressField'\n}\n\n/**\n * @import { QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SAASA,gBAAgB;AACzB,SAASC,QAAQ;AAEjB,OAAO,MAAMC,iBAAiB,SAASF,gBAAgB,CAAC;EACtDG,iBAAiB,GAAGF,QAAQ,CAACG,IAAI,GAAG,oBAAoB;EACxDC,UAAU,GAAG,cAAc;AAC7B;;AAEA;AACA;AACA","ignoreList":[]}
@@ -1,10 +1,11 @@
1
1
  import { FieldsetQuestion } from "./fieldset-question.js";
2
+ import { Question } from "../../../index.js";
2
3
  export class YesNoQuestion extends FieldsetQuestion {
3
4
  /**
4
5
  * @type {string}
5
6
  * @protected
6
7
  */
7
- _questionTemplate = 'radios.njk';
8
+ _questionTemplate = Question.PATH + 'radios.njk';
8
9
  _fieldName = 'yesNo';
9
10
 
10
11
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"yes-no.js","names":["FieldsetQuestion","YesNoQuestion","_questionTemplate","_fieldName","customRenderFields","type","items","id","text","value","label","classes"],"sources":["../../../../../src/form/form-editor/preview/yes-no.js"],"sourcesContent":["import { FieldsetQuestion } from '~/src/form/form-editor/preview/fieldset-question.js'\n\nexport class YesNoQuestion extends FieldsetQuestion {\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = 'radios.njk'\n _fieldName = 'yesNo'\n\n /**\n * @returns {Partial<QuestionBaseModel>}\n */\n get customRenderFields() {\n /**\n *\n */\n return {\n type: 'boolean',\n items: /** @type {ListElement[]} */ ([\n {\n id: 'yesNo-yes',\n text: 'Yes',\n value: true,\n label: {\n text: 'Yes',\n classes: ''\n }\n },\n {\n id: 'yesNo-no',\n text: 'No',\n value: false,\n label: {\n text: 'No',\n classes: ''\n }\n }\n ])\n }\n }\n}\n\n/**\n * @import { QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'\n * @import { ListElement } from '~/src/form/form-editor/types.js'\n */\n"],"mappings":"AAAA,SAASA,gBAAgB;AAEzB,OAAO,MAAMC,aAAa,SAASD,gBAAgB,CAAC;EAClD;AACF;AACA;AACA;EACEE,iBAAiB,GAAG,YAAY;EAChCC,UAAU,GAAG,OAAO;;EAEpB;AACF;AACA;EACE,IAAIC,kBAAkBA,CAAA,EAAG;IACvB;AACJ;AACA;IACI,OAAO;MACLC,IAAI,EAAE,SAAS;MACfC,KAAK,GAAE,4BAA8B,CACnC;QACEC,EAAE,EAAE,WAAW;QACfC,IAAI,EAAE,KAAK;QACXC,KAAK,EAAE,IAAI;QACXC,KAAK,EAAE;UACLF,IAAI,EAAE,KAAK;UACXG,OAAO,EAAE;QACX;MACF,CAAC,EACD;QACEJ,EAAE,EAAE,UAAU;QACdC,IAAI,EAAE,IAAI;QACVC,KAAK,EAAE,KAAK;QACZC,KAAK,EAAE;UACLF,IAAI,EAAE,IAAI;UACVG,OAAO,EAAE;QACX;MACF,CAAC,CACF;IACH,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"yes-no.js","names":["FieldsetQuestion","Question","YesNoQuestion","_questionTemplate","PATH","_fieldName","customRenderFields","type","items","id","text","value","label","classes"],"sources":["../../../../../src/form/form-editor/preview/yes-no.js"],"sourcesContent":["import { FieldsetQuestion } from '~/src/form/form-editor/preview/fieldset-question.js'\nimport { Question } from '~/src/index.js'\n\nexport class YesNoQuestion extends FieldsetQuestion {\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = Question.PATH + 'radios.njk'\n _fieldName = 'yesNo'\n\n /**\n * @returns {Partial<QuestionBaseModel>}\n */\n get customRenderFields() {\n /**\n *\n */\n return {\n type: 'boolean',\n items: /** @type {ListElement[]} */ ([\n {\n id: 'yesNo-yes',\n text: 'Yes',\n value: true,\n label: {\n text: 'Yes',\n classes: ''\n }\n },\n {\n id: 'yesNo-no',\n text: 'No',\n value: false,\n label: {\n text: 'No',\n classes: ''\n }\n }\n ])\n }\n }\n}\n\n/**\n * @import { QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'\n * @import { ListElement } from '~/src/form/form-editor/types.js'\n */\n"],"mappings":"AAAA,SAASA,gBAAgB;AACzB,SAASC,QAAQ;AAEjB,OAAO,MAAMC,aAAa,SAASF,gBAAgB,CAAC;EAClD;AACF;AACA;AACA;EACEG,iBAAiB,GAAGF,QAAQ,CAACG,IAAI,GAAG,YAAY;EAChDC,UAAU,GAAG,OAAO;;EAEpB;AACF;AACA;EACE,IAAIC,kBAAkBA,CAAA,EAAG;IACvB;AACJ;AACA;IACI,OAAO;MACLC,IAAI,EAAE,SAAS;MACfC,KAAK,GAAE,4BAA8B,CACnC;QACEC,EAAE,EAAE,WAAW;QACfC,IAAI,EAAE,KAAK;QACXC,KAAK,EAAE,IAAI;QACXC,KAAK,EAAE;UACLF,IAAI,EAAE,KAAK;UACXG,OAAO,EAAE;QACX;MACF,CAAC,EACD;QACEJ,EAAE,EAAE,UAAU;QACdC,IAAI,EAAE,IAAI;QACVC,KAAK,EAAE,KAAK;QACZC,KAAK,EAAE;UACLF,IAAI,EAAE,IAAI;UACVG,OAAO,EAAE;QACX;MACF,CAAC,CACF;IACH,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA","ignoreList":[]}
@@ -63,10 +63,23 @@ export class QuestionPreviewElements implements ListElements {
63
63
  setPreviewHTML(_value: string): void;
64
64
  }
65
65
  export const baseElements: BaseSettings;
66
+ export namespace listElementsStub {
67
+ export { list1Id };
68
+ export { list2Id };
69
+ export { list3Id };
70
+ export { list4Id };
71
+ export { listElementsBase as baseElements };
72
+ }
66
73
  import type { QuestionRenderer } from '../../../form/form-editor/preview/types.js';
67
74
  import type { QuestionBaseModel } from '../../../form/form-editor/preview/types.js';
68
75
  import type { RenderContext } from '../../../form/form-editor/preview/types.js';
69
76
  import type { ListElements } from '../../../form/form-editor/preview/types.js';
70
77
  import type { ListElement } from '../../../form/form-editor/types.js';
71
78
  import type { BaseSettings } from '../../../form/form-editor/preview/types.js';
79
+ declare const list1Id: "414d82a3-4cab-416a-bd54-6b86fbd51120";
80
+ declare const list2Id: "801385a4-81e6-4171-96c3-6c6727d97f22";
81
+ declare const list3Id: "e6e3f621-b875-4ca3-a054-cca9149149dd";
82
+ declare const list4Id: "d71b3909-582f-4e90-b6f5-490b89a6eb8f";
83
+ declare const listElementsBase: BaseSettings;
84
+ export {};
72
85
  //# sourceMappingURL=preview.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/__stubs__/preview.js"],"names":[],"mappings":"AAAA;;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;IAuBE;;OAEG;IACH,gEAFW,YAAY,EAQtB;IA/BD;;OAEG;IACH,4BAAc;IACd,iBAAiB;IACjB,4BAAc;IACd,iBAAiB;IACjB,6BAAiB;IACjB;;;OAGG;IACH,sBAHU,MAAM,CAGD;IACf;;;;OAIG;IACH,eAAW;IAEX,wBAA2E;IAa3E;;;;;;MAQC;IAED;;OAEG;IACH,uBAFW,MAAM,QAIhB;CACF;AAED,2BAAuC,YAAY,CAMjD;sCAIoH,yCAAyC;uCAAzC,yCAAyC;mCAAzC,yCAAyC;kCAAzC,yCAAyC;iCAD9H,iCAAiC;kCACoD,yCAAyC"}
1
+ {"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/__stubs__/preview.js"],"names":[],"mappings":"AAAA;;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;IAuBE;;OAEG;IACH,gEAFW,YAAY,EAQtB;IA/BD;;OAEG;IACH,4BAAc;IACd,iBAAiB;IACjB,4BAAc;IACd,iBAAiB;IACjB,6BAAiB;IACjB;;;OAGG;IACH,sBAHU,MAAM,CAGD;IACf;;;;OAIG;IACH,eAAW;IAEX,wBAA2E;IAa3E;;;;;;MAQC;IAED;;OAEG;IACH,uBAFW,MAAM,QAIhB;CACF;AAED,2BAAuC,YAAY,CAMjD;;;;;;;;sCA+CoH,yCAAyC;uCAAzC,yCAAyC;mCAAzC,yCAAyC;kCAAzC,yCAAyC;iCAD9H,iCAAiC;kCACoD,yCAAyC;AA7C/J,uBAAgB,sCAAsC,CAAA;AACtD,uBAAgB,sCAAsC,CAAA;AACtD,uBAAgB,sCAAsC,CAAA;AACtD,uBAAgB,sCAAsC,CAAA;AAEtD,gCAAoC,YAAY,CA4B9C"}
@@ -0,0 +1,4 @@
1
+ export class CheckboxSortableQuestion extends ListSortableQuestion {
2
+ }
3
+ import { ListSortableQuestion } from '../../../form/form-editor/preview/list-sortable.js';
4
+ //# sourceMappingURL=checkbox-sortable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox-sortable.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/checkbox-sortable.js"],"names":[],"mappings":"AAGA;CAQC;qCAXoC,iDAAiD"}
@@ -1,3 +1,4 @@
1
+ export * from "../../../form/form-editor/preview/checkbox-sortable.js";
1
2
  export * from "../../../form/form-editor/preview/date-input.js";
2
3
  export * from "../../../form/form-editor/preview/email-address.js";
3
4
  export * from "../../../form/form-editor/preview/list.js";
@@ -1 +1 @@
1
- {"version":3,"file":"month-year.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/month-year.js"],"names":[],"mappings":"AAEA;CAmBC;iCArBgC,qDAAqD"}
1
+ {"version":3,"file":"month-year.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/month-year.js"],"names":[],"mappings":"AAGA;CAmBC;iCAtBgC,qDAAqD"}
@@ -9,6 +9,7 @@
9
9
  * server side.
10
10
  */
11
11
  export class Question {
12
+ static PATH: string;
12
13
  /**
13
14
  * @param {QuestionElements} htmlElements
14
15
  * @param {QuestionRenderer} questionRenderer
@@ -1 +1 @@
1
- {"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/question.js"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH;IAsBE;;;OAGG;IACH,0BAHW,gBAAgB,oBAChB,gBAAgB,EA+B1B;IAtDD;;;OAGG;IACH,6BAHU,MAAM,CAGmB;IACnC;;;OAGG;IACH,sBAHW,MAAM,GAAC,IAAI,CAGL;IACjB;;;OAGG;IACH,sBAHU,MAAM,CAGS;IACzB;;;OAGG;IACH,6BAHU,gBAAgB,CAGT;IASf;;;OAGG;IACH,sBAAiC;IACjC;;;OAGG;IACH,kBAAyB;IACzB;;;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;;;OAGG;IACH,sBAHU,gBAAgB,CAazB;IAED;;OAEG;IACH,0BAFa,OAAO,CAAC,iBAAiB,CAAC,CAItC;IAED;;OAEG;IACH,mBAFU,iBAAiB,CAU1B;IAED,eAEC;IASD;;OAEG;IACH,oBAFW,MAAM,EAKhB;IAbD;;OAEG;IACH,gBAFU,MAAM,CAIf;IAiBD;;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;CASF;sCAGqI,yCAAyC;sCAAzC,yCAAyC;mCAAzC,yCAAyC;uCAAzC,yCAAyC;sCAAzC,yCAAyC"}
1
+ {"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/question.js"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH;IACE,oBAAgB;IAuBhB;;;OAGG;IACH,0BAHW,gBAAgB,oBAChB,gBAAgB,EA+B1B;IAtDD;;;OAGG;IACH,6BAHU,MAAM,CAGmC;IACnD;;;OAGG;IACH,sBAHW,MAAM,GAAC,IAAI,CAGL;IACjB;;;OAGG;IACH,sBAHU,MAAM,CAGS;IACzB;;;OAGG;IACH,6BAHU,gBAAgB,CAGT;IASf;;;OAGG;IACH,sBAAiC;IACjC;;;OAGG;IACH,kBAAyB;IACzB;;;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;;;OAGG;IACH,sBAHU,gBAAgB,CAazB;IAED;;OAEG;IACH,0BAFa,OAAO,CAAC,iBAAiB,CAAC,CAItC;IAED;;OAEG;IACH,mBAFU,iBAAiB,CAU1B;IAED,eAEC;IASD;;OAEG;IACH,oBAFW,MAAM,EAKhB;IAbD;;OAEG;IACH,gBAFU,MAAM,CAIf;IAiBD;;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;CASF;sCAGqI,yCAAyC;sCAAzC,yCAAyC;mCAAzC,yCAAyC;uCAAzC,yCAAyC;sCAAzC,yCAAyC"}
@@ -1 +1 @@
1
- {"version":3,"file":"radio-sortable.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/radio-sortable.js"],"names":[],"mappings":"AAEA;CAEC;qCAJoC,iDAAiD"}
1
+ {"version":3,"file":"radio-sortable.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/radio-sortable.js"],"names":[],"mappings":"AAGA;CAEC;qCALoC,iDAAiD"}
@@ -1 +1 @@
1
- {"version":3,"file":"radio.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/radio.js"],"names":[],"mappings":"AAEA;CAEC;6BAJ4B,wCAAwC"}
1
+ {"version":3,"file":"radio.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/radio.js"],"names":[],"mappings":"AAGA;CAEC;6BAL4B,wCAAwC"}
@@ -1 +1 @@
1
- {"version":3,"file":"uk-address.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/uk-address.js"],"names":[],"mappings":"AAEA;CAGC;iCALgC,qDAAqD"}
1
+ {"version":3,"file":"uk-address.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/uk-address.js"],"names":[],"mappings":"AAGA;CAGC;iCANgC,qDAAqD"}
@@ -1 +1 @@
1
- {"version":3,"file":"yes-no.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/yes-no.js"],"names":[],"mappings":"AAEA;CAuCC;iCAzCgC,qDAAqD"}
1
+ {"version":3,"file":"yes-no.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/yes-no.js"],"names":[],"mappings":"AAGA;CAuCC;iCA1CgC,qDAAqD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/forms-model",
3
- "version": "3.0.452",
3
+ "version": "3.0.453",
4
4
  "description": "A hapi plugin providing the model for Defra forms",
5
5
  "homepage": "https://github.com/DEFRA/forms-designer/tree/main/model#readme",
6
6
  "repository": {
@@ -95,6 +95,49 @@ export const baseElements = /** @type {BaseSettings} */ ({
95
95
  shortDesc: ''
96
96
  })
97
97
 
98
+ const list1Id = '414d82a3-4cab-416a-bd54-6b86fbd51120'
99
+ const list2Id = '801385a4-81e6-4171-96c3-6c6727d97f22'
100
+ const list3Id = 'e6e3f621-b875-4ca3-a054-cca9149149dd'
101
+ const list4Id = 'd71b3909-582f-4e90-b6f5-490b89a6eb8f'
102
+
103
+ const listElementsBase = /** @type {BaseSettings} */ ({
104
+ ...baseElements,
105
+ items: [
106
+ {
107
+ label: { text: 'Treasure Hunting' },
108
+ text: 'Treasure Hunting',
109
+ value: 'Treasure Hunting',
110
+ id: list1Id
111
+ },
112
+ {
113
+ label: { text: 'Rescuing the princess' },
114
+ text: 'Rescuing the princess',
115
+ value: 'Rescuing the princess',
116
+ id: list2Id
117
+ },
118
+ {
119
+ label: { text: 'Saving a city' },
120
+ text: 'Saving a city',
121
+ value: 'Saving a city',
122
+ id: list3Id
123
+ },
124
+ {
125
+ label: { text: 'Defeating the baron' },
126
+ text: 'Defeating the baron',
127
+ value: 'Defeating the baron',
128
+ id: list4Id
129
+ }
130
+ ]
131
+ })
132
+
133
+ export const listElementsStub = {
134
+ list1Id,
135
+ list2Id,
136
+ list3Id,
137
+ list4Id,
138
+ baseElements: listElementsBase
139
+ }
140
+
98
141
  /**
99
142
  * @import { ListElement } from '~/src/form/form-editor/types.js'
100
143
  * @import { BaseSettings, ListElements, RenderContext, QuestionBaseModel, QuestionElements, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'
@@ -0,0 +1,12 @@
1
+ import { ListSortableQuestion } from '~/src/form/form-editor/preview/list-sortable.js'
2
+ import { Question } from '~/src/form/form-editor/preview/question.js'
3
+
4
+ export class CheckboxSortableQuestion extends ListSortableQuestion {
5
+ /**
6
+ * @type {string}
7
+ * @protected
8
+ */
9
+ _questionTemplate = Question.PATH + 'checkboxesfield.njk'
10
+ listRenderId = 'checkboxField'
11
+ listRenderName = 'checkboxField'
12
+ }
@@ -1,10 +1,10 @@
1
1
  import { FieldsetQuestion } from '~/src/form/form-editor/preview/fieldset-question.js'
2
-
2
+ import { Question } from '~/src/form/form-editor/preview/question.js'
3
3
  export class DateInputQuestion extends FieldsetQuestion {
4
4
  /**
5
5
  * @type {string}
6
6
  * @protected
7
7
  */
8
- _questionTemplate = 'date-input.njk'
8
+ _questionTemplate = Question.PATH + 'date-input.njk'
9
9
  _fieldName = 'dateInput'
10
10
  }
@@ -1,6 +1,6 @@
1
1
  import { Question } from '~/src/form/form-editor/preview/question.js'
2
2
 
3
3
  export class EmailAddressQuestion extends Question {
4
- _questionTemplate = 'emailaddressfield.njk'
4
+ _questionTemplate = Question.PATH + 'emailaddressfield.njk'
5
5
  _fieldName = 'emailAddressField'
6
6
  }
@@ -1,3 +1,4 @@
1
+ export * from '~/src/form/form-editor/preview/checkbox-sortable.js'
1
2
  export * from '~/src/form/form-editor/preview/date-input.js'
2
3
  export * from '~/src/form/form-editor/preview/email-address.js'
3
4
  export * from '~/src/form/form-editor/preview/list.js'
@@ -5,7 +5,7 @@ export class LongAnswerQuestion extends Question {
5
5
  * @type {string}
6
6
  * @protected
7
7
  */
8
- _questionTemplate = 'textarea.njk'
8
+ _questionTemplate = Question.PATH + 'textarea.njk'
9
9
  /**
10
10
  * @type {string}
11
11
  * @protected
@@ -1,11 +1,12 @@
1
1
  import { FieldsetQuestion } from '~/src/form/form-editor/preview/fieldset-question.js'
2
+ import { Question } from '~/src/index.js'
2
3
 
3
4
  export class MonthYearQuestion extends FieldsetQuestion {
4
5
  /**
5
6
  * @type {string}
6
7
  * @protected
7
8
  */
8
- _questionTemplate = 'monthyearfield.njk'
9
+ _questionTemplate = Question.PATH + 'monthyearfield.njk'
9
10
  _fieldName = 'monthYear'
10
11
 
11
12
  /**
@@ -1,7 +1,7 @@
1
1
  import { Question } from '~/src/form/form-editor/preview/question.js'
2
2
 
3
3
  export class PhoneNumberQuestion extends Question {
4
- _questionTemplate = 'telephonenumberfield.njk'
4
+ _questionTemplate = Question.PATH + 'telephonenumberfield.njk'
5
5
  _fieldName = 'phoneNumberField'
6
6
  }
7
7
 
@@ -9,11 +9,13 @@
9
9
  * server side.
10
10
  */
11
11
  export class Question {
12
+ static PATH = ''
13
+
12
14
  /**
13
15
  * @type {string}
14
16
  * @protected
15
17
  */
16
- _questionTemplate = 'textfield.njk'
18
+ _questionTemplate = Question.PATH + 'textfield.njk'
17
19
  /**
18
20
  * @type { string|null }
19
21
  * @protected
@@ -1,5 +1,6 @@
1
1
  import { ListSortableQuestion } from '~/src/form/form-editor/preview/list-sortable.js'
2
+ import { Question } from '~/src/index.js'
2
3
 
3
4
  export class RadioSortableQuestion extends ListSortableQuestion {
4
- _questionTemplate = 'radios.njk'
5
+ _questionTemplate = Question.PATH + 'radios.njk'
5
6
  }
@@ -1,5 +1,6 @@
1
1
  import { ListQuestion } from '~/src/form/form-editor/preview/list.js'
2
+ import { Question } from '~/src/index.js'
2
3
 
3
4
  export class RadioQuestion extends ListQuestion {
4
- _questionTemplate = 'radios.njk'
5
+ _questionTemplate = Question.PATH + 'radios.njk'
5
6
  }
@@ -1,7 +1,8 @@
1
1
  import { FieldsetQuestion } from '~/src/form/form-editor/preview/fieldset-question.js'
2
+ import { Question } from '~/src/index.js'
2
3
 
3
4
  export class UkAddressQuestion extends FieldsetQuestion {
4
- _questionTemplate = 'ukaddressfield.njk'
5
+ _questionTemplate = Question.PATH + 'ukaddressfield.njk'
5
6
  _fieldName = 'addressField'
6
7
  }
7
8
 
@@ -1,11 +1,12 @@
1
1
  import { FieldsetQuestion } from '~/src/form/form-editor/preview/fieldset-question.js'
2
+ import { Question } from '~/src/index.js'
2
3
 
3
4
  export class YesNoQuestion extends FieldsetQuestion {
4
5
  /**
5
6
  * @type {string}
6
7
  * @protected
7
8
  */
8
- _questionTemplate = 'radios.njk'
9
+ _questionTemplate = Question.PATH + 'radios.njk'
9
10
  _fieldName = 'yesNo'
10
11
 
11
12
  /**