mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
Added switch to be able to check the form behaviour (#6177)
Co-authored-by: Vito Albano <vitoalbano@vitoalbano-mbp-0120.local>
This commit is contained in:
parent
1abdf07d4f
commit
302482945c
@ -6,6 +6,7 @@
|
||||
<adf-form
|
||||
[showRefreshButton]="false"
|
||||
[form]="form"
|
||||
[enableFixedSpacedForm]="keepPrefixedSpace"
|
||||
(formError)="logErrors($event)">
|
||||
</adf-form>
|
||||
</div>
|
||||
@ -47,6 +48,11 @@
|
||||
</div>
|
||||
|
||||
</mat-tab>
|
||||
<mat-tab label="Options">
|
||||
<mat-slide-toggle [checked]="keepPrefixedSpace" (change)="togglePrefixedSpace()" >
|
||||
Keep prefixed space for hidden field
|
||||
</mat-slide-toggle>
|
||||
</mat-tab>
|
||||
|
||||
</mat-tab-group>
|
||||
</div>
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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(<any> form, {
|
||||
|
Loading…
x
Reference in New Issue
Block a user