diff --git a/demo-shell/src/app/components/form/form.component.html b/demo-shell/src/app/components/form/form.component.html index dc0bbab1a5..ec7de5cb18 100644 --- a/demo-shell/src/app/components/form/form.component.html +++ b/demo-shell/src/app/components/form/form.component.html @@ -6,6 +6,7 @@ @@ -47,6 +48,11 @@ + + + Keep prefixed space for hidden field + + diff --git a/demo-shell/src/app/components/form/form.component.ts b/demo-shell/src/app/components/form/form.component.ts index 7a4843c055..f7df6ac80b 100644 --- a/demo-shell/src/app/components/form/form.component.ts +++ b/demo-shell/src/app/components/form/form.component.ts @@ -38,6 +38,7 @@ export class FormComponent implements OnInit, OnDestroy { errorFields: FormFieldModel[] = []; formConfig: string; editor: any; + keepPrefixedSpace = true; editorOptions = { theme: 'vs-dark', @@ -85,7 +86,7 @@ export class FormComponent implements OnInit, OnDestroy { } parseForm() { - this.form = this.formService.parseForm(JSON.parse(this.formConfig)); + this.form = this.formService.parseForm(JSON.parse(this.formConfig), null, false, this.keepPrefixedSpace); } onSaveFormConfig() { @@ -113,4 +114,8 @@ export class FormComponent implements OnInit, OnDestroy { $event.target.value = ''; } + + togglePrefixedSpace() { + this.keepPrefixedSpace = !this.keepPrefixedSpace; + } } diff --git a/demo-shell/src/app/services/in-memory-form.service.ts b/demo-shell/src/app/services/in-memory-form.service.ts index 70dbc92d73..561e95dc7f 100644 --- a/demo-shell/src/app/services/in-memory-form.service.ts +++ b/demo-shell/src/app/services/in-memory-form.service.ts @@ -68,7 +68,7 @@ export class InMemoryFormService extends FormService { }); } - parseForm(json: any, data?: FormValues, readOnly: boolean = false): FormModel { + parseForm(json: any, data?: FormValues, readOnly: boolean = false, prefixedSpace: boolean = true): FormModel { if (json) { const flattenForm = { ...json.formRepresentation, @@ -81,7 +81,7 @@ export class InMemoryFormService extends FormService { formValues[variable.name] = variable.value; }); - const form = new FormModel(flattenForm, formValues, readOnly, this); + const form = new FormModel(flattenForm, formValues, readOnly, this, prefixedSpace); if (!json.fields) { form.outcomes = [ new FormOutcomeModel( form, {