@defra/forms-model 3.0.451 → 3.0.452
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module/form/form-editor/preview/date-input.js +3 -10
- package/dist/module/form/form-editor/preview/date-input.js.map +1 -1
- package/dist/module/form/form-editor/preview/fieldset-question.js +18 -0
- package/dist/module/form/form-editor/preview/fieldset-question.js.map +1 -0
- package/dist/module/form/form-editor/preview/index.js +1 -0
- package/dist/module/form/form-editor/preview/index.js.map +1 -1
- package/dist/module/form/form-editor/preview/month-year.js +11 -7
- package/dist/module/form/form-editor/preview/month-year.js.map +1 -1
- package/dist/module/form/form-editor/preview/number-only.js +2 -6
- package/dist/module/form/form-editor/preview/number-only.js.map +1 -1
- package/dist/module/form/form-editor/preview/question.js +9 -1
- package/dist/module/form/form-editor/preview/question.js.map +1 -1
- package/dist/module/form/form-editor/preview/types.js.map +1 -1
- package/dist/module/form/form-editor/preview/uk-address.js +2 -14
- package/dist/module/form/form-editor/preview/uk-address.js.map +1 -1
- package/dist/module/form/form-editor/preview/yes-no.js +44 -0
- package/dist/module/form/form-editor/preview/yes-no.js.map +1 -0
- package/dist/module/form/form-editor/types.js.map +1 -1
- package/dist/types/form/form-editor/preview/date-input.d.ts +2 -8
- package/dist/types/form/form-editor/preview/date-input.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/fieldset-question.d.ts +23 -0
- package/dist/types/form/form-editor/preview/fieldset-question.d.ts.map +1 -0
- package/dist/types/form/form-editor/preview/index.d.ts +1 -0
- package/dist/types/form/form-editor/preview/list-sortable.d.ts +1 -1
- package/dist/types/form/form-editor/preview/month-year.d.ts +2 -12
- package/dist/types/form/form-editor/preview/month-year.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/number-only.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/question.d.ts +4 -0
- package/dist/types/form/form-editor/preview/question.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/types.d.ts +1 -1
- package/dist/types/form/form-editor/preview/types.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/uk-address.d.ts +2 -2
- package/dist/types/form/form-editor/preview/uk-address.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/yes-no.d.ts +4 -0
- package/dist/types/form/form-editor/preview/yes-no.d.ts.map +1 -0
- package/dist/types/form/form-editor/types.d.ts +4 -4
- package/dist/types/form/form-editor/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/form/form-editor/preview/date-input.js +3 -11
- package/src/form/form-editor/preview/fieldset-question.js +17 -0
- package/src/form/form-editor/preview/index.js +1 -0
- package/src/form/form-editor/preview/month-year.js +10 -7
- package/src/form/form-editor/preview/number-only.js +2 -6
- package/src/form/form-editor/preview/question.js +9 -1
- package/src/form/form-editor/preview/types.ts +1 -1
- package/src/form/form-editor/preview/uk-address.js +2 -14
- package/src/form/form-editor/preview/yes-no.js +47 -0
- package/src/form/form-editor/types.ts +4 -4
@@ -1,17 +1,10 @@
|
|
1
|
-
import {
|
2
|
-
export class DateInputQuestion extends
|
1
|
+
import { FieldsetQuestion } from "./fieldset-question.js";
|
2
|
+
export class DateInputQuestion extends FieldsetQuestion {
|
3
3
|
/**
|
4
4
|
* @type {string}
|
5
5
|
* @protected
|
6
6
|
*/
|
7
7
|
_questionTemplate = 'date-input.njk';
|
8
|
-
|
9
|
-
return {
|
10
|
-
id: 'dateInput',
|
11
|
-
name: 'dateInputField',
|
12
|
-
fieldset: this.fieldSet,
|
13
|
-
hint: this.hint
|
14
|
-
};
|
15
|
-
}
|
8
|
+
_fieldName = 'dateInput';
|
16
9
|
}
|
17
10
|
//# sourceMappingURL=date-input.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"date-input.js","names":["
|
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":[]}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { Question } from "./question.js";
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Simple extension of Question that uses fieldset instead of label - not exported
|
5
|
+
* @abstract
|
6
|
+
*/
|
7
|
+
export class FieldsetQuestion extends Question {
|
8
|
+
get renderInput() {
|
9
|
+
return {
|
10
|
+
id: this._fieldName,
|
11
|
+
name: this._fieldName,
|
12
|
+
fieldset: this.fieldSet,
|
13
|
+
hint: this.hint,
|
14
|
+
...this.customRenderFields
|
15
|
+
};
|
16
|
+
}
|
17
|
+
}
|
18
|
+
//# sourceMappingURL=fieldset-question.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"fieldset-question.js","names":["Question","FieldsetQuestion","renderInput","id","_fieldName","name","fieldset","fieldSet","hint","customRenderFields"],"sources":["../../../../../src/form/form-editor/preview/fieldset-question.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\n/**\n * Simple extension of Question that uses fieldset instead of label - not exported\n * @abstract\n */\nexport class FieldsetQuestion extends Question {\n get renderInput() {\n return {\n id: this._fieldName,\n name: this._fieldName,\n fieldset: this.fieldSet,\n hint: this.hint,\n ...this.customRenderFields\n }\n }\n}\n"],"mappings":"AAAA,SAASA,QAAQ;;AAEjB;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,SAASD,QAAQ,CAAC;EAC7C,IAAIE,WAAWA,CAAA,EAAG;IAChB,OAAO;MACLC,EAAE,EAAE,IAAI,CAACC,UAAU;MACnBC,IAAI,EAAE,IAAI,CAACD,UAAU;MACrBE,QAAQ,EAAE,IAAI,CAACC,QAAQ;MACvBC,IAAI,EAAE,IAAI,CAACA,IAAI;MACf,GAAG,IAAI,CAACC;IACV,CAAC;EACH;AACF","ignoreList":[]}
|
@@ -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'\n"],"mappings":"AAAA;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/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,16 +1,17 @@
|
|
1
|
-
import {
|
2
|
-
export class MonthYearQuestion extends
|
1
|
+
import { FieldsetQuestion } from "./fieldset-question.js";
|
2
|
+
export class MonthYearQuestion extends FieldsetQuestion {
|
3
3
|
/**
|
4
4
|
* @type {string}
|
5
5
|
* @protected
|
6
6
|
*/
|
7
7
|
_questionTemplate = 'monthyearfield.njk';
|
8
|
-
|
8
|
+
_fieldName = 'monthYear';
|
9
|
+
|
10
|
+
/**
|
11
|
+
* @returns {Partial<QuestionBaseModel>}
|
12
|
+
*/
|
13
|
+
get customRenderFields() {
|
9
14
|
return {
|
10
|
-
id: 'monthYear',
|
11
|
-
name: 'monthYearField',
|
12
|
-
fieldset: this.fieldSet,
|
13
|
-
hint: this.hint,
|
14
15
|
items: [{
|
15
16
|
name: 'month',
|
16
17
|
classes: 'govuk-input--width-2'
|
@@ -21,4 +22,7 @@ export class MonthYearQuestion extends Question {
|
|
21
22
|
};
|
22
23
|
}
|
23
24
|
}
|
25
|
+
/**
|
26
|
+
* @import { QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'
|
27
|
+
*/
|
24
28
|
//# sourceMappingURL=month-year.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"month-year.js","names":["
|
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,14 +1,10 @@
|
|
1
1
|
import { Question } from "./question.js";
|
2
2
|
export class NumberOnlyQuestion extends Question {
|
3
3
|
/**
|
4
|
-
* @
|
4
|
+
* @returns {Partial<QuestionBaseModel>}
|
5
5
|
*/
|
6
|
-
get
|
6
|
+
get customRenderFields() {
|
7
7
|
return {
|
8
|
-
id: this._fieldName,
|
9
|
-
name: this._fieldName,
|
10
|
-
label: this.label,
|
11
|
-
hint: this.hint,
|
12
8
|
type: 'number'
|
13
9
|
};
|
14
10
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"number-only.js","names":["Question","NumberOnlyQuestion","
|
1
|
+
{"version":3,"file":"number-only.js","names":["Question","NumberOnlyQuestion","customRenderFields","type"],"sources":["../../../../../src/form/form-editor/preview/number-only.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class NumberOnlyQuestion extends Question {\n /**\n * @returns {Partial<QuestionBaseModel>}\n */\n get customRenderFields() {\n return {\n type: 'number'\n }\n }\n}\n\n/**\n * @import { QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SAASA,QAAQ;AAEjB,OAAO,MAAMC,kBAAkB,SAASD,QAAQ,CAAC;EAC/C;AACF;AACA;EACE,IAAIE,kBAAkBA,CAAA,EAAG;IACvB,OAAO;MACLC,IAAI,EAAE;IACR,CAAC;EACH;AACF;;AAEA;AACA;AACA","ignoreList":[]}
|
@@ -118,6 +118,13 @@ export class Question {
|
|
118
118
|
};
|
119
119
|
}
|
120
120
|
|
121
|
+
/**
|
122
|
+
* @returns {Partial<QuestionBaseModel>}
|
123
|
+
*/
|
124
|
+
get customRenderFields() {
|
125
|
+
return {};
|
126
|
+
}
|
127
|
+
|
121
128
|
/**
|
122
129
|
* @type {QuestionBaseModel}
|
123
130
|
*/
|
@@ -126,7 +133,8 @@ export class Question {
|
|
126
133
|
id: this._fieldName,
|
127
134
|
name: this._fieldName,
|
128
135
|
label: this.label,
|
129
|
-
hint: this.hint
|
136
|
+
hint: this.hint,
|
137
|
+
...this.customRenderFields
|
130
138
|
};
|
131
139
|
}
|
132
140
|
render() {
|
@@ -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","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 * @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 }\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,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,EAAE,IAAI,CAACH,SAAS;MACpBI,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAACN,YAAY,CAAC,UAAU;IAC1D,CAAC;EACH;;EAEA;AACF;AACA;AACA;EACE,IAAIO,QAAQA,CAAA,EAAG;IACb,OAAO;MACLC,MAAM,EAAE;QACNH,IAAI,EAAE,IAAI,CAACH,SAAS;QACpBI,OAAO,EAAE,2BAA2B,GAAG,IAAI,CAACN,YAAY,CAAC,UAAU;MACrE;IACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;EACE,IAAIS,IAAIA,CAAA,EAAG;IACT,MAAMJ,IAAI,GACR,IAAI,CAACnB,UAAU,KAAK,UAAU,IAAI,CAAC,IAAI,CAACY,SAAS,CAACY,MAAM,GACpD,WAAW,GACX,IAAI,CAACZ,SAAS;IAEpB,OAAO;MACLO,IAAI;MACJC,OAAO,EAAE,IAAI,CAACN,YAAY,CAAC,UAAU;IACvC,CAAC;EACH;;EAEA;AACF;AACA;EACE,IAAIW,WAAWA,CAAA,EAAG;IAChB,OAAO;MACLC,EAAE,EAAE,IAAI,
|
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,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,Q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;;AAEA;AACA;AACA;AACA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/form/form-editor/preview/types.ts"],"sourcesContent":["import { 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 ShortAnswerQuestion } from '~/src/form/form-editor/preview/short-answer.js'\nimport { type UkAddressQuestion } from '~/src/form/form-editor/preview/uk-address.js'\nimport {\n type DateItem,\n type ListElement,\n type ListItemReadonly\n} from '~/src/form/form-editor/types.js'\n\nexport interface BaseSettings {\n question: string\n hintText: string\n optional: boolean\n shortDesc: string\n items: ListElement[]\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 interface QuestionBaseModel {\n id?: string\n name?: string\n label?: DefaultComponent\n hint?: DefaultComponent\n fieldset?: GovukFieldset\n readonly items?: ListItemReadonly[] | DateItem[]\n text?: string\n formGroup?: { afterInputs: { html: string } }\n type?: 'text' | 'number'\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}\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 ListElements extends QuestionElements {\n afterInputsHTML: string\n}\n\nexport type PreviewQuestion =\n | DateInputQuestion\n | EmailAddressQuestion\n | ListSortableQuestion\n | LongAnswerQuestion\n | PhoneNumberQuestion\n | Question\n | RadioSortableQuestion\n | ShortAnswerQuestion\n | UkAddressQuestion\n"],"mappings":"","ignoreList":[]}
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/form/form-editor/preview/types.ts"],"sourcesContent":["import { 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 ShortAnswerQuestion } from '~/src/form/form-editor/preview/short-answer.js'\nimport { type UkAddressQuestion } from '~/src/form/form-editor/preview/uk-address.js'\nimport {\n type DateItem,\n type ListElement,\n type ListItemReadonly\n} from '~/src/form/form-editor/types.js'\n\nexport interface BaseSettings {\n question: string\n hintText: string\n optional: boolean\n shortDesc: string\n items: ListElement[]\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 interface QuestionBaseModel {\n id?: string\n name?: string\n label?: DefaultComponent\n hint?: DefaultComponent\n fieldset?: GovukFieldset\n readonly items?: ListItemReadonly[] | DateItem[]\n text?: string\n formGroup?: { afterInputs: { html: string } }\n type?: 'text' | 'number' | 'boolean'\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}\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 ListElements extends QuestionElements {\n afterInputsHTML: string\n}\n\nexport type PreviewQuestion =\n | DateInputQuestion\n | EmailAddressQuestion\n | ListSortableQuestion\n | LongAnswerQuestion\n | PhoneNumberQuestion\n | Question\n | RadioSortableQuestion\n | ShortAnswerQuestion\n | UkAddressQuestion\n"],"mappings":"","ignoreList":[]}
|
@@ -1,19 +1,7 @@
|
|
1
|
-
import {
|
2
|
-
export class UkAddressQuestion extends
|
1
|
+
import { FieldsetQuestion } from "./fieldset-question.js";
|
2
|
+
export class UkAddressQuestion extends FieldsetQuestion {
|
3
3
|
_questionTemplate = 'ukaddressfield.njk';
|
4
4
|
_fieldName = 'addressField';
|
5
|
-
|
6
|
-
/**
|
7
|
-
* @type {QuestionBaseModel}
|
8
|
-
*/
|
9
|
-
get renderInput() {
|
10
|
-
return {
|
11
|
-
id: this._fieldName,
|
12
|
-
name: this._fieldName,
|
13
|
-
fieldset: this.fieldSet,
|
14
|
-
hint: this.hint
|
15
|
-
};
|
16
|
-
}
|
17
5
|
}
|
18
6
|
|
19
7
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"uk-address.js","names":["
|
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":[]}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import { FieldsetQuestion } from "./fieldset-question.js";
|
2
|
+
export class YesNoQuestion extends FieldsetQuestion {
|
3
|
+
/**
|
4
|
+
* @type {string}
|
5
|
+
* @protected
|
6
|
+
*/
|
7
|
+
_questionTemplate = 'radios.njk';
|
8
|
+
_fieldName = 'yesNo';
|
9
|
+
|
10
|
+
/**
|
11
|
+
* @returns {Partial<QuestionBaseModel>}
|
12
|
+
*/
|
13
|
+
get customRenderFields() {
|
14
|
+
/**
|
15
|
+
*
|
16
|
+
*/
|
17
|
+
return {
|
18
|
+
type: 'boolean',
|
19
|
+
items: (/** @type {ListElement[]} */[{
|
20
|
+
id: 'yesNo-yes',
|
21
|
+
text: 'Yes',
|
22
|
+
value: true,
|
23
|
+
label: {
|
24
|
+
text: 'Yes',
|
25
|
+
classes: ''
|
26
|
+
}
|
27
|
+
}, {
|
28
|
+
id: 'yesNo-no',
|
29
|
+
text: 'No',
|
30
|
+
value: false,
|
31
|
+
label: {
|
32
|
+
text: 'No',
|
33
|
+
classes: ''
|
34
|
+
}
|
35
|
+
}])
|
36
|
+
};
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
/**
|
41
|
+
* @import { QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'
|
42
|
+
* @import { ListElement } from '~/src/form/form-editor/types.js'
|
43
|
+
*/
|
44
|
+
//# sourceMappingURL=yes-no.js.map
|
@@ -0,0 +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 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../src/form/form-editor/types.ts"],"sourcesContent":["import { type ComponentType } from '~/src/components/enums.js'\nimport { type ComponentDef } from '~/src/components/types.js'\nimport { type Item } from '~/src/index.js'\n\n/**\n * Interface for `FormEditor` Joi schema\n */\nexport interface FormEditor {\n /**\n * The type of the page\n */\n pageType: string\n\n /**\n * The type of the question\n */\n questionType: string | undefined\n\n /**\n * The sub-type of written answer\n */\n writtenAnswerSub: string\n\n /**\n * The sub-type of date\n */\n dateSub: string\n\n /**\n * The sub-type of lists\n */\n listSub: string\n\n /**\n * The name of the question (unique id)\n */\n name: string\n\n /**\n * The text of the question\n */\n question: string\n\n /**\n * The hint text of the question\n */\n hintText: string\n\n /**\n * Denotes if the question is optional\n */\n questionOptional: string\n\n /**\n * The short description of the question\n */\n shortDescription: string\n\n /**\n * The value of checkbox to reveal heading and guidance section\n */\n pageHeadingAndGuidance: string\n\n /**\n * The page heading\n */\n pageHeading: string\n\n /**\n * The page guidance text\n */\n guidanceText: string\n\n /**\n * The value of checkbox to reveal repeater section\n */\n repeater: string\n\n /**\n * The maximum number of repeater items\n */\n minItems: number\n\n /**\n * The minimum number of repeater items\n */\n maxItems: number\n\n /**\n * The repeater question set name\n */\n questionSetName: string\n\n /**\n * The value of radio to reveal declaration text field\n */\n needDeclaration: string\n\n /**\n * The check answers declaration text\n */\n declarationText: string\n\n /**\n * The min length a field can have\n */\n minLength: string\n\n /**\n * The max length a field can have\n */\n maxLength: string\n\n /**\n * The regex value of a field\n */\n regex: string\n\n /**\n * The number of rows of a textarea\n */\n rows: string\n\n /**\n * The classes to be applied to a field\n */\n classes: string\n\n /**\n * The prefix to be applied to a field\n */\n prefix: string\n\n /**\n * The suffix to be applied to a field\n */\n suffix: string\n\n /**\n * The decimal precision of a number field\n */\n precision: string\n\n /**\n * The lowest number allowed in a field\n */\n min: string\n\n /**\n * The highest number allowed in a field\n */\n max: string\n\n /**\n * The maximum days in the future to allow for a date\n */\n maxFuture: string\n\n /**\n * The maximum days in the past to allow for a date\n */\n maxPast: string\n\n /**\n * The exact number of files to upload\n */\n exactFiles: string\n\n /**\n * The minimum number of files to upload\n */\n minFiles: string\n\n /**\n * The maximum number of files to upload\n */\n maxFiles: string\n\n /**\n * The type of files for upload\n */\n fileTypes: string[]\n\n /**\n * The types of document files for upload\n */\n documentTypes: string[]\n\n /**\n * The types of image files for upload\n */\n imageTypes: string[]\n\n /**\n * The types of tabular data files for upload\n */\n tabularDataTypes: string[]\n\n /**\n * The action required from within a sub-section\n */\n enhancedAction: string\n\n /**\n * Placeholder for inserted section to handle adding/editing radios or checkboxes\n */\n radiosOrCheckboxes: string\n\n /**\n * The unique id of the radio item\n */\n radioId: string\n\n /**\n * The display text of the radio item\n */\n radioText?: string\n\n /**\n * The hint of the radio item\n */\n radioHint?: string\n\n /**\n * The value of the radio item\n */\n radioValue?: string\n\n /**\n * The list name to be applied to a field (if applicable)\n */\n list: string\n\n /**\n * List items in JSON format, such as for radios ro checkboxes\n */\n listItemsData: string\n\n /**\n * An array of options for autocomplete\n */\n autoCompleteOptions: Item[]\n\n /**\n * Set to 'true' is Javascript is enabled\n */\n jsEnabled: string\n}\n\nexport type FormEditorInputPage = Pick<\n FormEditor,\n 'pageType' | 'questionType' | 'writtenAnswerSub' | 'dateSub' | 'listSub'\n>\n\nexport type FormEditorInputCheckAnswersSettings = Pick<\n FormEditor,\n 'needDeclaration' | 'declarationText'\n>\n\nexport type FormEditorInputQuestion = Pick<\n FormEditor,\n | 'questionType'\n | 'name'\n | 'question'\n | 'shortDescription'\n | 'hintText'\n | 'questionOptional'\n | 'minLength'\n | 'maxLength'\n | 'regex'\n | 'rows'\n | 'classes'\n | 'prefix'\n | 'suffix'\n | 'precision'\n | 'min'\n | 'max'\n | 'maxFuture'\n | 'maxPast'\n | 'exactFiles'\n | 'minFiles'\n | 'maxFiles'\n | 'fileTypes'\n | 'documentTypes'\n | 'imageTypes'\n | 'tabularDataTypes'\n | 'autoCompleteOptions'\n | 'enhancedAction'\n | 'radioId'\n | 'radioText'\n | 'radioHint'\n | 'radioValue'\n | 'list'\n | 'listItemsData'\n | 'jsEnabled'\n>\n\nexport type FormEditorInputPageSettings = Pick<\n FormEditor,\n | 'pageHeadingAndGuidance'\n | 'pageHeading'\n | 'guidanceText'\n | 'repeater'\n | 'minItems'\n | 'maxItems'\n | 'questionSetName'\n>\n\nexport type FormEditorInputGuidancePage = Pick<\n FormEditor,\n 'pageHeading' | 'guidanceText'\n>\n\nexport type FormEditorInputQuestionDetails = Pick<\n FormEditorInputQuestion,\n | 'question'\n | 'hintText'\n | 'shortDescription'\n | 'questionOptional'\n | 'questionType'\n | 'fileTypes'\n | 'documentTypes'\n | 'imageTypes'\n | 'tabularDataTypes'\n | 'autoCompleteOptions'\n | 'enhancedAction'\n | 'radioId'\n | 'radioText'\n | 'radioHint'\n | 'radioValue'\n | 'listItemsData'\n | 'jsEnabled'\n>\n\nexport interface ListItem {\n id?: string\n text?: string\n hint?: {\n text: string\n }\n value?: string\n}\n\nexport interface ListLabel {\n text: string\n classes: string\n}\n\nexport interface ListElement extends ListItem {\n readonly id: string\n text: string\n value: string\n label: ListLabel\n}\n\nexport interface ReadonlyHint {\n readonly text: string\n}\n\nexport interface ListItemReadonly extends ListElement {\n readonly text: string\n readonly hint?: ReadonlyHint\n readonly value: string\n readonly label: ListLabel\n}\n\nexport interface DateItem {\n name: string\n classes: string\n}\n\nexport interface QuestionSessionState {\n questionType?: ComponentType\n questionDetails?: Partial<ComponentDef>\n editRow?: {\n radioId?: string\n radioText?: string\n radioHint?: string\n radioValue?: string\n expanded?: boolean\n }\n listItems?: ListItem[]\n isReordering?: boolean\n lastMovedId?: string\n lastMoveDirection?: string\n}\n\nexport interface GovukFieldItem {\n text?: string\n value?: string\n checked?: boolean\n}\n\nexport interface GovukField {\n id?: string\n name?: string\n idPrefix?: string\n fieldset?: {\n legend?: { text?: string; isPageHeading?: boolean; classes?: string }\n }\n value?: string | boolean | number | string[] | Item[]\n classes?: string\n label?: {\n text?: string\n html?: string\n classes?: string\n isPageHeading?: boolean\n }\n hint?: { text?: string; html?: string; classes?: string }\n items?: GovukFieldItem[]\n rows?: number\n type?: string\n customTemplate?: string\n}\n\nexport type GovukFieldQuestionOptional = Omit<GovukField, 'name' | 'items'> & {\n name: 'questionOptional'\n items: [\n {\n text?: string\n value?: string\n checked: boolean\n }\n ]\n}\n\nexport type GovukStringField = Omit<GovukField, 'value'> & { value: string }\n\nexport interface FormEditorGovukField {\n question?: GovukField\n hintText?: GovukField\n questionOptional?: GovukField\n shortDescription?: GovukField\n fileTypes?: GovukField\n documentTypes?: GovukField\n imageTypes?: GovukField\n tabularDataTypes?: GovukField\n radiosOrCheckboxes?: GovukField\n autoCompleteOptions?: GovukField\n errorMessage?: { text: string }\n}\n\nexport type FormEditorGovukFieldBase = Omit<\n FormEditorGovukField,\n 'errorMessage'\n>\n\nexport type FormEditorGovukFieldBaseKeys = keyof FormEditorGovukFieldBase\n\nexport interface FormEditorCheckbox {\n text?: string\n hint?: {\n text?: string\n }\n value?: string\n divider?: {\n text?: string\n hint?: string\n value?: string\n }\n}\n"],"mappings":"","ignoreList":[]}
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../src/form/form-editor/types.ts"],"sourcesContent":["import { type ComponentType } from '~/src/components/enums.js'\nimport { type ComponentDef } from '~/src/components/types.js'\nimport { type Item } from '~/src/index.js'\n\n/**\n * Interface for `FormEditor` Joi schema\n */\nexport interface FormEditor {\n /**\n * The type of the page\n */\n pageType: string\n\n /**\n * The type of the question\n */\n questionType: string | undefined\n\n /**\n * The sub-type of written answer\n */\n writtenAnswerSub: string\n\n /**\n * The sub-type of date\n */\n dateSub: string\n\n /**\n * The sub-type of lists\n */\n listSub: string\n\n /**\n * The name of the question (unique id)\n */\n name: string\n\n /**\n * The text of the question\n */\n question: string\n\n /**\n * The hint text of the question\n */\n hintText: string\n\n /**\n * Denotes if the question is optional\n */\n questionOptional: string\n\n /**\n * The short description of the question\n */\n shortDescription: string\n\n /**\n * The value of checkbox to reveal heading and guidance section\n */\n pageHeadingAndGuidance: string\n\n /**\n * The page heading\n */\n pageHeading: string\n\n /**\n * The page guidance text\n */\n guidanceText: string\n\n /**\n * The value of checkbox to reveal repeater section\n */\n repeater: string\n\n /**\n * The maximum number of repeater items\n */\n minItems: number\n\n /**\n * The minimum number of repeater items\n */\n maxItems: number\n\n /**\n * The repeater question set name\n */\n questionSetName: string\n\n /**\n * The value of radio to reveal declaration text field\n */\n needDeclaration: string\n\n /**\n * The check answers declaration text\n */\n declarationText: string\n\n /**\n * The min length a field can have\n */\n minLength: string\n\n /**\n * The max length a field can have\n */\n maxLength: string\n\n /**\n * The regex value of a field\n */\n regex: string\n\n /**\n * The number of rows of a textarea\n */\n rows: string\n\n /**\n * The classes to be applied to a field\n */\n classes: string\n\n /**\n * The prefix to be applied to a field\n */\n prefix: string\n\n /**\n * The suffix to be applied to a field\n */\n suffix: string\n\n /**\n * The decimal precision of a number field\n */\n precision: string\n\n /**\n * The lowest number allowed in a field\n */\n min: string\n\n /**\n * The highest number allowed in a field\n */\n max: string\n\n /**\n * The maximum days in the future to allow for a date\n */\n maxFuture: string\n\n /**\n * The maximum days in the past to allow for a date\n */\n maxPast: string\n\n /**\n * The exact number of files to upload\n */\n exactFiles: string\n\n /**\n * The minimum number of files to upload\n */\n minFiles: string\n\n /**\n * The maximum number of files to upload\n */\n maxFiles: string\n\n /**\n * The type of files for upload\n */\n fileTypes: string[]\n\n /**\n * The types of document files for upload\n */\n documentTypes: string[]\n\n /**\n * The types of image files for upload\n */\n imageTypes: string[]\n\n /**\n * The types of tabular data files for upload\n */\n tabularDataTypes: string[]\n\n /**\n * The action required from within a sub-section\n */\n enhancedAction: string\n\n /**\n * Placeholder for inserted section to handle adding/editing radios or checkboxes\n */\n radiosOrCheckboxes: string\n\n /**\n * The unique id of the radio item\n */\n radioId: string\n\n /**\n * The display text of the radio item\n */\n radioText?: string\n\n /**\n * The hint of the radio item\n */\n radioHint?: string\n\n /**\n * The value of the radio item\n */\n radioValue?: string\n\n /**\n * The list name to be applied to a field (if applicable)\n */\n list: string\n\n /**\n * List items in JSON format, such as for radios ro checkboxes\n */\n listItemsData: string\n\n /**\n * An array of options for autocomplete\n */\n autoCompleteOptions: Item[]\n\n /**\n * Set to 'true' is Javascript is enabled\n */\n jsEnabled: string\n}\n\nexport type FormEditorInputPage = Pick<\n FormEditor,\n 'pageType' | 'questionType' | 'writtenAnswerSub' | 'dateSub' | 'listSub'\n>\n\nexport type FormEditorInputCheckAnswersSettings = Pick<\n FormEditor,\n 'needDeclaration' | 'declarationText'\n>\n\nexport type FormEditorInputQuestion = Pick<\n FormEditor,\n | 'questionType'\n | 'name'\n | 'question'\n | 'shortDescription'\n | 'hintText'\n | 'questionOptional'\n | 'minLength'\n | 'maxLength'\n | 'regex'\n | 'rows'\n | 'classes'\n | 'prefix'\n | 'suffix'\n | 'precision'\n | 'min'\n | 'max'\n | 'maxFuture'\n | 'maxPast'\n | 'exactFiles'\n | 'minFiles'\n | 'maxFiles'\n | 'fileTypes'\n | 'documentTypes'\n | 'imageTypes'\n | 'tabularDataTypes'\n | 'autoCompleteOptions'\n | 'enhancedAction'\n | 'radioId'\n | 'radioText'\n | 'radioHint'\n | 'radioValue'\n | 'list'\n | 'listItemsData'\n | 'jsEnabled'\n>\n\nexport type FormEditorInputPageSettings = Pick<\n FormEditor,\n | 'pageHeadingAndGuidance'\n | 'pageHeading'\n | 'guidanceText'\n | 'repeater'\n | 'minItems'\n | 'maxItems'\n | 'questionSetName'\n>\n\nexport type FormEditorInputGuidancePage = Pick<\n FormEditor,\n 'pageHeading' | 'guidanceText'\n>\n\nexport type FormEditorInputQuestionDetails = Pick<\n FormEditorInputQuestion,\n | 'question'\n | 'hintText'\n | 'shortDescription'\n | 'questionOptional'\n | 'questionType'\n | 'fileTypes'\n | 'documentTypes'\n | 'imageTypes'\n | 'tabularDataTypes'\n | 'autoCompleteOptions'\n | 'enhancedAction'\n | 'radioId'\n | 'radioText'\n | 'radioHint'\n | 'radioValue'\n | 'listItemsData'\n | 'jsEnabled'\n>\n\nexport interface ListItem {\n id?: string\n text?: string\n hint?: {\n text: string\n }\n value?: string | boolean\n}\n\nexport interface ListLabel {\n text: string\n classes: string\n}\n\nexport interface ListElement extends ListItem {\n readonly id: string\n text: string\n value: string | boolean\n label: ListLabel\n}\n\nexport interface ReadonlyHint {\n readonly text: string\n}\n\nexport interface ListItemReadonly extends ListElement {\n readonly text: string\n readonly hint?: ReadonlyHint\n readonly value: string | boolean\n readonly label: ListLabel\n}\n\nexport interface DateItem {\n name: string\n classes: string\n}\n\nexport interface QuestionSessionState {\n questionType?: ComponentType\n questionDetails?: Partial<ComponentDef>\n editRow?: {\n radioId?: string\n radioText?: string\n radioHint?: string\n radioValue?: string | boolean\n expanded?: boolean\n }\n listItems?: ListItem[]\n isReordering?: boolean\n lastMovedId?: string\n lastMoveDirection?: string\n}\n\nexport interface GovukFieldItem {\n text?: string\n value?: string\n checked?: boolean\n}\n\nexport interface GovukField {\n id?: string\n name?: string\n idPrefix?: string\n fieldset?: {\n legend?: { text?: string; isPageHeading?: boolean; classes?: string }\n }\n value?: string | boolean | number | string[] | Item[]\n classes?: string\n label?: {\n text?: string\n html?: string\n classes?: string\n isPageHeading?: boolean\n }\n hint?: { text?: string; html?: string; classes?: string }\n items?: GovukFieldItem[]\n rows?: number\n type?: string\n customTemplate?: string\n}\n\nexport type GovukFieldQuestionOptional = Omit<GovukField, 'name' | 'items'> & {\n name: 'questionOptional'\n items: [\n {\n text?: string\n value?: string\n checked: boolean\n }\n ]\n}\n\nexport type GovukStringField = Omit<GovukField, 'value'> & { value: string }\n\nexport interface FormEditorGovukField {\n question?: GovukField\n hintText?: GovukField\n questionOptional?: GovukField\n shortDescription?: GovukField\n fileTypes?: GovukField\n documentTypes?: GovukField\n imageTypes?: GovukField\n tabularDataTypes?: GovukField\n radiosOrCheckboxes?: GovukField\n autoCompleteOptions?: GovukField\n errorMessage?: { text: string }\n}\n\nexport type FormEditorGovukFieldBase = Omit<\n FormEditorGovukField,\n 'errorMessage'\n>\n\nexport type FormEditorGovukFieldBaseKeys = keyof FormEditorGovukFieldBase\n\nexport interface FormEditorCheckbox {\n text?: string\n hint?: {\n text?: string\n }\n value?: string\n divider?: {\n text?: string\n hint?: string\n value?: string\n }\n}\n"],"mappings":"","ignoreList":[]}
|
@@ -1,10 +1,4 @@
|
|
1
|
-
export class DateInputQuestion extends
|
2
|
-
get renderInput(): {
|
3
|
-
id: string;
|
4
|
-
name: string;
|
5
|
-
fieldset: import("./types.js").GovukFieldset;
|
6
|
-
hint: import("./types.js").DefaultComponent;
|
7
|
-
};
|
1
|
+
export class DateInputQuestion extends FieldsetQuestion {
|
8
2
|
}
|
9
|
-
import {
|
3
|
+
import { FieldsetQuestion } from '../../../form/form-editor/preview/fieldset-question.js';
|
10
4
|
//# sourceMappingURL=date-input.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"date-input.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/date-input.js"],"names":[],"mappings":"AAEA;
|
1
|
+
{"version":3,"file":"date-input.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/date-input.js"],"names":[],"mappings":"AAEA;CAOC;iCATgC,qDAAqD"}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
/**
|
2
|
+
* Simple extension of Question that uses fieldset instead of label - not exported
|
3
|
+
* @abstract
|
4
|
+
*/
|
5
|
+
export class FieldsetQuestion extends Question {
|
6
|
+
get renderInput(): {
|
7
|
+
id: string;
|
8
|
+
name: string;
|
9
|
+
label?: import("./types.js").DefaultComponent | undefined;
|
10
|
+
hint: import("./types.js").DefaultComponent;
|
11
|
+
fieldset: import("./types.js").GovukFieldset;
|
12
|
+
items?: import("../types.js").ListItemReadonly[] | import("../types.js").DateItem[];
|
13
|
+
text?: string | undefined;
|
14
|
+
formGroup?: {
|
15
|
+
afterInputs: {
|
16
|
+
html: string;
|
17
|
+
};
|
18
|
+
} | undefined;
|
19
|
+
type?: "text" | "number" | "boolean" | undefined;
|
20
|
+
};
|
21
|
+
}
|
22
|
+
import { Question } from '../../../form/form-editor/preview/question.js';
|
23
|
+
//# sourceMappingURL=fieldset-question.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"fieldset-question.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/fieldset-question.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH;IACE;;;;;;;;;;;;;;MAQC;CACF;yBAhBwB,4CAA4C"}
|
@@ -11,4 +11,5 @@ export * from "../../../form/form-editor/preview/radio-sortable.js";
|
|
11
11
|
export * from "../../../form/form-editor/preview/short-answer.js";
|
12
12
|
export * from "../../../form/form-editor/preview/long-answer.js";
|
13
13
|
export * from "../../../form/form-editor/preview/uk-address.js";
|
14
|
+
export * from "../../../form/form-editor/preview/yes-no.js";
|
14
15
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1,14 +1,4 @@
|
|
1
|
-
export class MonthYearQuestion extends
|
2
|
-
get renderInput(): {
|
3
|
-
id: string;
|
4
|
-
name: string;
|
5
|
-
fieldset: import("./types.js").GovukFieldset;
|
6
|
-
hint: import("./types.js").DefaultComponent;
|
7
|
-
items: {
|
8
|
-
name: string;
|
9
|
-
classes: string;
|
10
|
-
}[];
|
11
|
-
};
|
1
|
+
export class MonthYearQuestion extends FieldsetQuestion {
|
12
2
|
}
|
13
|
-
import {
|
3
|
+
import { FieldsetQuestion } from '../../../form/form-editor/preview/fieldset-question.js';
|
14
4
|
//# sourceMappingURL=month-year.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"month-year.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/month-year.js"],"names":[],"mappings":"AAEA;
|
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 +1 @@
|
|
1
|
-
{"version":3,"file":"number-only.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/number-only.js"],"names":[],"mappings":"AAEA;
|
1
|
+
{"version":3,"file":"number-only.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/number-only.js"],"names":[],"mappings":"AAEA;CASC;yBAXwB,4CAA4C"}
|
@@ -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,mBAFU,iBAAiB,
|
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 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,8CAA8C,CAAA;AACrF,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,iDAAiD,CAAA;AAC3F,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,iDAAiD,CAAA;AAC3F,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,+CAA+C,CAAA;AACvF,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,gDAAgD,CAAA;AACzF,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,4CAA4C,CAAA;AAC1E,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,kDAAk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I,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE;QAAE,WAAW,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAA;IAC7C,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAA;CACrC;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,gBAAgB,GAAG,IAAI;IACvB,CAAC,MAAM,EAAE,gBAAgB,EAAE,CAAC,EAAE,KAAK,KAAK,IAAI;IAC5C,MAAM,mBAAmB;CAC1B,CAAA;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;IAC7B,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACpC;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,iBAAiB,CAAA;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,gBAAgB,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,GAAG,MAAM,CAAA;CAC1E;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,gBAAgB,EAAE,MAAM,EAAE,iBAAiB,EAAE,iBAAiB,GAAG,IAAI,CAAA;CAC7E;AAED,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACpD,eAAe,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,MAAM,eAAe,GACvB,iBAAiB,GACjB,oBAAoB,GACpB,oBAAoB,GACpB,kBAAkB,GAClB,mBAAmB,GACnB,QAAQ,GACR,qBAAqB,GACrB,mBAAmB,GACnB,iBAAiB,CAAA"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export class UkAddressQuestion extends
|
1
|
+
export class UkAddressQuestion extends FieldsetQuestion {
|
2
2
|
}
|
3
|
-
import {
|
3
|
+
import { FieldsetQuestion } from '../../../form/form-editor/preview/fieldset-question.js';
|
4
4
|
//# sourceMappingURL=uk-address.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"uk-address.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/uk-address.js"],"names":[],"mappings":"AAEA;
|
1
|
+
{"version":3,"file":"uk-address.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/uk-address.js"],"names":[],"mappings":"AAEA;CAGC;iCALgC,qDAAqD"}
|
@@ -0,0 +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"}
|
@@ -210,7 +210,7 @@ export interface ListItem {
|
|
210
210
|
hint?: {
|
211
211
|
text: string;
|
212
212
|
};
|
213
|
-
value?: string;
|
213
|
+
value?: string | boolean;
|
214
214
|
}
|
215
215
|
export interface ListLabel {
|
216
216
|
text: string;
|
@@ -219,7 +219,7 @@ export interface ListLabel {
|
|
219
219
|
export interface ListElement extends ListItem {
|
220
220
|
readonly id: string;
|
221
221
|
text: string;
|
222
|
-
value: string;
|
222
|
+
value: string | boolean;
|
223
223
|
label: ListLabel;
|
224
224
|
}
|
225
225
|
export interface ReadonlyHint {
|
@@ -228,7 +228,7 @@ export interface ReadonlyHint {
|
|
228
228
|
export interface ListItemReadonly extends ListElement {
|
229
229
|
readonly text: string;
|
230
230
|
readonly hint?: ReadonlyHint;
|
231
|
-
readonly value: string;
|
231
|
+
readonly value: string | boolean;
|
232
232
|
readonly label: ListLabel;
|
233
233
|
}
|
234
234
|
export interface DateItem {
|
@@ -242,7 +242,7 @@ export interface QuestionSessionState {
|
|
242
242
|
radioId?: string;
|
243
243
|
radioText?: string;
|
244
244
|
radioHint?: string;
|
245
|
-
radioValue?: string;
|
245
|
+
radioValue?: string | boolean;
|
246
246
|
expanded?: boolean;
|
247
247
|
};
|
248
248
|
listItems?: ListItem[];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/form/form-edit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AAA;CACF"}
|
package/package.json
CHANGED
@@ -1,18 +1,10 @@
|
|
1
|
-
import {
|
1
|
+
import { FieldsetQuestion } from '~/src/form/form-editor/preview/fieldset-question.js'
|
2
2
|
|
3
|
-
export class DateInputQuestion extends
|
3
|
+
export class DateInputQuestion extends FieldsetQuestion {
|
4
4
|
/**
|
5
5
|
* @type {string}
|
6
6
|
* @protected
|
7
7
|
*/
|
8
8
|
_questionTemplate = 'date-input.njk'
|
9
|
-
|
10
|
-
get renderInput() {
|
11
|
-
return {
|
12
|
-
id: 'dateInput',
|
13
|
-
name: 'dateInputField',
|
14
|
-
fieldset: this.fieldSet,
|
15
|
-
hint: this.hint
|
16
|
-
}
|
17
|
-
}
|
9
|
+
_fieldName = 'dateInput'
|
18
10
|
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { Question } from '~/src/form/form-editor/preview/question.js'
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Simple extension of Question that uses fieldset instead of label - not exported
|
5
|
+
* @abstract
|
6
|
+
*/
|
7
|
+
export class FieldsetQuestion extends Question {
|
8
|
+
get renderInput() {
|
9
|
+
return {
|
10
|
+
id: this._fieldName,
|
11
|
+
name: this._fieldName,
|
12
|
+
fieldset: this.fieldSet,
|
13
|
+
hint: this.hint,
|
14
|
+
...this.customRenderFields
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}
|
@@ -11,3 +11,4 @@ export * from '~/src/form/form-editor/preview/radio-sortable.js'
|
|
11
11
|
export * from '~/src/form/form-editor/preview/short-answer.js'
|
12
12
|
export * from '~/src/form/form-editor/preview/long-answer.js'
|
13
13
|
export * from '~/src/form/form-editor/preview/uk-address.js'
|
14
|
+
export * from '~/src/form/form-editor/preview/yes-no.js'
|
@@ -1,18 +1,18 @@
|
|
1
|
-
import {
|
1
|
+
import { FieldsetQuestion } from '~/src/form/form-editor/preview/fieldset-question.js'
|
2
2
|
|
3
|
-
export class MonthYearQuestion extends
|
3
|
+
export class MonthYearQuestion extends FieldsetQuestion {
|
4
4
|
/**
|
5
5
|
* @type {string}
|
6
6
|
* @protected
|
7
7
|
*/
|
8
8
|
_questionTemplate = 'monthyearfield.njk'
|
9
|
+
_fieldName = 'monthYear'
|
9
10
|
|
10
|
-
|
11
|
+
/**
|
12
|
+
* @returns {Partial<QuestionBaseModel>}
|
13
|
+
*/
|
14
|
+
get customRenderFields() {
|
11
15
|
return {
|
12
|
-
id: 'monthYear',
|
13
|
-
name: 'monthYearField',
|
14
|
-
fieldset: this.fieldSet,
|
15
|
-
hint: this.hint,
|
16
16
|
items: [
|
17
17
|
{ name: 'month', classes: 'govuk-input--width-2' },
|
18
18
|
{ name: 'year', classes: 'govuk-input--width-4' }
|
@@ -20,3 +20,6 @@ export class MonthYearQuestion extends Question {
|
|
20
20
|
}
|
21
21
|
}
|
22
22
|
}
|
23
|
+
/**
|
24
|
+
* @import { QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'
|
25
|
+
*/
|
@@ -2,14 +2,10 @@ import { Question } from '~/src/form/form-editor/preview/question.js'
|
|
2
2
|
|
3
3
|
export class NumberOnlyQuestion extends Question {
|
4
4
|
/**
|
5
|
-
* @
|
5
|
+
* @returns {Partial<QuestionBaseModel>}
|
6
6
|
*/
|
7
|
-
get
|
7
|
+
get customRenderFields() {
|
8
8
|
return {
|
9
|
-
id: this._fieldName,
|
10
|
-
name: this._fieldName,
|
11
|
-
label: this.label,
|
12
|
-
hint: this.hint,
|
13
9
|
type: 'number'
|
14
10
|
}
|
15
11
|
}
|
@@ -119,6 +119,13 @@ export class Question {
|
|
119
119
|
}
|
120
120
|
}
|
121
121
|
|
122
|
+
/**
|
123
|
+
* @returns {Partial<QuestionBaseModel>}
|
124
|
+
*/
|
125
|
+
get customRenderFields() {
|
126
|
+
return {}
|
127
|
+
}
|
128
|
+
|
122
129
|
/**
|
123
130
|
* @type {QuestionBaseModel}
|
124
131
|
*/
|
@@ -127,7 +134,8 @@ export class Question {
|
|
127
134
|
id: this._fieldName,
|
128
135
|
name: this._fieldName,
|
129
136
|
label: this.label,
|
130
|
-
hint: this.hint
|
137
|
+
hint: this.hint,
|
138
|
+
...this.customRenderFields
|
131
139
|
}
|
132
140
|
}
|
133
141
|
|
@@ -40,7 +40,7 @@ export interface QuestionBaseModel {
|
|
40
40
|
readonly items?: ListItemReadonly[] | DateItem[]
|
41
41
|
text?: string
|
42
42
|
formGroup?: { afterInputs: { html: string } }
|
43
|
-
type?: 'text' | 'number'
|
43
|
+
type?: 'text' | 'number' | 'boolean'
|
44
44
|
}
|
45
45
|
|
46
46
|
export type ListenerRow = [
|
@@ -1,20 +1,8 @@
|
|
1
|
-
import {
|
1
|
+
import { FieldsetQuestion } from '~/src/form/form-editor/preview/fieldset-question.js'
|
2
2
|
|
3
|
-
export class UkAddressQuestion extends
|
3
|
+
export class UkAddressQuestion extends FieldsetQuestion {
|
4
4
|
_questionTemplate = 'ukaddressfield.njk'
|
5
5
|
_fieldName = 'addressField'
|
6
|
-
|
7
|
-
/**
|
8
|
-
* @type {QuestionBaseModel}
|
9
|
-
*/
|
10
|
-
get renderInput() {
|
11
|
-
return {
|
12
|
-
id: this._fieldName,
|
13
|
-
name: this._fieldName,
|
14
|
-
fieldset: this.fieldSet,
|
15
|
-
hint: this.hint
|
16
|
-
}
|
17
|
-
}
|
18
6
|
}
|
19
7
|
|
20
8
|
/**
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import { FieldsetQuestion } from '~/src/form/form-editor/preview/fieldset-question.js'
|
2
|
+
|
3
|
+
export class YesNoQuestion extends FieldsetQuestion {
|
4
|
+
/**
|
5
|
+
* @type {string}
|
6
|
+
* @protected
|
7
|
+
*/
|
8
|
+
_questionTemplate = 'radios.njk'
|
9
|
+
_fieldName = 'yesNo'
|
10
|
+
|
11
|
+
/**
|
12
|
+
* @returns {Partial<QuestionBaseModel>}
|
13
|
+
*/
|
14
|
+
get customRenderFields() {
|
15
|
+
/**
|
16
|
+
*
|
17
|
+
*/
|
18
|
+
return {
|
19
|
+
type: 'boolean',
|
20
|
+
items: /** @type {ListElement[]} */ ([
|
21
|
+
{
|
22
|
+
id: 'yesNo-yes',
|
23
|
+
text: 'Yes',
|
24
|
+
value: true,
|
25
|
+
label: {
|
26
|
+
text: 'Yes',
|
27
|
+
classes: ''
|
28
|
+
}
|
29
|
+
},
|
30
|
+
{
|
31
|
+
id: 'yesNo-no',
|
32
|
+
text: 'No',
|
33
|
+
value: false,
|
34
|
+
label: {
|
35
|
+
text: 'No',
|
36
|
+
classes: ''
|
37
|
+
}
|
38
|
+
}
|
39
|
+
])
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
/**
|
45
|
+
* @import { QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'
|
46
|
+
* @import { ListElement } from '~/src/form/form-editor/types.js'
|
47
|
+
*/
|
@@ -338,7 +338,7 @@ export interface ListItem {
|
|
338
338
|
hint?: {
|
339
339
|
text: string
|
340
340
|
}
|
341
|
-
value?: string
|
341
|
+
value?: string | boolean
|
342
342
|
}
|
343
343
|
|
344
344
|
export interface ListLabel {
|
@@ -349,7 +349,7 @@ export interface ListLabel {
|
|
349
349
|
export interface ListElement extends ListItem {
|
350
350
|
readonly id: string
|
351
351
|
text: string
|
352
|
-
value: string
|
352
|
+
value: string | boolean
|
353
353
|
label: ListLabel
|
354
354
|
}
|
355
355
|
|
@@ -360,7 +360,7 @@ export interface ReadonlyHint {
|
|
360
360
|
export interface ListItemReadonly extends ListElement {
|
361
361
|
readonly text: string
|
362
362
|
readonly hint?: ReadonlyHint
|
363
|
-
readonly value: string
|
363
|
+
readonly value: string | boolean
|
364
364
|
readonly label: ListLabel
|
365
365
|
}
|
366
366
|
|
@@ -376,7 +376,7 @@ export interface QuestionSessionState {
|
|
376
376
|
radioId?: string
|
377
377
|
radioText?: string
|
378
378
|
radioHint?: string
|
379
|
-
radioValue?: string
|
379
|
+
radioValue?: string | boolean
|
380
380
|
expanded?: boolean
|
381
381
|
}
|
382
382
|
listItems?: ListItem[]
|