diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.html b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.html index 5f3e451945..ba44a40f2f 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.html +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.html @@ -9,7 +9,7 @@ -
+
@@ -18,7 +18,7 @@ class="text-muted" [innerHTML]="model.hint | translate" [ngClass]="getClass('element', 'hint')">
- {{ message | translate:model.validators }} + {{ message | translate: model.validators }}
@@ -49,9 +49,9 @@ - + ; - reorderable: ReorderableRelationship; + relationshipValue$: Observable; hasRelationLookup: boolean; modalRef: NgbModalRef; item: Item; @@ -247,7 +246,7 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo this.subs.push(item$.subscribe((item) => this.item = item)); const value = Object.assign(new MetadataValue(), this.model.value); if (hasValue(value) && value.isVirtual) { - this.reorderable$ = this.relationshipService.findById(value.virtualValue) + this.relationshipValue$ = this.relationshipService.findById(value.virtualValue) .pipe( getAllSucceededRemoteData(), getRemoteDataPayload(), @@ -261,12 +260,6 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo ) ) ); - - this.subs.push(this.reorderable$.subscribe((rs) => { - this.reorderable = rs; - this.ref.detectChanges(); - })); - } // this.reorderable$ = // item$.pipe( diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/array-group/dynamic-form-array.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/array-group/dynamic-form-array.component.ts index f18dcd146d..aa57cfe970 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/array-group/dynamic-form-array.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/array-group/dynamic-form-array.component.ts @@ -106,7 +106,7 @@ export class DsDynamicFormArrayComponent extends DynamicFormArrayComponent { }); if (value.isVirtual) { console.log('value.virtualValue', value.virtualValue); - this.relationshipService.findById(value.virtualValue) + return this.relationshipService.findById(value.virtualValue) .pipe( tap((relationship: Relationship) => console.log('relationship', relationship)), getSucceededRemoteData(), diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-concat.model.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-concat.model.ts index 0864d2d1ff..aefa8331c8 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-concat.model.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-concat.model.ts @@ -70,12 +70,13 @@ export class DynamicConcatModel extends DynamicFormGroupModel { } else { tempValue = value.value; } - values = [...tempValue.split(this.separator), null].map((v) => Object.assign(new FormFieldMetadataValueObject(), value, { value: v })); + values = [...tempValue.split(this.separator), null].map((v) => + Object.assign(new FormFieldMetadataValueObject(), value, { display: v, value: v })); - if (values[0]) { + if (values[0].value) { (this.get(0) as DsDynamicInputModel).valueUpdates.next(values[0]); } - if (values[1]) { + if (values[1].value) { (this.get(1) as DsDynamicInputModel).valueUpdates.next(values[1]); } } diff --git a/src/app/shared/form/builder/models/form-field-metadata-value.model.ts b/src/app/shared/form/builder/models/form-field-metadata-value.model.ts index 45489e3618..2222ef3a3f 100644 --- a/src/app/shared/form/builder/models/form-field-metadata-value.model.ts +++ b/src/app/shared/form/builder/models/form-field-metadata-value.model.ts @@ -64,4 +64,8 @@ export class FormFieldMetadataValueObject implements MetadataValueInterface { hasPlaceholder() { return this.hasValue() && this.value === PLACEHOLDER_PARENT_METADATA; } + + toString() { + return this.display || this.value; + } }