@defra/forms-model 3.0.485 → 3.0.487
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-definition/index.js +5 -1
- package/dist/module/form/form-definition/index.js.map +1 -1
- package/dist/module/form/form-editor/__stubs__/preview.js +8 -3
- package/dist/module/form/form-editor/__stubs__/preview.js.map +1 -1
- package/dist/module/form/form-editor/preview/component-elements.js +10 -2
- package/dist/module/form/form-editor/preview/component-elements.js.map +1 -1
- package/dist/module/form/form-editor/preview/content.js +3 -2
- package/dist/module/form/form-editor/preview/content.js.map +1 -1
- package/dist/module/form/form-editor/preview/controller/page-controller.js +3 -17
- package/dist/module/form/form-editor/preview/controller/page-controller.js.map +1 -1
- package/dist/module/form/form-editor/preview/helpers.js +6 -5
- package/dist/module/form/form-editor/preview/helpers.js.map +1 -1
- package/dist/module/form/form-editor/preview/list.js +3 -2
- package/dist/module/form/form-editor/preview/list.js.map +1 -1
- package/dist/module/form/form-editor/preview/preview.js +12 -3
- package/dist/module/form/form-editor/preview/preview.js.map +1 -1
- package/dist/module/form/form-editor/preview/question.js +2 -2
- package/dist/module/form/form-editor/preview/question.js.map +1 -1
- package/dist/module/form/form-editor/preview/types.js.map +1 -1
- package/dist/types/form/form-definition/index.d.ts.map +1 -1
- package/dist/types/form/form-editor/__stubs__/preview.d.ts +2 -1
- package/dist/types/form/form-editor/__stubs__/preview.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/component-elements.d.ts +7 -1
- package/dist/types/form/form-editor/preview/component-elements.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/content.d.ts +2 -1
- package/dist/types/form/form-editor/preview/content.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/controller/page-controller.d.ts +0 -10
- package/dist/types/form/form-editor/preview/controller/page-controller.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/helpers.d.ts +2 -1
- package/dist/types/form/form-editor/preview/helpers.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/list.d.ts +2 -1
- package/dist/types/form/form-editor/preview/list.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/preview.d.ts +5 -0
- package/dist/types/form/form-editor/preview/preview.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/question.d.ts +1 -1
- package/dist/types/form/form-editor/preview/question.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/types.d.ts +1 -0
- package/dist/types/form/form-editor/preview/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/schemas/form-definition-v2-schema.json +5 -5
- package/src/form/form-definition/index.ts +5 -3
- package/src/form/form-editor/__stubs__/preview.js +15 -4
- package/src/form/form-editor/preview/component-elements.js +10 -2
- package/src/form/form-editor/preview/content.js +3 -2
- package/src/form/form-editor/preview/controller/page-controller.js +8 -17
- package/src/form/form-editor/preview/helpers.js +10 -5
- package/src/form/form-editor/preview/list.js +3 -2
- package/src/form/form-editor/preview/preview.js +15 -3
- package/src/form/form-editor/preview/question.js +2 -2
- package/src/form/form-editor/preview/types.ts +1 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"page-controller.js","names":["ComponentType","HIGHLIGHT_CLASS","ContentElements","mapComponentToPreviewQuestion","Markdown","hasComponents","questionRenderer","render","_questionTemplate","_questionBaseModel","PagePreviewElements","_page","constructor","page","heading","title","guidance","components","length","possibleGuidanceComponent","type","content","PreviewPageController","PATH","_pageTemplate","_components","pageRenderer","_highlighted","undefined","_guidanceText","_emptyGuidance","createGuidanceComponent","_guidanceComponent","_showGuidance","elements","definition","renderer","questions","map","firstQuestion","shift","getOrCreateGuidanceComponent","constructComponents","#constructComponents","_guidanceComponents","componentsWithGuidance","component","model","renderInput","questionType","componentType","guidanceText","text","classes","_fallBackTitle","question","pageTitle","value","highlightTitle","setHighLighted","guidanceElement","name","options","guidanceComponent","highlightContent","highlightGuidance","highlightSection","clearHighlight","unHighlightContent"],"sources":["../../../../../../src/form/form-editor/preview/controller/page-controller.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { HIGHLIGHT_CLASS } from '~/src/form/form-editor/preview/constants.js'\nimport { ContentElements } from '~/src/form/form-editor/preview/content.js'\nimport { mapComponentToPreviewQuestion } from '~/src/form/form-editor/preview/helpers.js'\nimport { Markdown } from '~/src/form/form-editor/preview/markdown.js'\nimport { hasComponents } from '~/src/pages/helpers.js'\n/**\n * @type {QuestionRenderer}\n */\nconst questionRenderer = {\n /**\n * @param {string} _questionTemplate\n * @param {QuestionBaseModel} _questionBaseModel\n */\n render(_questionTemplate, _questionBaseModel) {\n //\n }\n}\n\n/**\n * @implements {PageOverviewElements}\n */\nexport class PagePreviewElements {\n /**\n * @type {Page}\n * @private\n */\n _page\n /**\n * @param {Page} page\n */\n constructor(page) {\n this._page = page\n }\n\n get heading() {\n return this._page.title\n }\n\n get guidance() {\n if (!hasComponents(this._page) || !this._page.components.length) {\n return ''\n }\n\n const [possibleGuidanceComponent] = this._page.components\n\n return possibleGuidanceComponent.type === ComponentType.Markdown\n ? possibleGuidanceComponent.content\n : ''\n }\n}\n\n/**\n * @implements {PagePreviewPanelMacro}\n */\nexport class PreviewPageController {\n static PATH = 'preview-controllers/'\n /**\n * @type {string}\n * @protected\n */\n _pageTemplate = PreviewPageController.PATH + 'page-controller.njk'\n /**\n * @protected\n * @type {Question[]}\n */\n _components = []\n /**\n * @type {string}\n */\n #title = ''\n /**\n *\n * @type {PageRenderer}\n */\n #pageRenderer\n /**\n * @type { undefined | 'title' | 'guidance'}\n * @protected\n */\n _highlighted = undefined\n /**\n * @type {string}\n * @private\n */\n _guidanceText = ''\n /**\n * @type {Markdown}\n * @private\n */\n _emptyGuidance = PreviewPageController.createGuidanceComponent()\n /**\n *\n * @type {Markdown}\n * @protected\n */\n _guidanceComponent\n\n /**\n * @type {boolean}\n * @private\n */\n _showGuidance = false\n /**\n * @param {ComponentDef[]} components\n * @param {PageOverviewElements} elements\n * @param {FormDefinition} definition\n * @param {PageRenderer} renderer\n */\n constructor(components, elements, definition, renderer) {\n const questions = components.map(\n mapComponentToPreviewQuestion(questionRenderer, definition)\n )\n const firstQuestion = /** @type { Markdown | undefined | Question } */ (\n questions.shift()\n )\n\n this._guidanceComponent =\n PreviewPageController.getOrCreateGuidanceComponent(firstQuestion)\n this._guidanceText = elements.guidance\n this._components = this.#constructComponents(firstQuestion, questions)\n this.#title = elements.heading\n this.#pageRenderer = renderer\n }\n\n /**\n * @param { Question | Markdown | undefined} firstQuestion\n * @param {Question[]} questions\n * @returns {Question[]}\n */\n #constructComponents(firstQuestion, questions) {\n return firstQuestion instanceof Markdown || firstQuestion === undefined\n ? questions\n : [firstQuestion, ...questions]\n }\n\n /**\n * @returns {Markdown[]}\n * @private\n */\n get _guidanceComponents() {\n if (this._guidanceText.length) {\n return [this._guidanceComponent]\n }\n if (this._highlighted === 'guidance') {\n return [this._emptyGuidance]\n }\n return []\n }\n\n /**\n * @returns {PagePreviewComponent[]}\n */\n get components() {\n const componentsWithGuidance = /** @type {Question[]} */ ([\n ...this._guidanceComponents,\n ...this._components\n ])\n\n return componentsWithGuidance.map((component) => ({\n model: component.renderInput,\n questionType: component.componentType\n }))\n }\n\n set guidanceText(text) {\n this._guidanceText = text\n this._guidanceComponent.content = text\n this.render()\n }\n\n get guidanceText() {\n return this._guidanceText\n }\n\n get guidance() {\n return {\n text: this.guidanceText,\n classes: this._highlighted === 'guidance' ? 'highlight' : ''\n }\n }\n\n /**\n * @private\n * @returns {string}\n */\n _fallBackTitle() {\n return this._components[0]?.question ?? ''\n }\n\n /**\n * @returns {{ text: string, classes: string }}\n */\n get pageTitle() {\n return {\n text: this.title,\n classes: this._highlighted === 'title' ? HIGHLIGHT_CLASS : ''\n }\n }\n\n render() {\n this.#pageRenderer.render(this._pageTemplate, this)\n }\n\n /**\n * @returns {string}\n */\n get title() {\n return this.#title.length ? this.#title : this._fallBackTitle()\n }\n\n /**\n * @param {string} value\n */\n set title(value) {\n this.#title = value\n this.render()\n }\n\n highlightTitle() {\n this.setHighLighted('title')\n }\n\n /**\n * Creates a dummy component for when guidance is highlighted\n * but no guidance text exists\n * @returns {Markdown}\n */\n static createGuidanceComponent() {\n const guidanceElement = new ContentElements({\n type: ComponentType.Markdown,\n title: 'Guidance component',\n name: 'guidanceComponent',\n content: 'Guidance text',\n options: {}\n })\n const guidanceComponent = new Markdown(guidanceElement, questionRenderer)\n\n // the dummy component should always be highlighted\n guidanceComponent.highlightContent()\n return guidanceComponent\n }\n\n /**\n * Helper method to return the guidance or a new one\n * @param { Markdown | Question | undefined } guidanceComponent\n * @returns {Markdown}\n * @private\n */\n static getOrCreateGuidanceComponent(guidanceComponent) {\n if (guidanceComponent instanceof Markdown) {\n return guidanceComponent\n }\n return PreviewPageController.createGuidanceComponent()\n }\n\n highlightGuidance() {\n this._guidanceComponent.highlightContent()\n this.setHighLighted('guidance')\n }\n\n /**\n * @param {'title'|'guidance'} highlightSection\n */\n setHighLighted(highlightSection) {\n this._highlighted = highlightSection\n this.render()\n }\n\n clearHighlight() {\n this._highlighted = undefined\n\n this._guidanceComponent.unHighlightContent()\n this.render()\n }\n}\n\n/**\n * @import { PageRenderer, PageOverviewElements, QuestionRenderer, QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'\n * @import { Question } from '~/src/form/form-editor/preview/question.js'\n * @import { FormDefinition, Page } from '~/src/form/form-definition/types.js'\n * @import { ComponentDef, MarkdownComponent } from '~/src/components/types.js'\n * @import { PagePreviewComponent, PagePreviewPanelMacro } from '~/src/form/form-editor/macros/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,eAAe;AACxB,SAASC,eAAe;AACxB,SAASC,6BAA6B;AACtC,SAASC,QAAQ;AACjB,SAASC,aAAa;AACtB;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG;EACvB;AACF;AACA;AACA;EACEC,MAAMA,CAACC,iBAAiB,EAAEC,kBAAkB,EAAE;IAC5C;EAAA;AAEJ,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,C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Ac,CAAC,OAAO,CAAC;EAC9B;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAO5B,uBAAuBA,CAAA,EAAG;IAC/B,MAAM6B,eAAe,GAAG,IAAI1D,eAAe,CAAC;MAC1CkB,IAAI,EAAEpB,aAAa,CAACI,QAAQ;MAC5BW,KAAK,EAAE,oBAAoB;MAC3B8C,IAAI,EAAE,mBAAmB;MACzBxC,OAAO,EAAE,eAAe;MACxByC,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC;IACF,MAAMC,iBAAiB,GAAG,IAAI3D,QAAQ,CAACwD,eAAe,EAAEtD,gBAAgB,CAAC;;IAEzE;IACAyD,iBAAiB,CAACC,gBAAgB,CAAC,CAAC;IACpC,OAAOD,iBAAiB;EAC1B;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,OAAOtB,4BAA4BA,CAACsB,iBAAiB,EAAE;IACrD,IAAIA,iBAAiB,YAAY3D,QAAQ,EAAE;MACzC,OAAO2D,iBAAiB;IAC1B;IACA,OAAOzC,qBAAqB,CAACS,uBAAuB,CAAC,CAAC;EACxD;EAEAkC,iBAAiBA,CAAA,EAAG;IAClB,IAAI,CAACjC,kBAAkB,CAACgC,gBAAgB,CAAC,CAAC;IAC1C,IAAI,CAACL,cAAc,CAAC,UAAU,CAAC;EACjC;;EAEA;AACF;AACA;EACEA,cAAcA,CAACO,gBAAgB,EAAE;IAC/B,IAAI,CAACvC,YAAY,GAAGuC,gBAAgB;IACpC,IAAI,CAAC3D,MAAM,CAAC,CAAC;EACf;EAEA4D,cAAcA,CAAA,EAAG;IACf,IAAI,CAACxC,YAAY,GAAGC,SAAS;IAE7B,IAAI,CAACI,kBAAkB,CAACoC,kBAAkB,CAAC,CAAC;IAC5C,IAAI,CAAC7D,MAAM,CAAC,CAAC;EACf;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
1
|
+
{"version":3,"file":"page-controller.js","names":["ComponentType","HIGHLIGHT_CLASS","ContentElements","mapComponentToPreviewQuestion","Markdown","hasComponents","questionRenderer","render","_questionTemplate","_questionBaseModel","PagePreviewElements","_page","constructor","page","heading","title","guidance","components","length","possibleGuidanceComponent","type","content","PreviewPageController","PATH","_pageTemplate","_components","pageRenderer","_highlighted","undefined","_guidanceText","_emptyGuidance","createGuidanceComponent","_guidanceComponent","elements","definition","renderer","questions","map","firstQuestion","shift","getOrCreateGuidanceComponent","constructComponents","#constructComponents","_guidanceComponents","componentsWithGuidance","component","model","renderInput","questionType","componentType","guidanceText","text","classes","pageTitle","value","highlightTitle","setHighLighted","guidanceElement","name","options","guidanceComponent","highlightContent","highlightGuidance","highlightSection","clearHighlight","unHighlightContent"],"sources":["../../../../../../src/form/form-editor/preview/controller/page-controller.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { HIGHLIGHT_CLASS } from '~/src/form/form-editor/preview/constants.js'\nimport { ContentElements } from '~/src/form/form-editor/preview/content.js'\nimport { mapComponentToPreviewQuestion } from '~/src/form/form-editor/preview/helpers.js'\nimport { Markdown } from '~/src/form/form-editor/preview/markdown.js'\nimport { hasComponents } from '~/src/pages/helpers.js'\n/**\n * @type {QuestionRenderer}\n */\nconst questionRenderer = {\n /**\n * @param {string} _questionTemplate\n * @param {QuestionBaseModel} _questionBaseModel\n */\n render(_questionTemplate, _questionBaseModel) {\n //\n }\n}\n\n/**\n * @implements {PageOverviewElements}\n */\nexport class PagePreviewElements {\n /**\n * @type {Page}\n * @private\n */\n _page\n /**\n * @param {Page} page\n */\n constructor(page) {\n this._page = page\n }\n\n get heading() {\n return this._page.title\n }\n\n get guidance() {\n if (!hasComponents(this._page) || !this._page.components.length) {\n return ''\n }\n\n const [possibleGuidanceComponent] = this._page.components\n\n return possibleGuidanceComponent.type === ComponentType.Markdown\n ? possibleGuidanceComponent.content\n : ''\n }\n}\n\n/**\n * @implements {PagePreviewPanelMacro}\n */\nexport class PreviewPageController {\n static PATH = 'preview-controllers/'\n /**\n * @type {string}\n * @protected\n */\n _pageTemplate = PreviewPageController.PATH + 'page-controller.njk'\n /**\n * @protected\n * @type {Question[]}\n */\n _components = []\n /**\n * @type {string}\n */\n #title = ''\n /**\n *\n * @type {PageRenderer}\n */\n #pageRenderer\n /**\n * @type { undefined | 'title' | 'guidance'}\n * @protected\n */\n _highlighted = undefined\n /**\n * @type {string}\n * @private\n */\n _guidanceText = ''\n /**\n * @type {Markdown}\n * @private\n */\n _emptyGuidance = PreviewPageController.createGuidanceComponent()\n /**\n *\n * @type {Markdown}\n * @protected\n */\n _guidanceComponent\n /**\n * @param {ComponentDef[]} components\n * @param {PageOverviewElements} elements\n * @param {FormDefinition} definition\n * @param {PageRenderer} renderer\n */\n constructor(components, elements, definition, renderer) {\n const questions = components.map(\n mapComponentToPreviewQuestion(\n questionRenderer,\n definition,\n elements.heading.length > 0\n )\n )\n const firstQuestion = /** @type { Markdown | undefined | Question } */ (\n questions.shift()\n )\n\n this._guidanceComponent =\n PreviewPageController.getOrCreateGuidanceComponent(firstQuestion)\n this._guidanceText = elements.guidance\n this._components = this.#constructComponents(firstQuestion, questions)\n\n this.#pageRenderer = renderer\n this.#title = elements.heading\n }\n\n /**\n * @param { Question | Markdown | undefined} firstQuestion\n * @param {Question[]} questions\n * @returns {Question[]}\n */\n #constructComponents(firstQuestion, questions) {\n return firstQuestion instanceof Markdown || firstQuestion === undefined\n ? questions\n : [firstQuestion, ...questions]\n }\n\n /**\n * @returns {Markdown[]}\n * @private\n */\n get _guidanceComponents() {\n if (this._guidanceText.length) {\n return [this._guidanceComponent]\n }\n if (this._highlighted === 'guidance') {\n return [this._emptyGuidance]\n }\n return []\n }\n\n /**\n * @returns {PagePreviewComponent[]}\n */\n get components() {\n const componentsWithGuidance = /** @type {Question[]} */ ([\n ...this._guidanceComponents,\n ...this._components\n ])\n\n return componentsWithGuidance.map((component) => ({\n model: component.renderInput,\n questionType: component.componentType\n }))\n }\n\n set guidanceText(text) {\n this._guidanceText = text\n this._guidanceComponent.content = text\n this.render()\n }\n\n get guidanceText() {\n return this._guidanceText\n }\n\n get guidance() {\n return {\n text: this.guidanceText,\n classes: this._highlighted === 'guidance' ? 'highlight' : ''\n }\n }\n\n /**\n * @returns {{ text: string, classes: string }}\n */\n get pageTitle() {\n return {\n text: this.title,\n classes: this._highlighted === 'title' ? HIGHLIGHT_CLASS : ''\n }\n }\n\n render() {\n this.#pageRenderer.render(this._pageTemplate, this)\n }\n\n /**\n * @returns {string}\n */\n get title() {\n return this.#title\n }\n\n /**\n * @param {string} value\n */\n set title(value) {\n this.#title = value\n this.render()\n }\n\n highlightTitle() {\n this.setHighLighted('title')\n }\n\n /**\n * Creates a dummy component for when guidance is highlighted\n * but no guidance text exists\n * @returns {Markdown}\n */\n static createGuidanceComponent() {\n const guidanceElement = new ContentElements({\n type: ComponentType.Markdown,\n title: 'Guidance component',\n name: 'guidanceComponent',\n content: 'Guidance text',\n options: {}\n })\n const guidanceComponent = new Markdown(guidanceElement, questionRenderer)\n\n // the dummy component should always be highlighted\n guidanceComponent.highlightContent()\n return guidanceComponent\n }\n\n /**\n * Helper method to return the guidance or a new one\n * @param { Markdown | Question | undefined } guidanceComponent\n * @returns {Markdown}\n * @private\n */\n static getOrCreateGuidanceComponent(guidanceComponent) {\n if (guidanceComponent instanceof Markdown) {\n return guidanceComponent\n }\n return PreviewPageController.createGuidanceComponent()\n }\n\n highlightGuidance() {\n this._guidanceComponent.highlightContent()\n this.setHighLighted('guidance')\n }\n\n /**\n * @param {'title'|'guidance'} highlightSection\n */\n setHighLighted(highlightSection) {\n this._highlighted = highlightSection\n this.render()\n }\n\n clearHighlight() {\n this._highlighted = undefined\n\n this._guidanceComponent.unHighlightContent()\n this.render()\n }\n}\n\n/**\n * @import { PageRenderer, PageOverviewElements, QuestionRenderer, QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'\n * @import { Question } from '~/src/form/form-editor/preview/question.js'\n * @import { FormDefinition, Page } from '~/src/form/form-definition/types.js'\n * @import { ComponentDef, MarkdownComponent } from '~/src/components/types.js'\n * @import { PagePreviewComponent, PagePreviewPanelMacro } from '~/src/form/form-editor/macros/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,eAAe;AACxB,SAASC,eAAe;AACxB,SAASC,6BAA6B;AACtC,SAASC,QAAQ;AACjB,SAASC,aAAa;AACtB;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG;EACvB;AACF;AACA;AACA;EACEC,MAAMA,CAACC,iBAAiB,EAAEC,kBAAkB,EAAE;IAC5C;EAAA;AAEJ,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,CAAC;EAC/B;AACF;AACA;AACA;EACEC,KAAK;EACL;AACF;AACA;EACEC,WAAWA,CAACC,IAAI,EAAE;IAChB,IAAI,CAACF,KAAK,GAAGE,IAAI;EACnB;EAEA,IAAIC,OAAOA,CAAA,EAAG;IACZ,OAAO,IAAI,CAACH,KAAK,CAACI,KAAK;EACzB;EAEA,IAAIC,QAAQA,CAAA,EAAG;IACb,IAAI,CAACX,aAAa,CAAC,IAAI,CAACM,KAAK,CAAC,IAAI,CAAC,IAAI,CAACA,KAAK,CAACM,UAAU,CAACC,MAAM,EAAE;MAC/D,OAAO,EAAE;IACX;IAEA,MAAM,CAACC,yBAAyB,CAAC,GAAG,IAAI,CAACR,KAAK,CAACM,UAAU;IAEzD,OAAOE,yBAAyB,CAACC,IAAI,KAAKpB,aAAa,CAACI,QAAQ,GAC5De,yBAAyB,CAACE,OAAO,GACjC,EAAE;EACR;AACF;;AAEA;AACA;AACA;AACA,OAAO,MAAMC,qBAAqB,CAAC;EACjC,OAAOC,IAAI,GAAG,sBAAsB;EACpC;AACF;AACA;AACA;EACEC,aAAa,GAAGF,qBAAqB,CAACC,IAAI,GAAG,qBAAqB;EAClE;AACF;AACA;AACA;EACEE,WAAW,GAAG,EAAE;EAChB;AACF;AACA;EACE,CAACV,KAAK,GAAG,EAAE;EACX;AACF;AACA;AACA;EACE,CAACW,YAAY;EACb;AACF;AACA;AACA;E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C;IAC5C,IAAI,CAAC1D,MAAM,CAAC,CAAC;EACf;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
@@ -48,9 +48,10 @@ const InputFieldComponentDictionary = {
|
|
48
48
|
/**
|
49
49
|
* @param {QuestionRenderer} questionRenderer
|
50
50
|
* @param {FormDefinition} definition
|
51
|
+
* @param {boolean} hasTitle
|
51
52
|
* @returns {(component: ComponentDef) => Question}
|
52
53
|
*/
|
53
|
-
export function mapComponentToPreviewQuestion(questionRenderer, definition) {
|
54
|
+
export function mapComponentToPreviewQuestion(questionRenderer, definition, hasTitle) {
|
54
55
|
return /** @type {(component: ComponentDef) => Question} */component => {
|
55
56
|
/**
|
56
57
|
* @type {QuestionElements}
|
@@ -58,13 +59,13 @@ export function mapComponentToPreviewQuestion(questionRenderer, definition) {
|
|
58
59
|
let questionElements;
|
59
60
|
if (hasSelectionFields(component) && hasListField(component)) {
|
60
61
|
const list = findDefinitionListFromComponent(component, definition);
|
61
|
-
questionElements = new ListComponentElements(component, list);
|
62
|
+
questionElements = new ListComponentElements(component, list, !hasTitle);
|
62
63
|
} else if (hasInputField(component) || component.type === ComponentType.YesNoField) {
|
63
|
-
questionElements = new QuestionComponentElements(component);
|
64
|
+
questionElements = new QuestionComponentElements(component, !hasTitle);
|
64
65
|
} else if (hasContentField(component)) {
|
65
|
-
questionElements = new ContentElements(component);
|
66
|
+
questionElements = new ContentElements(component, !hasTitle);
|
66
67
|
} else {
|
67
|
-
questionElements = new ComponentElements(component);
|
68
|
+
questionElements = new ComponentElements(component, !hasTitle);
|
68
69
|
}
|
69
70
|
const QuestionConstructor = InputFieldComponentDictionary[component.type];
|
70
71
|
return new QuestionConstructor(questionElements, questionRenderer);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.js","names":["ComponentType","AutocompleteListQuestion","CheckboxQuestion","ComponentElements","ContentElements","DateInputQuestion","EmailAddressQuestion","ListQuestion","LongAnswerQuestion","Markdown","MonthYearQuestion","NumberOnlyQuestion","PhoneNumberQuestion","RadioQuestion","SelectQuestion","ShortAnswerQuestion","SupportingEvidenceQuestion","UkAddressQuestion","YesNoQuestion","findDefinitionListFromComponent","ListComponentElements","QuestionComponentElements","hasContentField","hasInputField","hasListField","hasSelectionFields","InputFieldComponentDictionary","TextField","Details","InsetText","Html","List","EmailAddressField","NumberField","MultilineTextField","TelephoneNumberField","MonthYearField","DatePartsField","UkAddressField","AutocompleteField","RadiosField","CheckboxesField","SelectField","YesNoField","FileUploadField","mapComponentToPreviewQuestion","questionRenderer","definition","component","questionElements","list","type","QuestionConstructor"],"sources":["../../../../../src/form/form-editor/preview/helpers.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { AutocompleteListQuestion } from '~/src/form/form-editor/preview/autocomplete.js'\nimport { CheckboxQuestion } from '~/src/form/form-editor/preview/checkbox.js'\nimport { ComponentElements } from '~/src/form/form-editor/preview/component-elements.js'\nimport { ContentElements } from '~/src/form/form-editor/preview/content.js'\nimport { DateInputQuestion } from '~/src/form/form-editor/preview/date-input.js'\nimport { EmailAddressQuestion } from '~/src/form/form-editor/preview/email-address.js'\nimport { ListQuestion } from '~/src/form/form-editor/preview/list.js'\nimport { LongAnswerQuestion } from '~/src/form/form-editor/preview/long-answer.js'\nimport { Markdown } from '~/src/form/form-editor/preview/markdown.js'\nimport { MonthYearQuestion } from '~/src/form/form-editor/preview/month-year.js'\nimport { NumberOnlyQuestion } from '~/src/form/form-editor/preview/number-only.js'\nimport { PhoneNumberQuestion } from '~/src/form/form-editor/preview/phone-number.js'\nimport { RadioQuestion } from '~/src/form/form-editor/preview/radio.js'\nimport { SelectQuestion } from '~/src/form/form-editor/preview/select.js'\nimport { ShortAnswerQuestion } from '~/src/form/form-editor/preview/short-answer.js'\nimport { SupportingEvidenceQuestion } from '~/src/form/form-editor/preview/supporting-evidence.js'\nimport { UkAddressQuestion } from '~/src/form/form-editor/preview/uk-address.js'\nimport { YesNoQuestion } from '~/src/form/form-editor/preview/yes-no.js'\nimport { findDefinitionListFromComponent } from '~/src/form/utils/list.js'\nimport {\n ListComponentElements,\n QuestionComponentElements,\n hasContentField,\n hasInputField,\n hasListField,\n hasSelectionFields\n} from '~/src/index.js'\n\n/**\n * @type {Record<ComponentType, typeof PreviewComponent>}\n */\nconst InputFieldComponentDictionary = {\n [ComponentType.TextField]: ShortAnswerQuestion,\n [ComponentType.Details]: ShortAnswerQuestion,\n [ComponentType.InsetText]: ShortAnswerQuestion,\n [ComponentType.Html]: ShortAnswerQuestion,\n [ComponentType.Markdown]: Markdown,\n [ComponentType.List]: ListQuestion,\n [ComponentType.EmailAddressField]: EmailAddressQuestion,\n [ComponentType.NumberField]: NumberOnlyQuestion,\n [ComponentType.MultilineTextField]: LongAnswerQuestion,\n [ComponentType.TelephoneNumberField]: PhoneNumberQuestion,\n [ComponentType.MonthYearField]: MonthYearQuestion,\n [ComponentType.DatePartsField]: DateInputQuestion,\n [ComponentType.UkAddressField]: UkAddressQuestion,\n [ComponentType.AutocompleteField]: AutocompleteListQuestion,\n [ComponentType.RadiosField]: RadioQuestion,\n [ComponentType.CheckboxesField]: CheckboxQuestion,\n [ComponentType.SelectField]: SelectQuestion,\n [ComponentType.YesNoField]: YesNoQuestion,\n [ComponentType.FileUploadField]: SupportingEvidenceQuestion\n}\n\n/**\n * @param {QuestionRenderer} questionRenderer\n * @param {FormDefinition} definition\n * @returns {(component: ComponentDef) => Question}\n */\nexport function mapComponentToPreviewQuestion(questionRenderer
|
1
|
+
{"version":3,"file":"helpers.js","names":["ComponentType","AutocompleteListQuestion","CheckboxQuestion","ComponentElements","ContentElements","DateInputQuestion","EmailAddressQuestion","ListQuestion","LongAnswerQuestion","Markdown","MonthYearQuestion","NumberOnlyQuestion","PhoneNumberQuestion","RadioQuestion","SelectQuestion","ShortAnswerQuestion","SupportingEvidenceQuestion","UkAddressQuestion","YesNoQuestion","findDefinitionListFromComponent","ListComponentElements","QuestionComponentElements","hasContentField","hasInputField","hasListField","hasSelectionFields","InputFieldComponentDictionary","TextField","Details","InsetText","Html","List","EmailAddressField","NumberField","MultilineTextField","TelephoneNumberField","MonthYearField","DatePartsField","UkAddressField","AutocompleteField","RadiosField","CheckboxesField","SelectField","YesNoField","FileUploadField","mapComponentToPreviewQuestion","questionRenderer","definition","hasTitle","component","questionElements","list","type","QuestionConstructor"],"sources":["../../../../../src/form/form-editor/preview/helpers.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { AutocompleteListQuestion } from '~/src/form/form-editor/preview/autocomplete.js'\nimport { CheckboxQuestion } from '~/src/form/form-editor/preview/checkbox.js'\nimport { ComponentElements } from '~/src/form/form-editor/preview/component-elements.js'\nimport { ContentElements } from '~/src/form/form-editor/preview/content.js'\nimport { DateInputQuestion } from '~/src/form/form-editor/preview/date-input.js'\nimport { EmailAddressQuestion } from '~/src/form/form-editor/preview/email-address.js'\nimport { ListQuestion } from '~/src/form/form-editor/preview/list.js'\nimport { LongAnswerQuestion } from '~/src/form/form-editor/preview/long-answer.js'\nimport { Markdown } from '~/src/form/form-editor/preview/markdown.js'\nimport { MonthYearQuestion } from '~/src/form/form-editor/preview/month-year.js'\nimport { NumberOnlyQuestion } from '~/src/form/form-editor/preview/number-only.js'\nimport { PhoneNumberQuestion } from '~/src/form/form-editor/preview/phone-number.js'\nimport { RadioQuestion } from '~/src/form/form-editor/preview/radio.js'\nimport { SelectQuestion } from '~/src/form/form-editor/preview/select.js'\nimport { ShortAnswerQuestion } from '~/src/form/form-editor/preview/short-answer.js'\nimport { SupportingEvidenceQuestion } from '~/src/form/form-editor/preview/supporting-evidence.js'\nimport { UkAddressQuestion } from '~/src/form/form-editor/preview/uk-address.js'\nimport { YesNoQuestion } from '~/src/form/form-editor/preview/yes-no.js'\nimport { findDefinitionListFromComponent } from '~/src/form/utils/list.js'\nimport {\n ListComponentElements,\n QuestionComponentElements,\n hasContentField,\n hasInputField,\n hasListField,\n hasSelectionFields\n} from '~/src/index.js'\n\n/**\n * @type {Record<ComponentType, typeof PreviewComponent>}\n */\nconst InputFieldComponentDictionary = {\n [ComponentType.TextField]: ShortAnswerQuestion,\n [ComponentType.Details]: ShortAnswerQuestion,\n [ComponentType.InsetText]: ShortAnswerQuestion,\n [ComponentType.Html]: ShortAnswerQuestion,\n [ComponentType.Markdown]: Markdown,\n [ComponentType.List]: ListQuestion,\n [ComponentType.EmailAddressField]: EmailAddressQuestion,\n [ComponentType.NumberField]: NumberOnlyQuestion,\n [ComponentType.MultilineTextField]: LongAnswerQuestion,\n [ComponentType.TelephoneNumberField]: PhoneNumberQuestion,\n [ComponentType.MonthYearField]: MonthYearQuestion,\n [ComponentType.DatePartsField]: DateInputQuestion,\n [ComponentType.UkAddressField]: UkAddressQuestion,\n [ComponentType.AutocompleteField]: AutocompleteListQuestion,\n [ComponentType.RadiosField]: RadioQuestion,\n [ComponentType.CheckboxesField]: CheckboxQuestion,\n [ComponentType.SelectField]: SelectQuestion,\n [ComponentType.YesNoField]: YesNoQuestion,\n [ComponentType.FileUploadField]: SupportingEvidenceQuestion\n}\n\n/**\n * @param {QuestionRenderer} questionRenderer\n * @param {FormDefinition} definition\n * @param {boolean} hasTitle\n * @returns {(component: ComponentDef) => Question}\n */\nexport function mapComponentToPreviewQuestion(\n questionRenderer,\n definition,\n hasTitle\n) {\n return /** @type {(component: ComponentDef) => Question} */ (\n (component) => {\n /**\n * @type {QuestionElements}\n */\n let questionElements\n\n if (hasSelectionFields(component) && hasListField(component)) {\n const list = findDefinitionListFromComponent(component, definition)\n questionElements = new ListComponentElements(component, list, !hasTitle)\n } else if (\n hasInputField(component) ||\n component.type === ComponentType.YesNoField\n ) {\n questionElements = new QuestionComponentElements(component, !hasTitle)\n } else if (hasContentField(component)) {\n questionElements = new ContentElements(component, !hasTitle)\n } else {\n questionElements = new ComponentElements(component, !hasTitle)\n }\n\n const QuestionConstructor = InputFieldComponentDictionary[component.type]\n\n return new QuestionConstructor(questionElements, questionRenderer)\n }\n )\n}\n\n/**\n * @import { QuestionElements, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { Question } from '~/src/form/form-editor/preview/question.js'\n * @import { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n * @import { Item, FormDefinition } from '~/src/form/form-definition/types.js'\n * @import { FormComponentsDef, ComponentDef } from '~/src/components/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,wBAAwB;AACjC,SAASC,gBAAgB;AACzB,SAASC,iBAAiB;AAC1B,SAASC,eAAe;AACxB,SAASC,iBAAiB;AAC1B,SAASC,oBAAoB;AAC7B,SAASC,YAAY;AACrB,SAASC,kBAAkB;AAC3B,SAASC,QAAQ;AACjB,SAASC,iBAAiB;AAC1B,SAASC,kBAAkB;AAC3B,SAASC,mBAAmB;AAC5B,SAASC,aAAa;AACtB,SAASC,cAAc;AACvB,SAASC,mBAAmB;AAC5B,SAASC,0BAA0B;AACnC,SAASC,iBAAiB;AAC1B,SAASC,aAAa;AACtB,SAASC,+BAA+B;AACxC,SACEC,qBAAqB,EACrBC,yBAAyB,EACzBC,eAAe,EACfC,aAAa,EACbC,YAAY,EACZC,kBAAkB;;AAGpB;AACA;AACA;AACA,MAAMC,6BAA6B,GAAG;EACpC,CAAC1B,aAAa,CAAC2B,SAAS,GAAGZ,mBAAmB;EAC9C,CAACf,aAAa,CAAC4B,OAAO,GAAGb,mBAAmB;EAC5C,CAACf,aAAa,CAAC6B,SAAS,GAAGd,mBAAmB;EAC9C,CAACf,aAAa,CAAC8B,IAAI,GAAGf,mBAAmB;EACzC,CAACf,aAAa,CAACS,QAAQ,GAAGA,QAAQ;EAClC,CAACT,aAAa,CAAC+B,IAAI,GAAGxB,YAAY;EAClC,CAACP,aAAa,CAACgC,iBAAiB,GAAG1B,oBAAoB;EACvD,CAACN,aAAa,CAACiC,WAAW,GAAGtB,kBAAkB;EAC/C,CAACX,aAAa,CAACkC,kBAAkB,GAAG1B,kBAAkB;EACtD,CAACR,aAAa,CAACmC,oBAAoB,G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B,GAAG,IAAI/C,iBAAiB,CAAC8C,SAAS,EAAE,CAACD,QAAQ,CAAC;IAChE;IAEA,MAAMK,mBAAmB,GAAG3B,6BAA6B,CAACuB,SAAS,CAACG,IAAI,CAAC;IAEzE,OAAO,IAAIC,mBAAmB,CAACH,gBAAgB,EAAEJ,gBAAgB,CAAC;EACpE,CAAC;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
@@ -57,9 +57,10 @@ export class ListComponentElements extends QuestionComponentElements {
|
|
57
57
|
/**
|
58
58
|
* @param {SelectionComponentsDef} component
|
59
59
|
* @param {List} list
|
60
|
+
* @param {boolean} largeTitle
|
60
61
|
*/
|
61
|
-
constructor(component, list) {
|
62
|
-
super(component);
|
62
|
+
constructor(component, list, largeTitle = true) {
|
63
|
+
super(component, largeTitle);
|
63
64
|
this._list = list;
|
64
65
|
}
|
65
66
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"list.js","names":["ComponentType","PreviewComponent","Question","QuestionComponentElements","DefaultListConst","TextElementId","HintElementId","Template","PATH","Input","RenderName","listItemMapper","listElement","id","listsElementToMap","listElements","entries","map","Map","listItemToListElement","item","text","label","classes","value","hint","ListComponentElements","_list","constructor","component","list","_getValues","items","ListQuestion","componentType","List","_questionTemplate","_listElements","listRenderId","listRenderName","questionRenderer","values","createListFromElements","renderInput","afterInputs","length","formGroup","html","afterInputsHTML","name","fieldset","fieldSet","push","set","render","delete","key","iterator","Array","from","listItem","hintText","_highlight","getHighlight","undefined","updateText","get","updateHint","updateValue"],"sources":["../../../../../src/form/form-editor/preview/list.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\nimport {\n Question,\n QuestionComponentElements\n} from '~/src/form/form-editor/preview/question.js'\n\nconst DefaultListConst = {\n TextElementId: 'radioText',\n HintElementId: 'radioHint',\n Template: PreviewComponent.PATH + 'radios.njk',\n Input: 'listInput',\n RenderName: 'listInputField'\n}\n\n/**\n * @param {ListElement} listElement\n * @returns {[string, ListElement]}\n */\nexport function listItemMapper(listElement) {\n return [listElement.id, listElement]\n}\n\n/**\n *\n * @param { ListElement[]| undefined } listElements\n * @returns {Map<string, ListElement>}\n */\nexport function listsElementToMap(listElements) {\n const entries = listElements ? listElements.map(listItemMapper) : []\n return new Map(entries)\n}\n\n/**\n * @param {Item} item\n * @returns {ListElement}\n */\nexport function listItemToListElement(item) {\n return {\n text: item.text,\n label: {\n text: item.text,\n classes: ''\n },\n value: item.value,\n id: item.id ?? '',\n hint: item.hint\n }\n}\n\n/**\n * @implements {QuestionElements}\n */\nexport class ListComponentElements extends QuestionComponentElements {\n /**\n * @type {List}\n * @protected\n */\n _list\n\n /**\n * @param {SelectionComponentsDef} component\n * @param {List} list\n */\n constructor(component, list) {\n super(component)\n this._list = list\n }\n\n /**\n * @returns {BaseSettings}\n * @protected\n */\n _getValues() {\n return {\n ...super._getValues(),\n items: this._list.items.map(listItemToListElement)\n }\n }\n}\n\nexport class ListQuestion extends Question {\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.List\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = DefaultListConst.Template\n /** @type {ListElements} */\n _listElements\n listRenderId = DefaultListConst.Input\n listRenderName = DefaultListConst.RenderName\n\n /**\n * @type {Map<string, ListElement>}\n * @protected\n */\n _list\n\n /**\n * @param {ListElements} listElements\n * @param {QuestionRenderer} questionRenderer\n */\n constructor(listElements, questionRenderer) {\n super(listElements, questionRenderer)\n\n const items = /** @type {ListElement[]} */ (listElements.values.items)\n this._list = this.createListFromElements(items)\n this._listElements = listElements\n }\n\n /**\n * @returns {{\n * formGroup?: {afterInputs: {html: string}};\n * hint: DefaultComponent;\n * name: string;\n * fieldset?: GovukFieldset;\n * id: string;\n * items: ListItemReadonly[]\n * }}\n */\n get renderInput() {\n const afterInputs =\n /** @type {{ formGroup?: { afterInputs: { html: string } } }} */ (\n this.list.length\n ? {}\n : {\n formGroup: {\n afterInputs: {\n html: this._listElements.afterInputsHTML\n }\n }\n }\n )\n\n return {\n id: this.listRenderId,\n name: this.listRenderName,\n fieldset: this.fieldSet,\n hint: this.hint,\n items: this.list,\n ...afterInputs\n }\n }\n\n /**\n *\n * @param {ListElement} listElement\n */\n push(listElement) {\n this._list.set(listElement.id, listElement)\n this.render()\n }\n\n /**\n * @param {string} key\n */\n delete(key) {\n this._list.delete(key)\n this.render()\n }\n\n /**\n * @param {ListElement[]} listElements\n * @returns {Map<string, ListElement>}\n */\n createListFromElements(listElements) {\n this._list = listsElementToMap(listElements)\n return this._list\n }\n\n /**\n * @returns {ListItemReadonly[]}\n */\n get list() {\n const iterator = /** @type {MapIterator<ListElement>} */ (\n this._list.values()\n )\n return Array.from(iterator).map((listItem) => {\n const hintText =\n this._highlight === `${listItem.id}-hint` && !listItem.hint?.text.length\n ? 'Hint text'\n : (listItem.hint?.text ?? '')\n\n const hint = {\n hint: hintText\n ? {\n text: hintText,\n classes: this.getHighlight(listItem.id + '-hint')\n }\n : undefined\n }\n\n const text = listItem.text.length ? listItem.text : 'Item text'\n\n return {\n ...listItem,\n text,\n ...hint,\n label: {\n text: listItem.text,\n classes: this.getHighlight(listItem.id + '-label')\n }\n }\n })\n }\n\n /**\n *\n * @param {string | undefined} id\n * @param {string} text\n */\n updateText(id, text) {\n if (!id) {\n return\n }\n\n const listItem = this._list.get(id)\n if (listItem) {\n listItem.text = text\n this.render()\n }\n }\n\n /**\n *\n * @param {string | undefined} id\n * @param {string} hint\n */\n updateHint(id, hint) {\n if (!id) {\n return\n }\n\n const listItem = this._list.get(id)\n if (listItem) {\n listItem.hint = {\n ...listItem.hint,\n text: hint\n }\n this.render()\n }\n }\n\n /**\n * @param {string | undefined} id\n * @param {string} value\n */\n updateValue(id, value) {\n if (!id) {\n return\n }\n\n const listItem = this._list.get(id)\n if (listItem) {\n listItem.value = value\n this.render()\n }\n }\n}\n\n/**\n * @import { ListElement, ListItemReadonly } from '~/src/form/form-editor/types.js'\n * @import { SelectionComponentsDef, ListComponentsDef } from '~/src/components/types.js'\n * @import { List, Item } from '~/src/form/form-definition/types.js'\n * @import { ListElements, QuestionRenderer, DefaultComponent, GovukFieldset, BaseSettings, QuestionElements } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,gBAAgB;AACzB,SACEC,QAAQ,EACRC,yBAAyB;AAG3B,MAAMC,gBAAgB,GAAG;EACvBC,aAAa,EAAE,WAAW;EAC1BC,aAAa,EAAE,WAAW;EAC1BC,QAAQ,EAAEN,gBAAgB,CAACO,IAAI,GAAG,YAAY;EAC9CC,KAAK,EAAE,WAAW;EAClBC,UAAU,EAAE;AACd,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAACC,WAAW,EAAE;EAC1C,OAAO,CAACA,WAAW,CAACC,EAAE,EAAED,WAAW,CAAC;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,iBAAiBA,CAACC,YAAY,EAAE;EAC9C,MAAMC,OAAO,GAAGD,YAAY,GAAGA,YAAY,CAACE,GAAG,CAACN,cAAc,CAAC,GAAG,EAAE;EACpE,OAAO,IAAIO,GAAG,CAACF,OAAO,CAAC;AACzB;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASG,qBAAqBA,CAACC,IAAI,EAAE;EAC1C,OAAO;IACLC,IAAI,EAAED,IAAI,CAACC,IAAI;IACfC,KAAK,EAAE;MACLD,IAAI,EAAED,IAAI,CAACC,IAAI;MACfE,OAAO,EAAE;IACX,CAAC;IACDC,KAAK,EAAEJ,IAAI,CAACI,KAAK;IACjBX,EAAE,EAAEO,IAAI,CAACP,EAAE,IAAI,EAAE;IACjBY,IAAI,EAAEL,IAAI,CAACK;EACb,CAAC;AACH;;AAEA;AACA;AACA;AACA,OAAO,MAAMC,qBAAqB,SAASvB,yBAAyB,CAAC;EACnE;AACF;AACA;AACA;EACEwB,KAAK;;EAEL;AACF;AACA;A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AK,CAACuC,GAAG,CAACrD,EAAE,CAAC;IACnC,IAAI+C,QAAQ,EAAE;MACZA,QAAQ,CAACpC,KAAK,GAAGA,KAAK;MACtB,IAAI,CAAC8B,MAAM,CAAC,CAAC;IACf;EACF;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
1
|
+
{"version":3,"file":"list.js","names":["ComponentType","PreviewComponent","Question","QuestionComponentElements","DefaultListConst","TextElementId","HintElementId","Template","PATH","Input","RenderName","listItemMapper","listElement","id","listsElementToMap","listElements","entries","map","Map","listItemToListElement","item","text","label","classes","value","hint","ListComponentElements","_list","constructor","component","list","largeTitle","_getValues","items","ListQuestion","componentType","List","_questionTemplate","_listElements","listRenderId","listRenderName","questionRenderer","values","createListFromElements","renderInput","afterInputs","length","formGroup","html","afterInputsHTML","name","fieldset","fieldSet","push","set","render","delete","key","iterator","Array","from","listItem","hintText","_highlight","getHighlight","undefined","updateText","get","updateHint","updateValue"],"sources":["../../../../../src/form/form-editor/preview/list.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\nimport {\n Question,\n QuestionComponentElements\n} from '~/src/form/form-editor/preview/question.js'\n\nconst DefaultListConst = {\n TextElementId: 'radioText',\n HintElementId: 'radioHint',\n Template: PreviewComponent.PATH + 'radios.njk',\n Input: 'listInput',\n RenderName: 'listInputField'\n}\n\n/**\n * @param {ListElement} listElement\n * @returns {[string, ListElement]}\n */\nexport function listItemMapper(listElement) {\n return [listElement.id, listElement]\n}\n\n/**\n *\n * @param { ListElement[]| undefined } listElements\n * @returns {Map<string, ListElement>}\n */\nexport function listsElementToMap(listElements) {\n const entries = listElements ? listElements.map(listItemMapper) : []\n return new Map(entries)\n}\n\n/**\n * @param {Item} item\n * @returns {ListElement}\n */\nexport function listItemToListElement(item) {\n return {\n text: item.text,\n label: {\n text: item.text,\n classes: ''\n },\n value: item.value,\n id: item.id ?? '',\n hint: item.hint\n }\n}\n\n/**\n * @implements {QuestionElements}\n */\nexport class ListComponentElements extends QuestionComponentElements {\n /**\n * @type {List}\n * @protected\n */\n _list\n\n /**\n * @param {SelectionComponentsDef} component\n * @param {List} list\n * @param {boolean} largeTitle\n */\n constructor(component, list, largeTitle = true) {\n super(component, largeTitle)\n this._list = list\n }\n\n /**\n * @returns {BaseSettings}\n * @protected\n */\n _getValues() {\n return {\n ...super._getValues(),\n items: this._list.items.map(listItemToListElement)\n }\n }\n}\n\nexport class ListQuestion extends Question {\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.List\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = DefaultListConst.Template\n /** @type {ListElements} */\n _listElements\n listRenderId = DefaultListConst.Input\n listRenderName = DefaultListConst.RenderName\n\n /**\n * @type {Map<string, ListElement>}\n * @protected\n */\n _list\n\n /**\n * @param {ListElements} listElements\n * @param {QuestionRenderer} questionRenderer\n */\n constructor(listElements, questionRenderer) {\n super(listElements, questionRenderer)\n\n const items = /** @type {ListElement[]} */ (listElements.values.items)\n this._list = this.createListFromElements(items)\n this._listElements = listElements\n }\n\n /**\n * @returns {{\n * formGroup?: {afterInputs: {html: string}};\n * hint: DefaultComponent;\n * name: string;\n * fieldset?: GovukFieldset;\n * id: string;\n * items: ListItemReadonly[]\n * }}\n */\n get renderInput() {\n const afterInputs =\n /** @type {{ formGroup?: { afterInputs: { html: string } } }} */ (\n this.list.length\n ? {}\n : {\n formGroup: {\n afterInputs: {\n html: this._listElements.afterInputsHTML\n }\n }\n }\n )\n\n return {\n id: this.listRenderId,\n name: this.listRenderName,\n fieldset: this.fieldSet,\n hint: this.hint,\n items: this.list,\n ...afterInputs\n }\n }\n\n /**\n *\n * @param {ListElement} listElement\n */\n push(listElement) {\n this._list.set(listElement.id, listElement)\n this.render()\n }\n\n /**\n * @param {string} key\n */\n delete(key) {\n this._list.delete(key)\n this.render()\n }\n\n /**\n * @param {ListElement[]} listElements\n * @returns {Map<string, ListElement>}\n */\n createListFromElements(listElements) {\n this._list = listsElementToMap(listElements)\n return this._list\n }\n\n /**\n * @returns {ListItemReadonly[]}\n */\n get list() {\n const iterator = /** @type {MapIterator<ListElement>} */ (\n this._list.values()\n )\n return Array.from(iterator).map((listItem) => {\n const hintText =\n this._highlight === `${listItem.id}-hint` && !listItem.hint?.text.length\n ? 'Hint text'\n : (listItem.hint?.text ?? '')\n\n const hint = {\n hint: hintText\n ? {\n text: hintText,\n classes: this.getHighlight(listItem.id + '-hint')\n }\n : undefined\n }\n\n const text = listItem.text.length ? listItem.text : 'Item text'\n\n return {\n ...listItem,\n text,\n ...hint,\n label: {\n text: listItem.text,\n classes: this.getHighlight(listItem.id + '-label')\n }\n }\n })\n }\n\n /**\n *\n * @param {string | undefined} id\n * @param {string} text\n */\n updateText(id, text) {\n if (!id) {\n return\n }\n\n const listItem = this._list.get(id)\n if (listItem) {\n listItem.text = text\n this.render()\n }\n }\n\n /**\n *\n * @param {string | undefined} id\n * @param {string} hint\n */\n updateHint(id, hint) {\n if (!id) {\n return\n }\n\n const listItem = this._list.get(id)\n if (listItem) {\n listItem.hint = {\n ...listItem.hint,\n text: hint\n }\n this.render()\n }\n }\n\n /**\n * @param {string | undefined} id\n * @param {string} value\n */\n updateValue(id, value) {\n if (!id) {\n return\n }\n\n const listItem = this._list.get(id)\n if (listItem) {\n listItem.value = value\n this.render()\n }\n }\n}\n\n/**\n * @import { ListElement, ListItemReadonly } from '~/src/form/form-editor/types.js'\n * @import { SelectionComponentsDef, ListComponentsDef } from '~/src/components/types.js'\n * @import { List, Item } from '~/src/form/form-definition/types.js'\n * @import { ListElements, QuestionRenderer, DefaultComponent, GovukFieldset, BaseSettings, QuestionElements } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,gBAAgB;AACzB,SACEC,QAAQ,EACRC,yBAAyB;AAG3B,MAAMC,gBAAgB,GAAG;EACvBC,aAAa,EAAE,WAAW;EAC1BC,aAAa,EAAE,WAAW;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AAI;UACnBE,OAAO,EAAE,IAAI,CAACyC,YAAY,CAACH,QAAQ,CAAChD,EAAE,GAAG,QAAQ;QACnD;MACF,CAAC;IACH,CAAC,CAAC;EACJ;;EAEA;AACF;AACA;AACA;AACA;EACEqD,UAAUA,CAACrD,EAAE,EAAEQ,IAAI,EAAE;IACnB,IAAI,CAACR,EAAE,EAAE;MACP;IACF;IAEA,MAAMgD,QAAQ,GAAG,IAAI,CAAClC,KAAK,CAACwC,GAAG,CAACtD,EAAE,CAAC;IACnC,IAAIgD,QAAQ,EAAE;MACZA,QAAQ,CAACxC,IAAI,GAAGA,IAAI;MACpB,IAAI,CAACkC,MAAM,CAAC,CAAC;IACf;EACF;;EAEA;AACF;AACA;AACA;AACA;EACEa,UAAUA,CAACvD,EAAE,EAAEY,IAAI,EAAE;IACnB,IAAI,CAACZ,EAAE,EAAE;MACP;IACF;IAEA,MAAMgD,QAAQ,GAAG,IAAI,CAAClC,KAAK,CAACwC,GAAG,CAACtD,EAAE,CAAC;IACnC,IAAIgD,QAAQ,EAAE;MACZA,QAAQ,CAACpC,IAAI,GAAG;QACd,GAAGoC,QAAQ,CAACpC,IAAI;QAChBJ,IAAI,EAAEI;MACR,CAAC;MACD,IAAI,CAAC8B,MAAM,CAAC,CAAC;IACf;EACF;;EAEA;AACF;AACA;AACA;EACEc,WAAWA,CAACxD,EAAE,EAAEW,KAAK,EAAE;IACrB,IAAI,CAACX,EAAE,EAAE;MACP;IACF;IAEA,MAAMgD,QAAQ,GAAG,IAAI,CAAClC,KAAK,CAACwC,GAAG,CAACtD,EAAE,CAAC;IACnC,IAAIgD,QAAQ,EAAE;MACZA,QAAQ,CAACrC,KAAK,GAAGA,KAAK;MACtB,IAAI,CAAC+B,MAAM,CAAC,CAAC;IACf;EACF;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
@@ -44,6 +44,11 @@ export class PreviewComponent {
|
|
44
44
|
* @protected
|
45
45
|
*/
|
46
46
|
_highlighted = false;
|
47
|
+
/**
|
48
|
+
* @type {boolean}
|
49
|
+
* @protected
|
50
|
+
*/
|
51
|
+
_largeTitle = true;
|
47
52
|
|
48
53
|
/**
|
49
54
|
* @param {QuestionElements} htmlElements
|
@@ -52,7 +57,8 @@ export class PreviewComponent {
|
|
52
57
|
constructor(htmlElements, questionRenderer) {
|
53
58
|
const {
|
54
59
|
question,
|
55
|
-
optional
|
60
|
+
optional,
|
61
|
+
largeTitle
|
56
62
|
} = htmlElements.values;
|
57
63
|
|
58
64
|
/**
|
@@ -76,6 +82,7 @@ export class PreviewComponent {
|
|
76
82
|
* @protected
|
77
83
|
*/
|
78
84
|
this._questionRenderer = questionRenderer;
|
85
|
+
this._largeTitle = largeTitle;
|
79
86
|
}
|
80
87
|
|
81
88
|
/**
|
@@ -96,9 +103,10 @@ export class PreviewComponent {
|
|
96
103
|
* @type {DefaultComponent}
|
97
104
|
*/
|
98
105
|
get label() {
|
106
|
+
const titleClass = this._largeTitle ? 'govuk-label--l' : 'govuk-label--m';
|
99
107
|
return {
|
100
108
|
text: this.titleText,
|
101
|
-
classes:
|
109
|
+
classes: titleClass + this.getHighlight('question')
|
102
110
|
};
|
103
111
|
}
|
104
112
|
|
@@ -107,10 +115,11 @@ export class PreviewComponent {
|
|
107
115
|
* @type {GovukFieldset}
|
108
116
|
*/
|
109
117
|
get fieldSet() {
|
118
|
+
const titleClass = this._largeTitle ? 'govuk-fieldset__legend--l' : 'govuk-fieldset__legend--m';
|
110
119
|
return {
|
111
120
|
legend: {
|
112
121
|
text: this.titleText,
|
113
|
-
classes:
|
122
|
+
classes: titleClass + this.getHighlight('question')
|
114
123
|
}
|
115
124
|
};
|
116
125
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"preview.js","names":["ComponentType","HIGHLIGHT_CLASS","PreviewComponent","PATH","componentType","Details","_questionTemplate","_highlight","_fieldName","_questionRenderer","_htmlElements","_highlighted","constructor","htmlElements","questionRenderer","question","optional","values","_question","_optional","getHighlight","element","titleText","optionalText","label","text","classes","fieldSet","legend","customRenderFields","_renderInput","id","name","renderInput","render","value","highlight","highlightContent","unHighlightContent"],"sources":["../../../../../src/form/form-editor/preview/preview.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { HIGHLIGHT_CLASS } from '~/src/form/form-editor/preview/constants.js'\n\n/**\n * @abstract\n */\nexport class PreviewComponent {\n static PATH = 'preview-components/'\n /**\n * @abstract\n * @type {ComponentType}\n */\n componentType = ComponentType.Details\n /**\n * @abstract\n * @type {string}\n * @protected\n */\n _questionTemplate = ''\n /**\n * @type { string|null }\n * @protected\n */\n _highlight = null\n /**\n * @abstract\n * @type {string}\n * @protected\n */\n _fieldName = ''\n /**\n * @type {QuestionRenderer}\n * @protected\n */\n _questionRenderer\n\n /**\n * @type {QuestionElements}\n * @protected\n */\n _htmlElements\n /**\n * @type {boolean}\n * @protected\n */\n _highlighted = false\n\n /**\n * @param {QuestionElements} htmlElements\n * @param {QuestionRenderer} questionRenderer\n */\n constructor(htmlElements, questionRenderer) {\n const { question, optional } = htmlElements.values\n\n /**\n * @type {QuestionElements}\n * @protected\n */\n this._htmlElements = htmlElements\n /**\n * @type {string}\n * @private\n */\n this._question = question\n /**\n * @type {boolean}\n * @private\n */\n this._optional = optional\n /**\n *\n * @type {QuestionRenderer}\n * @protected\n */\n this._questionRenderer = questionRenderer\n }\n\n /**\n * @param {string} element\n * @returns {string}\n * @protected\n */\n getHighlight(element) {\n return this._highlight === element ? ' highlight' : ''\n }\n\n get titleText() {\n const optionalText = this._optional ? ' (optional)' : ''\n return (!this._question ? 'Question' : this._question) + optionalText\n }\n\n /**\n * @protected\n * @type {DefaultComponent}\n */\n get label() {\n return {\n text: this.titleText,\n classes:
|
1
|
+
{"version":3,"file":"preview.js","names":["ComponentType","HIGHLIGHT_CLASS","PreviewComponent","PATH","componentType","Details","_questionTemplate","_highlight","_fieldName","_questionRenderer","_htmlElements","_highlighted","_largeTitle","constructor","htmlElements","questionRenderer","question","optional","largeTitle","values","_question","_optional","getHighlight","element","titleText","optionalText","label","titleClass","text","classes","fieldSet","legend","customRenderFields","_renderInput","id","name","renderInput","render","value","highlight","highlightContent","unHighlightContent"],"sources":["../../../../../src/form/form-editor/preview/preview.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { HIGHLIGHT_CLASS } from '~/src/form/form-editor/preview/constants.js'\n\n/**\n * @abstract\n */\nexport class PreviewComponent {\n static PATH = 'preview-components/'\n /**\n * @abstract\n * @type {ComponentType}\n */\n componentType = ComponentType.Details\n /**\n * @abstract\n * @type {string}\n * @protected\n */\n _questionTemplate = ''\n /**\n * @type { string|null }\n * @protected\n */\n _highlight = null\n /**\n * @abstract\n * @type {string}\n * @protected\n */\n _fieldName = ''\n /**\n * @type {QuestionRenderer}\n * @protected\n */\n _questionRenderer\n\n /**\n * @type {QuestionElements}\n * @protected\n */\n _htmlElements\n /**\n * @type {boolean}\n * @protected\n */\n _highlighted = false\n /**\n * @type {boolean}\n * @protected\n */\n _largeTitle = true\n\n /**\n * @param {QuestionElements} htmlElements\n * @param {QuestionRenderer} questionRenderer\n */\n constructor(htmlElements, questionRenderer) {\n const { question, optional, largeTitle } = htmlElements.values\n\n /**\n * @type {QuestionElements}\n * @protected\n */\n this._htmlElements = htmlElements\n /**\n * @type {string}\n * @private\n */\n this._question = question\n /**\n * @type {boolean}\n * @private\n */\n this._optional = optional\n /**\n *\n * @type {QuestionRenderer}\n * @protected\n */\n this._questionRenderer = questionRenderer\n this._largeTitle = largeTitle\n }\n\n /**\n * @param {string} element\n * @returns {string}\n * @protected\n */\n getHighlight(element) {\n return this._highlight === element ? ' highlight' : ''\n }\n\n get titleText() {\n const optionalText = this._optional ? ' (optional)' : ''\n return (!this._question ? 'Question' : this._question) + optionalText\n }\n\n /**\n * @protected\n * @type {DefaultComponent}\n */\n get label() {\n const titleClass = this._largeTitle ? 'govuk-label--l' : 'govuk-label--m'\n\n return {\n text: this.titleText,\n classes: titleClass + this.getHighlight('question')\n }\n }\n\n /**\n * @protected\n * @type {GovukFieldset}\n */\n get fieldSet() {\n const titleClass = this._largeTitle\n ? 'govuk-fieldset__legend--l'\n : 'govuk-fieldset__legend--m'\n\n return {\n legend: {\n text: this.titleText,\n classes: titleClass + this.getHighlight('question')\n }\n }\n }\n\n /**\n * @returns {Partial<QuestionBaseModel>}\n */\n get customRenderFields() {\n return {}\n }\n\n /**\n *\n * @returns {QuestionBaseModel}\n * @protected\n */\n _renderInput() {\n return {\n id: this._fieldName,\n name: this._fieldName,\n classes: this._highlighted ? HIGHLIGHT_CLASS : ''\n }\n }\n\n /**\n * @type {QuestionBaseModel}\n */\n get renderInput() {\n return {\n ...this._renderInput(),\n ...this.customRenderFields\n }\n }\n\n render() {\n this._questionRenderer.render(this._questionTemplate, this.renderInput)\n }\n\n /**\n * @type {string}\n */\n get question() {\n return this._question\n }\n\n /**\n * @param {string} value\n */\n set question(value) {\n this._question = value\n this.render()\n }\n\n get optional() {\n return this._optional\n }\n\n /**\n * @param {boolean} value\n */\n set optional(value) {\n this._optional = value\n this.render()\n }\n\n /**\n * @type {string | null}\n */\n get highlight() {\n return this._highlight\n }\n\n /**\n * @param {string | null} value\n */\n set highlight(value) {\n this._highlight = value\n this.render()\n }\n\n /**\n * no render\n */\n highlightContent() {\n this._highlighted = true\n }\n\n /**\n * no render\n */\n unHighlightContent() {\n this._highlighted = false\n }\n}\n\n/**\n * @import { ListenerRow, BaseSettings, QuestionElements, QuestionBaseModel, GovukFieldset, DefaultComponent, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { FormComponentsDef, ContentComponentsDef, ComponentDef } from '~/src/components/types.js'\n * @import { ListElement, ListItemReadonly } from '~/src/form/form-editor/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,eAAe;;AAExB;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,CAAC;EAC5B,OAAOC,IAAI,GAAG,qBAAqB;EACnC;AACF;AACA;AACA;EACEC,aA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CAAA,EAAG;IACb,OAAO,IAAI,CAACI,SAAS;EACvB;;EAEA;AACF;AACA;EACE,IAAIJ,QAAQA,CAACqB,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,CAAChC,UAAU;EACxB;;EAEA;AACF;AACA;EACE,IAAIgC,SAASA,CAACD,KAAK,EAAE;IACnB,IAAI,CAAC/B,UAAU,GAAG+B,KAAK;IACvB,IAAI,CAACD,MAAM,CAAC,CAAC;EACf;;EAEA;AACF;AACA;EACEG,gBAAgBA,CAAA,EAAG;IACjB,IAAI,CAAC7B,YAAY,GAAG,IAAI;EAC1B;;EAEA;AACF;AACA;EACE8B,kBAAkBA,CAAA,EAAG;IACnB,IAAI,CAAC9B,YAAY,GAAG,KAAK;EAC3B;AACF;;AAEA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
@@ -14,8 +14,8 @@ export class QuestionComponentElements extends ComponentElements {
|
|
14
14
|
/**
|
15
15
|
* @param {FormComponentsDef} component
|
16
16
|
*/
|
17
|
-
constructor(component) {
|
18
|
-
super(component);
|
17
|
+
constructor(component, largeTitle = true) {
|
18
|
+
super(component, largeTitle);
|
19
19
|
this._component = component;
|
20
20
|
}
|
21
21
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"question.js","names":["ComponentType","ComponentElements","PreviewComponent","QuestionComponentElements","_component","constructor","component","_getValues","hintText","hint","shortDesc","shortDescription","Question","componentType","TextField","_questionTemplate","PATH","_fieldName","htmlElements","questionRenderer","values","_hintText","text","_highlight","length","classes","getHighlight","_renderInput","label","value","render"],"sources":["../../../../../src/form/form-editor/preview/question.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { ComponentElements } from '~/src/form/form-editor/preview/component-elements.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n\n/**\n * @implements {QuestionElements}\n */\nexport class QuestionComponentElements extends ComponentElements {\n /**\n * @type {FormComponentsDef}\n * @protected\n */\n _component\n /**\n * @param {FormComponentsDef} component\n */\n constructor(component) {\n super(component)\n this._component = component\n }\n\n /**\n * @protected\n * @returns {BaseSettings}\n */\n _getValues() {\n return {\n ...super._getValues(),\n hintText: this._component.hint ?? '',\n shortDesc: this._component.shortDescription ?? ''\n }\n }\n}\n\n/**\n * @class Question\n * @classdesc\n * A data object that has access to the underlying data via the QuestionElements object interface\n * and the templating mechanism to render the HTML for the data.\n *\n * It does not have access to the DOM, but has access to QuestionElements.setPreviewHTML to update\n * the HTML. Question classes should only be responsible for data and rendering as are reused in the\n * server side.\n */\nexport class Question extends PreviewComponent {\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.TextField\n\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = PreviewComponent.PATH + 'textfield.njk'\n /**\n * @type {string}\n * @protected\n */\n _fieldName = 'inputField'\n\n /**\n * @param {QuestionElements} htmlElements\n * @param {QuestionRenderer} questionRenderer\n */\n constructor(htmlElements, questionRenderer) {\n super(htmlElements, questionRenderer)\n const { hintText } = htmlElements.values\n /**\n * @type {string}\n * @private\n */\n this._hintText = hintText\n }\n\n /**\n * @type {DefaultComponent}\n * @protected\n */\n get hint() {\n const text =\n this._highlight === 'hintText' && !this._hintText.length\n ? 'Hint text'\n : this._hintText\n\n return {\n text,\n classes: this.getHighlight('hintText')\n }\n }\n\n /**\n * @returns {QuestionBaseModel}\n * @protected\n */\n _renderInput() {\n return { ...super._renderInput(), label: this.label, hint: this.hint }\n }\n\n /**\n * @type {string}\n */\n get hintText() {\n return this._hintText\n }\n\n /**\n * @param {string} value\n */\n set hintText(value) {\n this._hintText = value\n this.render()\n }\n}\n\n/**\n * @import { ListenerRow, BaseSettings, QuestionElements, QuestionBaseModel, GovukFieldset, DefaultComponent, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { FormComponentsDef, ContentComponentsDef, ComponentDef } from '~/src/components/types.js'\n * @import { ListElement, ListItemReadonly } from '~/src/form/form-editor/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,iBAAiB;AAC1B,SAASC,gBAAgB;;AAEzB;AACA;AACA;AACA,OAAO,MAAMC,yBAAyB,SAASF,iBAAiB,CAAC;EAC/D;AACF;AACA;AACA;EACEG,UAAU;EACV;AACF;AACA;EACEC,WAAWA,CAACC,SAAS,EAAE;
|
1
|
+
{"version":3,"file":"question.js","names":["ComponentType","ComponentElements","PreviewComponent","QuestionComponentElements","_component","constructor","component","largeTitle","_getValues","hintText","hint","shortDesc","shortDescription","Question","componentType","TextField","_questionTemplate","PATH","_fieldName","htmlElements","questionRenderer","values","_hintText","text","_highlight","length","classes","getHighlight","_renderInput","label","value","render"],"sources":["../../../../../src/form/form-editor/preview/question.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { ComponentElements } from '~/src/form/form-editor/preview/component-elements.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n\n/**\n * @implements {QuestionElements}\n */\nexport class QuestionComponentElements extends ComponentElements {\n /**\n * @type {FormComponentsDef}\n * @protected\n */\n _component\n /**\n * @param {FormComponentsDef} component\n */\n constructor(component, largeTitle = true) {\n super(component, largeTitle)\n this._component = component\n }\n\n /**\n * @protected\n * @returns {BaseSettings}\n */\n _getValues() {\n return {\n ...super._getValues(),\n hintText: this._component.hint ?? '',\n shortDesc: this._component.shortDescription ?? ''\n }\n }\n}\n\n/**\n * @class Question\n * @classdesc\n * A data object that has access to the underlying data via the QuestionElements object interface\n * and the templating mechanism to render the HTML for the data.\n *\n * It does not have access to the DOM, but has access to QuestionElements.setPreviewHTML to update\n * the HTML. Question classes should only be responsible for data and rendering as are reused in the\n * server side.\n */\nexport class Question extends PreviewComponent {\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.TextField\n\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = PreviewComponent.PATH + 'textfield.njk'\n /**\n * @type {string}\n * @protected\n */\n _fieldName = 'inputField'\n\n /**\n * @param {QuestionElements} htmlElements\n * @param {QuestionRenderer} questionRenderer\n */\n constructor(htmlElements, questionRenderer) {\n super(htmlElements, questionRenderer)\n const { hintText } = htmlElements.values\n /**\n * @type {string}\n * @private\n */\n this._hintText = hintText\n }\n\n /**\n * @type {DefaultComponent}\n * @protected\n */\n get hint() {\n const text =\n this._highlight === 'hintText' && !this._hintText.length\n ? 'Hint text'\n : this._hintText\n\n return {\n text,\n classes: this.getHighlight('hintText')\n }\n }\n\n /**\n * @returns {QuestionBaseModel}\n * @protected\n */\n _renderInput() {\n return { ...super._renderInput(), label: this.label, hint: this.hint }\n }\n\n /**\n * @type {string}\n */\n get hintText() {\n return this._hintText\n }\n\n /**\n * @param {string} value\n */\n set hintText(value) {\n this._hintText = value\n this.render()\n }\n}\n\n/**\n * @import { ListenerRow, BaseSettings, QuestionElements, QuestionBaseModel, GovukFieldset, DefaultComponent, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { FormComponentsDef, ContentComponentsDef, ComponentDef } from '~/src/components/types.js'\n * @import { ListElement, ListItemReadonly } from '~/src/form/form-editor/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,iBAAiB;AAC1B,SAASC,gBAAgB;;AAEzB;AACA;AACA;AACA,OAAO,MAAMC,yBAAyB,SAASF,iBAAiB,CAAC;EAC/D;AACF;AACA;AACA;EACEG,UAAU;EACV;AACF;AACA;EACEC,WAAWA,CAACC,SAAS,EAAEC,UAAU,GAAG,IAAI,EAAE;IACxC,KAAK,CAACD,SAAS,EAAEC,UAAU,CAAC;IAC5B,IAAI,CAACH,UAAU,GAAGE,SAAS;EAC7B;;EAEA;AACF;AACA;AACA;EACEE,UAAUA,CAAA,EAAG;IACX,OAAO;MACL,GAAG,KAAK,CAACA,UAAU,CAAC,CAAC;MACrBC,QAAQ,EAAE,IAAI,CAACL,UAAU,CAACM,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,GAAGQ,KAAK;IACtB,IAAI,CAACC,MAAM,CAAC,CAAC;EACf;AACF;;AAEA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/form/form-editor/preview/types.ts"],"sourcesContent":["import {\n type PagePreviewPanelMacro,\n type QuestionBaseModel\n} from '~/src/form/form-editor/macros/types.js'\nimport { type AutocompleteQuestion } from '~/src/form/form-editor/preview/autocomplete.js'\nimport { type DateInputQuestion } from '~/src/form/form-editor/preview/date-input.js'\nimport { type EmailAddressQuestion } from '~/src/form/form-editor/preview/email-address.js'\nimport { type ListSortableQuestion } from '~/src/form/form-editor/preview/list-sortable.js'\nimport { type LongAnswerQuestion } from '~/src/form/form-editor/preview/long-answer.js'\nimport { type PhoneNumberQuestion } from '~/src/form/form-editor/preview/phone-number.js'\nimport { type Question } from '~/src/form/form-editor/preview/question.js'\nimport { type RadioSortableQuestion } from '~/src/form/form-editor/preview/radio-sortable.js'\nimport { type SelectSortableQuestion } from '~/src/form/form-editor/preview/select-sortable.js'\nimport { type ShortAnswerQuestion } from '~/src/form/form-editor/preview/short-answer.js'\nimport { type UkAddressQuestion } from '~/src/form/form-editor/preview/uk-address.js'\nimport { type ListElement } from '~/src/form/form-editor/types.js'\nexport { type QuestionBaseModel } from '~/src/form/form-editor/macros/types.js'\nexport interface BaseSettings {\n question: string\n hintText: string\n optional: boolean\n shortDesc: string\n items: ListElement[]\n content: string\n}\n\nexport interface DefaultComponent {\n id?: string\n text: string\n classes: string\n}\n\nexport interface GovukFieldset {\n legend: DefaultComponent\n}\n\nexport type ListenerRow = [\n HTMLInputElement | null,\n (target: HTMLInputElement, e: Event) => void,\n keyof HTMLElementEventMap\n]\n\nexport interface QuestionElements {\n readonly values: BaseSettings\n setPreviewHTML(value: string): void\n setPreviewDOM(element: HTMLElement): void\n}\nexport interface AutocompleteElements extends QuestionElements {\n autocompleteOptions: string\n}\n\nexport interface RenderContext {\n model: QuestionBaseModel\n}\n\nexport interface HTMLBuilder {\n buildHTML(questionTemplate: string, renderContext: RenderContext): string\n}\n\nexport interface QuestionRenderer {\n render(questionTemplate: string, questionBaseModel: QuestionBaseModel): void\n}\n\nexport interface PageRenderer {\n render(pageTemplate: string, pagePreview: PagePreviewPanelMacro): void\n}\n\nexport interface ListElements extends QuestionElements {\n afterInputsHTML: string\n}\n\nexport interface PageOverviewElements {\n heading: string\n guidance: string\n}\n\nexport type PreviewQuestion =\n | DateInputQuestion\n | EmailAddressQuestion\n | ListSortableQuestion\n | LongAnswerQuestion\n | PhoneNumberQuestion\n | Question\n | RadioSortableQuestion\n | SelectSortableQuestion\n | ShortAnswerQuestion\n | UkAddressQuestion\n | AutocompleteQuestion\n"],"mappings":"","ignoreList":[]}
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/form/form-editor/preview/types.ts"],"sourcesContent":["import {\n type PagePreviewPanelMacro,\n type QuestionBaseModel\n} from '~/src/form/form-editor/macros/types.js'\nimport { type AutocompleteQuestion } from '~/src/form/form-editor/preview/autocomplete.js'\nimport { type DateInputQuestion } from '~/src/form/form-editor/preview/date-input.js'\nimport { type EmailAddressQuestion } from '~/src/form/form-editor/preview/email-address.js'\nimport { type ListSortableQuestion } from '~/src/form/form-editor/preview/list-sortable.js'\nimport { type LongAnswerQuestion } from '~/src/form/form-editor/preview/long-answer.js'\nimport { type PhoneNumberQuestion } from '~/src/form/form-editor/preview/phone-number.js'\nimport { type Question } from '~/src/form/form-editor/preview/question.js'\nimport { type RadioSortableQuestion } from '~/src/form/form-editor/preview/radio-sortable.js'\nimport { type SelectSortableQuestion } from '~/src/form/form-editor/preview/select-sortable.js'\nimport { type ShortAnswerQuestion } from '~/src/form/form-editor/preview/short-answer.js'\nimport { type UkAddressQuestion } from '~/src/form/form-editor/preview/uk-address.js'\nimport { type ListElement } from '~/src/form/form-editor/types.js'\nexport { type QuestionBaseModel } from '~/src/form/form-editor/macros/types.js'\nexport interface BaseSettings {\n largeTitle: boolean\n question: string\n hintText: string\n optional: boolean\n shortDesc: string\n items: ListElement[]\n content: string\n}\n\nexport interface DefaultComponent {\n id?: string\n text: string\n classes: string\n}\n\nexport interface GovukFieldset {\n legend: DefaultComponent\n}\n\nexport type ListenerRow = [\n HTMLInputElement | null,\n (target: HTMLInputElement, e: Event) => void,\n keyof HTMLElementEventMap\n]\n\nexport interface QuestionElements {\n readonly values: BaseSettings\n setPreviewHTML(value: string): void\n setPreviewDOM(element: HTMLElement): void\n}\nexport interface AutocompleteElements extends QuestionElements {\n autocompleteOptions: string\n}\n\nexport interface RenderContext {\n model: QuestionBaseModel\n}\n\nexport interface HTMLBuilder {\n buildHTML(questionTemplate: string, renderContext: RenderContext): string\n}\n\nexport interface QuestionRenderer {\n render(questionTemplate: string, questionBaseModel: QuestionBaseModel): void\n}\n\nexport interface PageRenderer {\n render(pageTemplate: string, pagePreview: PagePreviewPanelMacro): void\n}\n\nexport interface ListElements extends QuestionElements {\n afterInputsHTML: string\n}\n\nexport interface PageOverviewElements {\n heading: string\n guidance: string\n}\n\nexport type PreviewQuestion =\n | DateInputQuestion\n | EmailAddressQuestion\n | ListSortableQuestion\n | LongAnswerQuestion\n | PhoneNumberQuestion\n | Question\n | RadioSortableQuestion\n | SelectSortableQuestion\n | ShortAnswerQuestion\n | UkAddressQuestion\n | AutocompleteQuestion\n"],"mappings":"","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/form/form-definition/index.ts"],"names":[],"mappings":"AACA,OAAO,OAAkC,MAAM,KAAK,CAAA;AAIpD,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC9B,MAAM,2BAA2B,CAAA;AAElC,OAAO,EAEL,KAAK,eAAe,EAWrB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAGL,KAAK,kBAAkB,EAIvB,KAAK,cAAc,EAGnB,KAAK,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EJ,eAAO,MAAM,sBAAsB,sCAwBY,CAAA;AAI/C,eAAO,MAAM,MAAM,sCAAuB,CAAA"}
|
@@ -59,7 +59,7 @@ export class QuestionPreviewElements implements ListElements {
|
|
59
59
|
/**
|
60
60
|
* @param {BaseSettings} baseSettings
|
61
61
|
*/
|
62
|
-
constructor({ question, hintText, optional, shortDesc, items, content }: BaseSettings);
|
62
|
+
constructor({ question, hintText, optional, shortDesc, items, content, largeTitle }: BaseSettings);
|
63
63
|
/**
|
64
64
|
* @protected
|
65
65
|
*/
|
@@ -84,6 +84,7 @@ export class QuestionPreviewElements implements ListElements {
|
|
84
84
|
* @private
|
85
85
|
*/
|
86
86
|
private _items;
|
87
|
+
_largeTitle: boolean;
|
87
88
|
afterInputsHTML: string;
|
88
89
|
/**
|
89
90
|
* @returns {BaseSettings}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/__stubs__/preview.js"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/__stubs__/preview.js"],"names":[],"mappings":"AA2OA;;;;GAIG;AACH,6DAJW,OAAO,CAAC,YAAY,CAAC,cACrB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,GAC1C,QAAQ,CAUpB;AAtPD;;GAEG;AACH;IAqBE;;;;OAIG;IACH,oCAHW,MAAM,kBACN,aAAa,GAFX,MAAM,CAMlB;IAtBD;;OAEG;IACH,wBAFW,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,EAItD;IAVD;;OAEG;IACH,YAFU,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAE5C;IASV;;;OAGG;IACH,yBAHW,MAAM,qBACN,iBAAiB,QAI3B;CAUF;AAED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BAAgB,sCAAsC,CAAA;AACtD,uBAAgB,sCAAsC,CAAA;AAEtD,gCAAoC,YAAY,CA4B9C"}
|
@@ -4,13 +4,19 @@
|
|
4
4
|
export class ComponentElements implements QuestionElements {
|
5
5
|
/**
|
6
6
|
* @param {ComponentDef} component
|
7
|
+
* @param {boolean} [largeTitle]
|
7
8
|
*/
|
8
|
-
constructor(component: ComponentDef);
|
9
|
+
constructor(component: ComponentDef, largeTitle?: boolean);
|
9
10
|
/**
|
10
11
|
* @type {ComponentDef}
|
11
12
|
* @protected
|
12
13
|
*/
|
13
14
|
protected _component: ComponentDef;
|
15
|
+
/**
|
16
|
+
* @type {boolean}
|
17
|
+
* @private
|
18
|
+
*/
|
19
|
+
private _largeTitle;
|
14
20
|
/**
|
15
21
|
* @protected
|
16
22
|
* @returns {BaseSettings}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"component-elements.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/component-elements.js"],"names":[],"mappings":"AAAA;;GAEG;AACH;
|
1
|
+
{"version":3,"file":"component-elements.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/component-elements.js"],"names":[],"mappings":"AAAA;;GAEG;AACH;IAWE;;;OAGG;IACH,uBAHW,YAAY,eACZ,OAAO,EAKjB;IAjBD;;;OAGG;IACH,sBAHU,YAAY,CAGZ;IACV;;;OAGG;IACH,oBAAkB;IAUlB;;;OAGG;IACH,wBAFa,YAAY,CAcxB;IAED;;OAEG;IACH,cAFa,YAAY,CAKxB;IAED;;OAEG;IACH,wBAFW,WAAW,QAIrB;IAED;;OAEG;IACH,uBAFW,MAAM,QAIhB;CACF;sCAGqI,yCAAyC;kCACrG,2BAA2B;kCADiC,yCAAyC"}
|
@@ -4,8 +4,9 @@
|
|
4
4
|
export class ContentElements extends ComponentElements implements QuestionElements {
|
5
5
|
/**
|
6
6
|
* @param {Exclude<ContentComponentsDef, ListComponent>} component
|
7
|
+
* @param {boolean} largeTitle
|
7
8
|
*/
|
8
|
-
constructor(component: Exclude<ContentComponentsDef, ListComponent
|
9
|
+
constructor(component: Exclude<ContentComponentsDef, ListComponent>, largeTitle?: boolean);
|
9
10
|
/**
|
10
11
|
* @type {Exclude<ContentComponentsDef, ListComponent>}
|
11
12
|
* @protected
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/content.js"],"names":[],"mappings":"AAGA;;GAEG;AACH;IAME
|
1
|
+
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/content.js"],"names":[],"mappings":"AAGA;;GAEG;AACH;IAME;;;OAGG;IACH,uBAHW,OAAO,CAAC,oBAAoB,EAAE,aAAa,CAAC,eAC5C,OAAO,EAKjB;IAZD;;;OAGG;IACH,sBAHU,OAAO,CAAC,oBAAoB,EAAE,aAAa,CAAC,CAG5C;CAoBX;AAED;;;;;GAKG;AACH;IACE;;;OAGG;IACH,oBAHU,MAAM,CAGR;IAwBR;;;OAGG;IACH,6BAHW,MAAM,QAKhB;IASD,mBANa,MAAM,EASlB;IAVD;;OAEG;IACH,eAFa,MAAM,CAIlB;CAMF;sCAGqI,yCAAyC;kCA1F7I,sDAAsD;0CA2FC,2BAA2B;mCAA3B,2BAA2B;iCA1FnF,2CAA2C"}
|
@@ -70,11 +70,6 @@ export class PreviewPageController implements PagePreviewPanelMacro {
|
|
70
70
|
* @protected
|
71
71
|
*/
|
72
72
|
protected _guidanceComponent: Markdown;
|
73
|
-
/**
|
74
|
-
* @type {boolean}
|
75
|
-
* @private
|
76
|
-
*/
|
77
|
-
private _showGuidance;
|
78
73
|
/**
|
79
74
|
* @returns {Markdown[]}
|
80
75
|
* @private
|
@@ -90,11 +85,6 @@ export class PreviewPageController implements PagePreviewPanelMacro {
|
|
90
85
|
text: string;
|
91
86
|
classes: string;
|
92
87
|
};
|
93
|
-
/**
|
94
|
-
* @private
|
95
|
-
* @returns {string}
|
96
|
-
*/
|
97
|
-
private _fallBackTitle;
|
98
88
|
/**
|
99
89
|
* @returns {{ text: string, classes: string }}
|
100
90
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"page-controller.d.ts","sourceRoot":"","sources":["../../../../../../src/form/form-editor/preview/controller/page-controller.js"],"names":[],"mappings":"AAmBA;;GAEG;AACH;IAME;;OAEG;IACH,kBAFW,IAAI,EAId;IAVD;;;OAGG;IACH,cAAK;IAQL,sBAEC;IAED,uBAUC;CACF;AAED;;GAEG;AACH;IACE,oBAAoC;
|
1
|
+
{"version":3,"file":"page-controller.d.ts","sourceRoot":"","sources":["../../../../../../src/form/form-editor/preview/controller/page-controller.js"],"names":[],"mappings":"AAmBA;;GAEG;AACH;IAME;;OAEG;IACH,kBAFW,IAAI,EAId;IAVD;;;OAGG;IACH,cAAK;IAQL,sBAEC;IAED,uBAUC;CACF;AAED;;GAEG;AACH;IACE,oBAAoC;IA8JpC;;;;OAIG;IACH,kCAFa,QAAQ,CAepB;IAED;;;;;OAKG;IACH,4CAKC;IApJD;;;;;OAKG;IACH,wBALW,YAAY,EAAE,YACd,oBAAoB,cACpB,cAAc,YACd,YAAY,EAqBtB;IAjED;;;OAGG;IACH,yBAHU,MAAM,CAGkD;IAClE;;;OAGG;IACH,uBAFU,QAAQ,EAAE,CAEJ;IAUhB;;;OAGG;IACH,wBAHW,SAAS,GAAG,OAAO,GAAG,UAAU,CAGnB;IACxB;;;OAGG;IACH,sBAAkB;IAClB;;;OAGG;IACH,uBAAgE;IAChE;;;;OAIG;IACH,8BAHU,QAAQ,CAGA;IAuClB;;;OAGG;IACH,kCAQC;IAED;;OAEG;IACH,kBAFa,oBAAoB,EAAE,CAYlC;IAED,+BAIC;IAED,2BAEC;IAED;;;MAKC;IAED;;OAEG;IACH,iBAFa;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAO7C;IAED,eAEC;IASD;;OAEG;IACH,iBAFW,MAAM,EAKhB;IAbD;;OAEG;IACH,aAFa,MAAM,CAIlB;IAUD,uBAEC;IAmCD,0BAGC;IAED;;OAEG;IACH,iCAFW,OAAO,GAAC,UAAU,QAK5B;IAED,uBAKC;;CACF;0CAG2F,yCAAyC;0BAE5F,qCAAqC;2CAEd,wCAAwC;8BAH3E,4CAA4C;yBA1QhD,4CAA4C;0CA6QL,wCAAwC;kCADpD,2BAA2B;oCADtC,qCAAqC;kCAFc,yCAAyC"}
|
@@ -1,9 +1,10 @@
|
|
1
1
|
/**
|
2
2
|
* @param {QuestionRenderer} questionRenderer
|
3
3
|
* @param {FormDefinition} definition
|
4
|
+
* @param {boolean} hasTitle
|
4
5
|
* @returns {(component: ComponentDef) => Question}
|
5
6
|
*/
|
6
|
-
export function mapComponentToPreviewQuestion(questionRenderer: QuestionRenderer, definition: FormDefinition): (component: ComponentDef) => Question;
|
7
|
+
export function mapComponentToPreviewQuestion(questionRenderer: QuestionRenderer, definition: FormDefinition, hasTitle: boolean): (component: ComponentDef) => Question;
|
7
8
|
import type { QuestionRenderer } from '../../../form/form-editor/preview/types.js';
|
8
9
|
import type { FormDefinition } from '../../../form/form-definition/types.js';
|
9
10
|
import type { ComponentDef } from '../../../components/types.js';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/helpers.js"],"names":[],"mappings":"AAsDA
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/helpers.js"],"names":[],"mappings":"AAsDA;;;;;GAKG;AACH,gEALW,gBAAgB,cAChB,cAAc,YACd,OAAO,GACL,CAAC,SAAS,EAAE,YAAY,KAAK,QAAQ,CAiCjD;sCAGsD,yCAAyC;oCAGvD,qCAAqC;kCAC1B,2BAA2B;8BAHlD,4CAA4C"}
|
@@ -21,8 +21,9 @@ export class ListComponentElements extends QuestionComponentElements implements
|
|
21
21
|
/**
|
22
22
|
* @param {SelectionComponentsDef} component
|
23
23
|
* @param {List} list
|
24
|
+
* @param {boolean} largeTitle
|
24
25
|
*/
|
25
|
-
constructor(component: SelectionComponentsDef, list: List);
|
26
|
+
constructor(component: SelectionComponentsDef, list: List, largeTitle?: boolean);
|
26
27
|
/**
|
27
28
|
* @type {List}
|
28
29
|
* @protected
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/list.js"],"names":[],"mappings":"AAeA;;;GAGG;AACH,4CAHW,WAAW,GACT,CAAC,MAAM,EAAE,WAAW,CAAC,CAIjC;AAED;;;;GAIG;AACH,gDAHY,WAAW,EAAE,GAAE,SAAS,GACvB,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAKpC;AAED;;;GAGG;AACH,4CAHW,IAAI,GACF,WAAW,CAavB;AAED;;GAEG;AACH;IAOE
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/list.js"],"names":[],"mappings":"AAeA;;;GAGG;AACH,4CAHW,WAAW,GACT,CAAC,MAAM,EAAE,WAAW,CAAC,CAIjC;AAED;;;;GAIG;AACH,gDAHY,WAAW,EAAE,GAAE,SAAS,GACvB,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAKpC;AAED;;;GAGG;AACH,4CAHW,IAAI,GACF,WAAW,CAavB;AAED;;GAEG;AACH;IAOE;;;;OAIG;IACH,uBAJW,sBAAsB,QACtB,IAAI,eACJ,OAAO,EAKjB;IAdD;;;OAGG;IACH,iBAHU,IAAI,CAGT;CAsBN;AAED;IAqBE;;;OAGG;IACH,0BAHW,YAAY,oBACZ,gBAAgB,EAQ1B;IArBD,2BAA2B;IAC3B,eADW,YAAY,CACV;IACb,qBAAqC;IACrC,uBAA4C;IAE5C;;;OAGG;IACH,iBAHU,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAG7B;IAcL;;;;;;;;;OASG;IACH,mBATa;QACT,SAAS,CAAC,EAAE;YAAC,WAAW,EAAE;gBAAC,IAAI,EAAE,MAAM,CAAA;aAAC,CAAA;SAAC,CAAC;QAC1C,IAAI,EAAE,gBAAgB,CAAC;QACvB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,aAAa,CAAC;QACzB,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,gBAAgB,EAAE,CAAA;KACzB,CAwBH;IAED;;;OAGG;IACH,kBAFW,WAAW,QAKrB;IAED;;OAEG;IACH,YAFW,MAAM,QAKhB;IAED;;;OAGG;IACH,qCAHW,WAAW,EAAE,GACX,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAKpC;IAED;;OAEG;IACH,YAFa,gBAAgB,EAAE,CAiC9B;IAED;;;;OAIG;IACH,eAHW,MAAM,GAAG,SAAS,QAClB,MAAM,QAYhB;IAED;;;;OAIG;IACH,eAHW,MAAM,GAAG,SAAS,QAClB,MAAM,QAehB;IAED;;;OAGG;IACH,gBAHW,MAAM,GAAG,SAAS,SAClB,MAAM,QAYhB;CACF;iCAGiD,iCAAiC;0BAEpD,qCAAqC;sCACgD,yCAAyC;0CAxQtJ,4CAA4C;0BAuQpB,qCAAqC;4CADN,2BAA2B;yBAtQlF,4CAA4C;kCAwQiE,yCAAyC;sCAAzC,yCAAyC;mCAAzC,yCAAyC;sCAH3G,iCAAiC;sCAGiC,yCAAyC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/preview.js"],"names":[],"mappings":"AAGA;;GAEG;AACH;IACE,oBAAmC;
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/preview.js"],"names":[],"mappings":"AAGA;;GAEG;AACH;IACE,oBAAmC;IA6CnC;;;OAGG;IACH,0BAHW,gBAAgB,oBAChB,gBAAgB,EA2B1B;IAzED;;;OAGG;IACH,eAFU,aAAa,CAEc;IACrC;;;;OAIG;IACH,6BAHU,MAAM,CAGM;IACtB;;;OAGG;IACH,sBAHW,MAAM,GAAC,IAAI,CAGL;IACjB;;;;OAIG;IACH,sBAHU,MAAM,CAGD;IACf;;;OAGG;IACH,6BAHU,gBAAgB,CAGT;IAEjB;;;OAGG;IACH,yBAHU,gBAAgB,CAGb;IACb;;;OAGG;IACH,wBAHU,OAAO,CAGG;IACpB;;;OAGG;IACH,uBAHU,OAAO,CAGC;IAchB;;;OAGG;IACH,kBAAyB;IACzB;;;OAGG;IACH,kBAAyB;IAU3B;;;;OAIG;IACH,gCAJW,MAAM,GACJ,MAAM,CAKlB;IAED,wBAGC;IAED;;;OAGG;IACH,uBAFU,gBAAgB,CASzB;IAED;;;OAGG;IACH,0BAFU,aAAa,CAatB;IAED;;OAEG;IACH,0BAFa,OAAO,CAAC,iBAAiB,CAAC,CAItC;IAED;;;;OAIG;IACH,0BAHa,iBAAiB,CAS7B;IAED;;OAEG;IACH,mBAFU,iBAAiB,CAO1B;IAED,eAEC;IASD;;OAEG;IACH,oBAFW,MAAM,EAKhB;IAbD;;OAEG;IACH,gBAFU,MAAM,CAIf;IAcD;;OAEG;IACH,oBAFW,OAAO,EAKjB;IAVD,gBAKW,OAAO,CAHjB;IAiBD;;OAEG;IACH,qBAFW,MAAM,GAAG,IAAI,EAKvB;IAbD;;OAEG;IACH,iBAFU,MAAM,GAAG,IAAI,CAItB;IAUD;;OAEG;IACH,yBAEC;IAED;;OAEG;IACH,2BAEC;CACF;8BAxN6B,2BAA2B;sCA2N6E,yCAAyC;sCAAzC,yCAAyC;sCAAzC,yCAAyC;mCAAzC,yCAAyC;uCAAzC,yCAAyC"}
|
@@ -5,7 +5,7 @@ export class QuestionComponentElements extends ComponentElements implements Ques
|
|
5
5
|
/**
|
6
6
|
* @param {FormComponentsDef} component
|
7
7
|
*/
|
8
|
-
constructor(component: FormComponentsDef);
|
8
|
+
constructor(component: FormComponentsDef, largeTitle?: boolean);
|
9
9
|
/**
|
10
10
|
* @type {FormComponentsDef}
|
11
11
|
* @protected
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/question.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;IAME;;OAEG;IACH,uBAFW,iBAAiB,
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/question.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;IAME;;OAEG;IACH,uBAFW,iBAAiB,wBAK3B;IAXD;;;OAGG;IACH,sBAHU,iBAAiB,CAGjB;CAoBX;AAED;;;;;;;;;GASG;AACH;IAwBI;;;OAGG;IACH,kBAAyB;IAG3B;;;OAGG;IACH,sBAHU,gBAAgB,CAazB;IAiBD;;OAEG;IACH,oBAFW,MAAM,EAKhB;IAbD;;OAEG;IACH,gBAFU,MAAM,CAIf;CASF;sCAGqI,yCAAyC;kCAnH7I,sDAAsD;uCAoHd,2BAA2B;iCAnHpE,2CAA2C;sCAkH0D,yCAAyC"}
|
@@ -13,6 +13,7 @@ import { type UkAddressQuestion } from '../../../form/form-editor/preview/uk-add
|
|
13
13
|
import { type ListElement } from '../../../form/form-editor/types.js';
|
14
14
|
export { type QuestionBaseModel } from '../../../form/form-editor/macros/types.js';
|
15
15
|
export interface BaseSettings {
|
16
|
+
largeTitle: boolean;
|
16
17
|
question: string;
|
17
18
|
hintText: string;
|
18
19
|
optional: boolean;
|