diff --git a/src/app/core/data/lookup-relation.service.ts b/src/app/core/data/lookup-relation.service.ts index ad977e42dc..76823dbfe0 100644 --- a/src/app/core/data/lookup-relation.service.ts +++ b/src/app/core/data/lookup-relation.service.ts @@ -1,6 +1,6 @@ import { ExternalSourceService } from './external-source.service'; import { SearchService } from '../shared/search/search.service'; -import { concat, map, multicast, startWith, take, takeWhile } from 'rxjs/operators'; +import { concat, map, multicast, startWith, take, takeWhile, tap } from 'rxjs/operators'; import { PaginatedSearchOptions } from '../../shared/search/paginated-search-options.model'; import { ReplaySubject } from 'rxjs/internal/ReplaySubject'; import { RemoteData } from './remote-data'; @@ -51,6 +51,7 @@ export class LookupRelationService { if (setSearchConfig) { this.searchConfig = newConfig; } + console.log(newConfig); return this.searchService.search(newConfig).pipe( /* Make sure to only listen to the first x results, until loading is finished */ /* TODO: in Rxjs 6.4.0 and up, we can replace this with takeWhile(predicate, true) - see https://stackoverflow.com/a/44644237 */ @@ -61,6 +62,7 @@ export class LookupRelationService { concat(subject.pipe(take(1))) ) ) as any + , ) as Observable>>>; } diff --git a/src/app/core/data/relationship.service.ts b/src/app/core/data/relationship.service.ts index 957be0f6c6..9eb09bdef0 100644 --- a/src/app/core/data/relationship.service.ts +++ b/src/app/core/data/relationship.service.ts @@ -418,15 +418,4 @@ export class RelationshipService extends DataService { return update$; } - public toVirtualMetadata(relationship: Relationship, useLeft: boolean): MetadataValue { - const metadataValue = new MetadataValue(); - metadataValue.authority = VIRTUAL_METADATA_PREFIX + relationship.id; - // What if there's no name variant? - if (useLeft) { - metadataValue.value = relationship.leftwardValue - } else { - metadataValue.value = relationship.rightwardValue - } - return metadataValue; - } } diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts index 8f3a2e5edd..6c9253540e 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts @@ -315,9 +315,10 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo size: 'lg' }); const modalComp = this.modalRef.componentInstance; + + modalComp.query = this.model.value ? this.model.value.value : ''; if (hasValue(this.model.value)) { - modalComp.query = this.model.value.value; - modalComp.selectEvent.pipe(take(1)).subscribe(() => this.model.setValue(undefined)) + modalComp.selectEvent.pipe(take(1)).subscribe(() => this.model.value = ''); } modalComp.repeatable = this.model.repeatable; modalComp.listId = this.listId; @@ -325,7 +326,6 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo modalComp.metadataFields = this.model.metadataFields; modalComp.item = this.item; modalComp.submissionId = this.model.submissionId; - } /** diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form.component.html b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form.component.html index f97bff86c1..4d8123a4b9 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form.component.html +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form.component.html @@ -8,5 +8,5 @@ [ngClass]="[getClass(model, 'element', 'host'), getClass(model, 'grid', 'host')]" [templates]="templates" (dfBlur)="onEvent($event, 'blur')" - (dfChange)="onEvent($event, 'change'); log('test')" + (dfChange)="onEvent($event, 'change')" (dfFocus)="onEvent($event, 'focus')"> diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form.component.ts index 6ed845095a..ad1c18706d 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form.component.ts @@ -37,8 +37,4 @@ export class DsDynamicFormComponent extends DynamicFormComponent { constructor(protected formService: FormBuilderService, protected layoutService: DynamicFormLayoutService) { super(formService, layoutService); } - - log(t: string) { - console.log(t); - } } 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 284486e85f..19cb0eda35 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 @@ -77,9 +77,13 @@ export class DynamicConcatModel extends DynamicFormGroupModel { if (values[0].value) { (this.get(0) as DsDynamicInputModel).valueUpdates.next(values[0]); + } else { + (this.get(0) as DsDynamicInputModel).valueUpdates.next(undefined); } if (values[1].value) { (this.get(1) as DsDynamicInputModel).valueUpdates.next(values[1]); + } else { + (this.get(1) as DsDynamicInputModel).valueUpdates.next(undefined); } } diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.html b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.html index 876f77268a..f50f64045f 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.html +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.html @@ -53,7 +53,7 @@ + + {{(resultsRD$ | async)?.state}} { const parser = new DisabledFieldParser(submissionId, field, initFormValues, parserOptions); const fieldModel = parser.parse(); - console.log(fieldModel); expect(fieldModel.value).toEqual(expectedValue); }); diff --git a/src/app/shared/form/builder/parsers/field-parser.ts b/src/app/shared/form/builder/parsers/field-parser.ts index 127ea93ba7..32f4b80f37 100644 --- a/src/app/shared/form/builder/parsers/field-parser.ts +++ b/src/app/shared/form/builder/parsers/field-parser.ts @@ -86,7 +86,6 @@ export abstract class FieldParser { if (model.hasLanguages || isNotEmpty(model.relationship)) { setLayout(model, 'grid', 'control', 'col'); } - console.log(model); return [model]; } } as DynamicRowArrayModelConfig; diff --git a/src/app/shared/form/form.component.html b/src/app/shared/form/form.component.html index 3e792c2f7b..c9d41a7982 100644 --- a/src/app/shared/form/form.component.html +++ b/src/app/shared/form/form.component.html @@ -20,11 +20,6 @@ (click)="insertItem($event, group.context, group.index + 1)"> - diff --git a/src/app/shared/form/form.component.ts b/src/app/shared/form/form.component.ts index dd09370fb9..e6ebdeb91a 100644 --- a/src/app/shared/form/form.component.ts +++ b/src/app/shared/form/form.component.ts @@ -293,6 +293,7 @@ export class FormComponent implements OnDestroy, OnInit { } removeItem($event, arrayContext: DynamicFormArrayModel, index: number): void { + console.log(arrayContext, index); const formArrayControl = this.formGroup.get(this.formBuilderService.getPath(arrayContext)) as FormArray; this.removeArrayItem.emit(this.getEvent($event, arrayContext, index, 'remove')); this.formBuilderService.removeFormArrayGroup(index, formArrayControl, arrayContext);