@defra/forms-model 3.0.571 → 3.0.572
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/macros/types.js.map +1 -1
- package/dist/module/form/form-editor/preview/controller/page-controller.js +0 -21
- package/dist/module/form/form-editor/preview/controller/page-controller.js.map +1 -1
- package/dist/types/form/form-editor/macros/types.d.ts +0 -4
- package/dist/types/form/form-editor/macros/types.d.ts.map +1 -1
- package/dist/types/form/form-editor/preview/controller/page-controller.d.ts +0 -5
- package/dist/types/form/form-editor/preview/controller/page-controller.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/form/form-editor/macros/types.ts +0 -4
- package/src/form/form-editor/preview/controller/page-controller.js +0 -27
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/form/form-editor/macros/types.ts"],"sourcesContent":["import { type ComponentType } from '~/src/components/enums.js'\nimport {\n type DefaultComponent,\n type GovukFieldset\n} from '~/src/form/form-editor/preview/types.js'\nimport {\n type DateItem,\n type GovukField,\n type ListItemReadonly\n} from '~/src/form/form-editor/types.js'\n\nexport interface AppPreviewErrorPanelMacroErrorTemplate {\n advancedSettingsErrors: []\n baseErrors: { template: unknown; type: string }[]\n}\n\nexport interface AppPreviewErrorPanelMacro {\n errorTemplates: AppPreviewErrorPanelMacroErrorTemplate\n fieldDetails: {\n extraFields: GovukField[]\n basePageFields: GovukField[]\n }\n questionType: ComponentType\n}\n\nexport interface AppPreviewPanelTabsMacro {\n questionType: ComponentType\n previewPageUrl: string\n previewErrorsUrl: string\n errorTemplates: AppPreviewErrorPanelMacroErrorTemplate\n extraFields: GovukField[]\n basePageFields: GovukField[]\n}\n\nexport interface SelectAfterInput {\n afterInput: { html: string }\n}\nexport interface RadioAndCheckboxAfterInputs {\n afterInputs: { html: string }\n}\n\n// GDS components - Select uses afterInput, while Radio uses afterInputs\nexport type FormGroupAfterInput = SelectAfterInput | RadioAndCheckboxAfterInputs\n\nexport interface QuestionBaseModel {\n id?: string\n name?: string\n content?: string\n attributes?: Record<string, string>\n label?: DefaultComponent\n hint?: DefaultComponent\n fieldset?: GovukFieldset\n readonly items?: ListItemReadonly[] | DateItem[]\n text?: string\n formGroup?: FormGroupAfterInput\n type?: 'text' | 'number' | 'boolean'\n classes?: string\n previewClasses?: string\n prefix?: { text: string }\n suffix?: { text: string }\n}\n\nexport interface AppPreviewPanelMacro extends AppPreviewPanelTabsMacro {\n model: QuestionBaseModel\n}\n\nexport interface PagePreviewComponent {\n model: QuestionBaseModel\n questionType: ComponentType\n}\n\nexport interface PagePreviewPanelMacro {\n readonly pageTitle: {\n text: string\n classes: string\n }\n readonly guidance: {\n text: string\n classes: string\n }\n readonly components: PagePreviewComponent[]\n readonly sectionTitle?: {\n text: string\n classes: string\n }\n
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/form/form-editor/macros/types.ts"],"sourcesContent":["import { type ComponentType } from '~/src/components/enums.js'\nimport {\n type DefaultComponent,\n type GovukFieldset\n} from '~/src/form/form-editor/preview/types.js'\nimport {\n type DateItem,\n type GovukField,\n type ListItemReadonly\n} from '~/src/form/form-editor/types.js'\n\nexport interface AppPreviewErrorPanelMacroErrorTemplate {\n advancedSettingsErrors: []\n baseErrors: { template: unknown; type: string }[]\n}\n\nexport interface AppPreviewErrorPanelMacro {\n errorTemplates: AppPreviewErrorPanelMacroErrorTemplate\n fieldDetails: {\n extraFields: GovukField[]\n basePageFields: GovukField[]\n }\n questionType: ComponentType\n}\n\nexport interface AppPreviewPanelTabsMacro {\n questionType: ComponentType\n previewPageUrl: string\n previewErrorsUrl: string\n errorTemplates: AppPreviewErrorPanelMacroErrorTemplate\n extraFields: GovukField[]\n basePageFields: GovukField[]\n}\n\nexport interface SelectAfterInput {\n afterInput: { html: string }\n}\nexport interface RadioAndCheckboxAfterInputs {\n afterInputs: { html: string }\n}\n\n// GDS components - Select uses afterInput, while Radio uses afterInputs\nexport type FormGroupAfterInput = SelectAfterInput | RadioAndCheckboxAfterInputs\n\nexport interface QuestionBaseModel {\n id?: string\n name?: string\n content?: string\n attributes?: Record<string, string>\n label?: DefaultComponent\n hint?: DefaultComponent\n fieldset?: GovukFieldset\n readonly items?: ListItemReadonly[] | DateItem[]\n text?: string\n formGroup?: FormGroupAfterInput\n type?: 'text' | 'number' | 'boolean'\n classes?: string\n previewClasses?: string\n prefix?: { text: string }\n suffix?: { text: string }\n}\n\nexport interface AppPreviewPanelMacro extends AppPreviewPanelTabsMacro {\n model: QuestionBaseModel\n}\n\nexport interface PagePreviewComponent {\n model: QuestionBaseModel\n questionType: ComponentType\n}\n\nexport interface PagePreviewPanelMacro {\n readonly pageTitle: {\n text: string\n classes: string\n }\n readonly guidance: {\n text: string\n classes: string\n }\n readonly components: PagePreviewComponent[]\n readonly sectionTitle?: {\n text: string\n classes: string\n }\n}\n\nexport interface SummaryRowActionItem {\n href: string\n text: string\n visuallyHiddenText: string\n}\n\nexport interface SummaryRow {\n key: { text: string }\n value: { text: string }\n actions: {\n items: SummaryRowActionItem[]\n }\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -160,27 +160,6 @@ export class PreviewPageController extends PreviewPageControllerBase {
|
|
|
160
160
|
}
|
|
161
161
|
return undefined;
|
|
162
162
|
}
|
|
163
|
-
get repeaterButton() {
|
|
164
|
-
if (this.repeaterButtonText === undefined) {
|
|
165
|
-
return undefined;
|
|
166
|
-
}
|
|
167
|
-
return {
|
|
168
|
-
classes: this._isHighlighted(PreviewPageControllerBase.HighlightClass.REPEATER),
|
|
169
|
-
text: this.repeaterButtonText
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
get repeaterButtonText() {
|
|
173
|
-
if (!this._isRepeater) {
|
|
174
|
-
return undefined;
|
|
175
|
-
}
|
|
176
|
-
if (this._sectionTitle === '') {
|
|
177
|
-
return '[question set name]';
|
|
178
|
-
}
|
|
179
|
-
const [firstToken, ...rest] = this._sectionTitle;
|
|
180
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
181
|
-
const restOfStr = rest ? rest.join('') : '';
|
|
182
|
-
return firstToken.toLowerCase() + restOfStr;
|
|
183
|
-
}
|
|
184
163
|
|
|
185
164
|
/**
|
|
186
165
|
* Helper method to return the guidance or a new one
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-controller.js","names":["PreviewPageControllerBase","mapComponentToPreviewQuestion","Markdown","questionRenderer","render","_questionTemplate","_questionBaseModel","PreviewPageController","PATH","_components","constructor","components","elements","definition","renderer","questions","map","firstQuestion","shift","_guidanceComponent","getOrCreateGuidanceComponent","_guidanceText","guidance","constructComponents","_showTitle","addHeading","_sectionTitle","repeatQuestion","_isRepeater","hasRepeater","HighlightClass","#constructComponents","undefined","componentsWithGuidance","_guidanceComponents","component","model","_overrideComponentHeading","questionType","componentType","showLargeTitle","componentsLength","length","_highlighted","_title","trim","question","largeTitle","fieldset","renderInput","legend","classes","label","titleAndFirstTitleSame","_getTitle","_getGuidanceText","repeaterText","_getSectionTitleText","repeaterButton","repeaterButtonText","_isHighlighted","REPEATER","text","firstToken","rest","restOfStr","join","toLowerCase","guidanceComponent","createGuidanceComponent"],"sources":["../../../../../../src/form/form-editor/preview/controller/page-controller.js"],"sourcesContent":["import { PreviewPageControllerBase } from '~/src/form/form-editor/preview/controller/page-controller-base.js'\nimport { mapComponentToPreviewQuestion } from '~/src/form/form-editor/preview/helpers.js'\nimport { Markdown } from '~/src/form/form-editor/preview/markdown.js'\n\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\nexport class PreviewPageController extends PreviewPageControllerBase {\n static PATH = PreviewPageControllerBase.PATH\n /**\n * @protected\n * @type {Question[]}\n */\n _components = []\n\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 super(elements, renderer)\n const questions = components.map(\n mapComponentToPreviewQuestion(questionRenderer, definition)\n )\n\n const firstQuestion = /** @type { Markdown | undefined | Question } */ (\n questions.shift()\n )\n this._guidanceComponent =\n PreviewPageController.getOrCreateGuidanceComponent(firstQuestion)\n this._guidanceText = elements.guidance\n this._components = this.#constructComponents(firstQuestion, questions)\n this._showTitle = elements.addHeading\n this._sectionTitle = elements.repeatQuestion ?? ''\n this._isRepeater = elements.hasRepeater\n }\n\n /**\n * @type {typeof PreviewPageControllerBase.HighlightClass}\n */\n static HighlightClass = PreviewPageControllerBase.HighlightClass\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 {PagePreviewComponent[]}\n */\n get components() {\n const componentsWithGuidance = /** @type {Question[]} */ ([\n ...this._guidanceComponents,\n ...this._components\n ])\n\n return componentsWithGuidance.map((component) => {\n return {\n model: this._overrideComponentHeading(component),\n questionType: component.componentType\n }\n })\n }\n\n /**\n * @returns {boolean}\n */\n get showLargeTitle() {\n const componentsLength =\n this._components.length + this._guidanceComponents.length\n\n if (componentsLength > 1 || this._highlighted === 'title') {\n return false\n }\n // |_ one component and title not highlighted\n if (this._title.trim() === this._components[0]?.question?.trim()) {\n return true\n }\n // titles not the same\n\n return !this._showTitle // add page heading deselected?\n }\n\n /**\n * @param {PreviewComponent} component\n * @returns {QuestionBaseModel}\n */\n _overrideComponentHeading(component) {\n const largeTitle = this.showLargeTitle\n\n const fieldset = component.renderInput.fieldset\n ? {\n fieldset: {\n legend: {\n ...component.renderInput.fieldset.legend,\n classes: largeTitle\n ? 'govuk-fieldset__legend--l'\n : 'govuk-fieldset__legend--m'\n }\n }\n }\n : {}\n\n const label = component.renderInput.label\n ? {\n label: {\n ...component.renderInput.label,\n classes: largeTitle ? 'govuk-label--l' : 'govuk-label--m'\n }\n }\n : {}\n\n return {\n ...component.renderInput,\n ...fieldset,\n ...label\n }\n }\n\n /**\n * @returns {boolean}\n */\n get titleAndFirstTitleSame() {\n return (\n this._components.length > 0 &&\n this._title.trim() === this._components[0]?.question?.trim() &&\n this.components.length === 1 &&\n this._highlighted !== 'title'\n )\n }\n\n /**\n * @returns {string}\n * @protected\n */\n _getTitle() {\n if (!this._showTitle || this.titleAndFirstTitleSame) {\n return ''\n }\n return super._getTitle()\n }\n\n /**\n * @returns {string}\n * @protected\n */\n _getGuidanceText() {\n if (!this._showTitle) {\n return ''\n }\n return super._getGuidanceText()\n }\n\n get repeaterText() {\n if (!this._isRepeater) {\n return undefined\n }\n if (!this._sectionTitle.length) {\n return 'Question set name'\n }\n return this._sectionTitle + ' 1'\n }\n\n /**\n * @returns {string|undefined}\n * @protected\n */\n _getSectionTitleText() {\n if (this._isRepeater) {\n return this.repeaterText\n }\n return undefined\n }\n\n get repeaterButton() {\n if (this.repeaterButtonText === undefined) {\n return undefined\n }\n return {\n classes: this._isHighlighted(\n PreviewPageControllerBase.HighlightClass.REPEATER\n ),\n text: this.repeaterButtonText\n }\n }\n\n get repeaterButtonText() {\n if (!this._isRepeater) {\n return undefined\n }\n\n if (this._sectionTitle === '') {\n return '[question set name]'\n }\n\n const [firstToken, ...rest] = this._sectionTitle\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const restOfStr = rest ? rest.join('') : ''\n return firstToken.toLowerCase() + restOfStr\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 PreviewPageControllerBase.createGuidanceComponent()\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 { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n * @import { FormDefinition } from '~/src/form/form-definition/types.js'\n * @import { ComponentDef } from '~/src/components/types.js'\n * @import { PagePreviewComponent } from '~/src/form/form-editor/macros/types.js'\n */\n"],"mappings":"AAAA,SAASA,yBAAyB;AAClC,SAASC,6BAA6B;AACtC,SAASC,QAAQ;;AAEjB;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG;EACvB;AACF;AACA;AACA;EACEC,MAAMA,CAACC,iBAAiB,EAAEC,kBAAkB,EAAE;IAC5C;EAAA;AAEJ,CAAC;AAED,OAAO,MAAMC,qBAAqB,SAASP,yBAAyB,CAAC;EACnE,OAAOQ,IAAI,GAAGR,yBAAyB,CAACQ,IAAI;EAC5C;AACF;AACA;AACA;EACEC,WAAW,GAAG,EAAE;;EAEhB;AACF;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAACC,UAAU,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,QAAQ,EAAE;IACtD,KAAK,CAACF,QAAQ,EAAEE,QAAQ,CAAC;IACzB,MAAMC,SAAS,GAAGJ,UAAU,CAACK,GAAG,CAC9Bf,6BAA6B,CAACE,gBAAgB,EAAEU,UAAU,CAC5D,CAAC;IAED,MAAMI,aAAa,GAAG;IACpBF,SAAS,CAACG,KAAK,CAAC,CACjB;IACD,IAAI,CAACC,kBAAkB,GACrBZ,qBAAqB,CAACa,4BAA4B,CAACH,aAAa,CAAC;IACnE,IAAI,CAACI,aAAa,GAAGT,QAAQ,CAACU,QAAQ;IACtC,IAAI,CAACb,WAAW,GAAG,IAAI,CAAC,CAACc,mBAAmB,CAACN,aAAa,EAAEF,SAAS,CAAC;IACtE,IAAI,CAACS,UAAU,GAAGZ,QAAQ,CAACa,UAAU;IACrC,IAAI,CAACC,aAAa,GAAGd,QAAQ,CAACe,cAAc,IAAI,EAAE;IAClD,IAAI,CAACC,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AAOpE,yBAAyB,CAACqE,uBAAuB,CAAC,CAAC;EAC5D;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"page-controller.js","names":["PreviewPageControllerBase","mapComponentToPreviewQuestion","Markdown","questionRenderer","render","_questionTemplate","_questionBaseModel","PreviewPageController","PATH","_components","constructor","components","elements","definition","renderer","questions","map","firstQuestion","shift","_guidanceComponent","getOrCreateGuidanceComponent","_guidanceText","guidance","constructComponents","_showTitle","addHeading","_sectionTitle","repeatQuestion","_isRepeater","hasRepeater","HighlightClass","#constructComponents","undefined","componentsWithGuidance","_guidanceComponents","component","model","_overrideComponentHeading","questionType","componentType","showLargeTitle","componentsLength","length","_highlighted","_title","trim","question","largeTitle","fieldset","renderInput","legend","classes","label","titleAndFirstTitleSame","_getTitle","_getGuidanceText","repeaterText","_getSectionTitleText","guidanceComponent","createGuidanceComponent"],"sources":["../../../../../../src/form/form-editor/preview/controller/page-controller.js"],"sourcesContent":["import { PreviewPageControllerBase } from '~/src/form/form-editor/preview/controller/page-controller-base.js'\nimport { mapComponentToPreviewQuestion } from '~/src/form/form-editor/preview/helpers.js'\nimport { Markdown } from '~/src/form/form-editor/preview/markdown.js'\n\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\nexport class PreviewPageController extends PreviewPageControllerBase {\n static PATH = PreviewPageControllerBase.PATH\n /**\n * @protected\n * @type {Question[]}\n */\n _components = []\n\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 super(elements, renderer)\n const questions = components.map(\n mapComponentToPreviewQuestion(questionRenderer, definition)\n )\n\n const firstQuestion = /** @type { Markdown | undefined | Question } */ (\n questions.shift()\n )\n this._guidanceComponent =\n PreviewPageController.getOrCreateGuidanceComponent(firstQuestion)\n this._guidanceText = elements.guidance\n this._components = this.#constructComponents(firstQuestion, questions)\n this._showTitle = elements.addHeading\n this._sectionTitle = elements.repeatQuestion ?? ''\n this._isRepeater = elements.hasRepeater\n }\n\n /**\n * @type {typeof PreviewPageControllerBase.HighlightClass}\n */\n static HighlightClass = PreviewPageControllerBase.HighlightClass\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 {PagePreviewComponent[]}\n */\n get components() {\n const componentsWithGuidance = /** @type {Question[]} */ ([\n ...this._guidanceComponents,\n ...this._components\n ])\n\n return componentsWithGuidance.map((component) => {\n return {\n model: this._overrideComponentHeading(component),\n questionType: component.componentType\n }\n })\n }\n\n /**\n * @returns {boolean}\n */\n get showLargeTitle() {\n const componentsLength =\n this._components.length + this._guidanceComponents.length\n\n if (componentsLength > 1 || this._highlighted === 'title') {\n return false\n }\n // |_ one component and title not highlighted\n if (this._title.trim() === this._components[0]?.question?.trim()) {\n return true\n }\n // titles not the same\n\n return !this._showTitle // add page heading deselected?\n }\n\n /**\n * @param {PreviewComponent} component\n * @returns {QuestionBaseModel}\n */\n _overrideComponentHeading(component) {\n const largeTitle = this.showLargeTitle\n\n const fieldset = component.renderInput.fieldset\n ? {\n fieldset: {\n legend: {\n ...component.renderInput.fieldset.legend,\n classes: largeTitle\n ? 'govuk-fieldset__legend--l'\n : 'govuk-fieldset__legend--m'\n }\n }\n }\n : {}\n\n const label = component.renderInput.label\n ? {\n label: {\n ...component.renderInput.label,\n classes: largeTitle ? 'govuk-label--l' : 'govuk-label--m'\n }\n }\n : {}\n\n return {\n ...component.renderInput,\n ...fieldset,\n ...label\n }\n }\n\n /**\n * @returns {boolean}\n */\n get titleAndFirstTitleSame() {\n return (\n this._components.length > 0 &&\n this._title.trim() === this._components[0]?.question?.trim() &&\n this.components.length === 1 &&\n this._highlighted !== 'title'\n )\n }\n\n /**\n * @returns {string}\n * @protected\n */\n _getTitle() {\n if (!this._showTitle || this.titleAndFirstTitleSame) {\n return ''\n }\n return super._getTitle()\n }\n\n /**\n * @returns {string}\n * @protected\n */\n _getGuidanceText() {\n if (!this._showTitle) {\n return ''\n }\n return super._getGuidanceText()\n }\n\n get repeaterText() {\n if (!this._isRepeater) {\n return undefined\n }\n if (!this._sectionTitle.length) {\n return 'Question set name'\n }\n return this._sectionTitle + ' 1'\n }\n\n /**\n * @returns {string|undefined}\n * @protected\n */\n _getSectionTitleText() {\n if (this._isRepeater) {\n return this.repeaterText\n }\n return undefined\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 PreviewPageControllerBase.createGuidanceComponent()\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 { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n * @import { FormDefinition } from '~/src/form/form-definition/types.js'\n * @import { ComponentDef } from '~/src/components/types.js'\n * @import { PagePreviewComponent } from '~/src/form/form-editor/macros/types.js'\n */\n"],"mappings":"AAAA,SAASA,yBAAyB;AAClC,SAASC,6BAA6B;AACtC,SAASC,QAAQ;;AAEjB;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG;EACvB;AACF;AACA;AACA;EACEC,MAAMA,CAACC,iBAAiB,EAAEC,kBAAkB,EAAE;IAC5C;EAAA;AAEJ,CAAC;AAED,OAAO,MAAMC,qBAAqB,SAASP,yBAAyB,CAAC;EACnE,OAAOQ,IAAI,GAAGR,yBAAyB,CAACQ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EAAE;MACzC,OAAOwD,iBAAiB;IAC1B;IACA,OAAO1D,yBAAyB,CAAC2D,uBAAuB,CAAC,CAAC;EAC5D;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/macros/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,aAAa,EACnB,MAAM,yCAAyC,CAAA;AAChD,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,gBAAgB,EACtB,MAAM,iCAAiC,CAAA;AAExC,MAAM,WAAW,sCAAsC;IACrD,sBAAsB,EAAE,EAAE,CAAA;IAC1B,UAAU,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAClD;AAED,MAAM,WAAW,yBAAyB;IACxC,cAAc,EAAE,sCAAsC,CAAA;IACtD,YAAY,EAAE;QACZ,WAAW,EAAE,UAAU,EAAE,CAAA;QACzB,cAAc,EAAE,UAAU,EAAE,CAAA;KAC7B,CAAA;IACD,YAAY,EAAE,aAAa,CAAA;CAC5B;AAED,MAAM,WAAW,wBAAwB;IACvC,YAAY,EAAE,aAAa,CAAA;IAC3B,cAAc,EAAE,MAAM,CAAA;IACtB,gBAAgB,EAAE,MAAM,CAAA;IACxB,cAAc,EAAE,sCAAsC,CAAA;IACtD,WAAW,EAAE,UAAU,EAAE,CAAA;IACzB,cAAc,EAAE,UAAU,EAAE,CAAA;CAC7B;AAED,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAC7B;AACD,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE;QAAE,IAAI,E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AChB,CAAA;IACD,QAAQ,CAAC,UAAU,EAAE,oBAAoB,EAAE,CAAA;IAC3C,QAAQ,CAAC,YAAY,CAAC,EAAE;QACtB,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;CACF;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,kBAAkB,EAAE,MAAM,CAAA;CAC3B;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;IACrB,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;IACvB,OAAO,EAAE;QACP,KAAK,EAAE,oBAAoB,EAAE,CAAA;KAC9B,CAAA;CACF"}
|
|
@@ -27,11 +27,6 @@ export class PreviewPageController extends PreviewPageControllerBase {
|
|
|
27
27
|
*/
|
|
28
28
|
get titleAndFirstTitleSame(): boolean;
|
|
29
29
|
get repeaterText(): string | undefined;
|
|
30
|
-
get repeaterButton(): {
|
|
31
|
-
classes: string;
|
|
32
|
-
text: string;
|
|
33
|
-
} | undefined;
|
|
34
|
-
get repeaterButtonText(): string | undefined;
|
|
35
30
|
#private;
|
|
36
31
|
}
|
|
37
32
|
import { PreviewPageControllerBase } from '../../../../form/form-editor/preview/controller/page-controller-base.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-controller.d.ts","sourceRoot":"","sources":["../../../../../../src/form/form-editor/preview/controller/page-controller.js"],"names":[],"mappings":"AAiBA;
|
|
1
|
+
{"version":3,"file":"page-controller.d.ts","sourceRoot":"","sources":["../../../../../../src/form/form-editor/preview/controller/page-controller.js"],"names":[],"mappings":"AAiBA;IA+KE;;;;;OAKG;IACH,4CAKC;IAlLD;;;;;OAKG;IACH,wBALW,YAAY,EAAE,YACd,oBAAoB,cACpB,cAAc,YACd,YAAY,EAkBtB;IAmCD;;OAEG;IACH,sBAFa,OAAO,CAgBnB;IAED;;;OAGG;IACH,qCAHW,gBAAgB,GACd,iBAAiB,CAgC7B;IAED;;OAEG;IACH,8BAFa,OAAO,CASnB;IAwBD,uCAQC;;CAyBF;0CA5MyC,mEAAmE;sCAiNxE,2CAA2C;uCAFY,yCAAyC;kCAIpG,2BAA2B;0CAJgC,yCAAyC;oCAGlG,qCAAqC;kCAHoB,yCAAyC"}
|
package/package.json
CHANGED
|
@@ -190,33 +190,6 @@ export class PreviewPageController extends PreviewPageControllerBase {
|
|
|
190
190
|
return undefined
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
get repeaterButton() {
|
|
194
|
-
if (this.repeaterButtonText === undefined) {
|
|
195
|
-
return undefined
|
|
196
|
-
}
|
|
197
|
-
return {
|
|
198
|
-
classes: this._isHighlighted(
|
|
199
|
-
PreviewPageControllerBase.HighlightClass.REPEATER
|
|
200
|
-
),
|
|
201
|
-
text: this.repeaterButtonText
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
get repeaterButtonText() {
|
|
206
|
-
if (!this._isRepeater) {
|
|
207
|
-
return undefined
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
if (this._sectionTitle === '') {
|
|
211
|
-
return '[question set name]'
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
const [firstToken, ...rest] = this._sectionTitle
|
|
215
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
216
|
-
const restOfStr = rest ? rest.join('') : ''
|
|
217
|
-
return firstToken.toLowerCase() + restOfStr
|
|
218
|
-
}
|
|
219
|
-
|
|
220
193
|
/**
|
|
221
194
|
* Helper method to return the guidance or a new one
|
|
222
195
|
* @param { Markdown | Question | undefined } guidanceComponent
|