diff --git a/src/app/core/data/relationship-type.service.ts b/src/app/core/data/relationship-type.service.ts index 04ce49c3c4..a9daab1986 100644 --- a/src/app/core/data/relationship-type.service.ts +++ b/src/app/core/data/relationship-type.service.ts @@ -56,11 +56,10 @@ export class RelationshipTypeService { /* Flatten the page so we can treat it like an observable */ switchMap((typeListRD: RemoteData>) => typeListRD.payload.page), switchMap((type: RelationshipType) => { - if (type.leftLabel === label) return this.checkType(type, firstType, secondType); - else if (type.rightLabel === label) return this.checkType(type, secondType, firstType); + if (type.rightLabel === label) return this.checkType(type, firstType, secondType); + else if (type.leftLabel === label) return this.checkType(type, secondType, firstType); else return []; }), - tap((t) => console.log(t)) ); } diff --git a/src/app/core/dspace-rest-v2/mocks/mock-response-map.ts b/src/app/core/dspace-rest-v2/mocks/mock-response-map.ts index 573a724c5a..cea526b078 100644 --- a/src/app/core/dspace-rest-v2/mocks/mock-response-map.ts +++ b/src/app/core/dspace-rest-v2/mocks/mock-response-map.ts @@ -6,5 +6,5 @@ export class MockResponseMap extends Map {}; export const MOCK_RESPONSE_MAP: InjectionToken = new InjectionToken('mockResponseMap'); export const mockResponseMap: MockResponseMap = new Map([ - [ '/config/submissionforms/traditionalpageone', mockSubmissionResponse ] + // [ '/config/submissionforms/traditionalpageone', mockSubmissionResponse ] ]); 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 b388889c15..5a39d4b827 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 @@ -4,7 +4,8 @@ import { ComponentFactoryResolver, ContentChildren, EventEmitter, - Input, NgZone, + Input, + NgZone, OnChanges, OnInit, Output, @@ -69,7 +70,7 @@ import { DsDynamicFormArrayComponent } from './models/array-group/dynamic-form-a import { DsDynamicRelationGroupComponent } from './models/relation-group/dynamic-relation-group.components'; import { DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP } from './models/relation-group/dynamic-relation-group.model'; import { DsDatePickerInlineComponent } from './models/date-picker-inline/dynamic-date-picker-inline.component'; -import { map, switchMap, take, tap } from 'rxjs/operators'; +import { map, switchMap, take } from 'rxjs/operators'; import { SelectableListState } from '../../../object-list/selectable-list/selectable-list.reducer'; import { Observable } from 'rxjs'; import { SearchResult } from '../../../search/search-result.model'; @@ -81,14 +82,7 @@ import { DsDynamicDisabledComponent } from './models/disabled/dynamic-disabled.c import { DYNAMIC_FORM_CONTROL_TYPE_DISABLED } from './models/disabled/dynamic-disabled.model'; import { DsDynamicLookupRelationModalComponent } from './relation-lookup-modal/dynamic-lookup-relation-modal.component'; import { ItemViewMode } from '../../../items/item-type-decorator'; -import { MetadataRepresentationType } from '../../../../core/shared/metadata-representation/metadata-representation.model'; -import { MetadatumRepresentation } from '../../../../core/shared/metadata-representation/metadatum/metadatum-representation.model'; -import { relationship } from '../../../../core/cache/builders/build-decorators'; import { ItemMetadataRepresentation } from '../../../../core/shared/metadata-representation/item/item-metadata-representation.model'; -import { RelationshipTypeService } from '../../../../core/data/relationship-type.service'; -import { RelationshipType } from '../../../../core/shared/item-relationships/relationship-type.model'; -import { RelationshipOptions } from '../models/relationship-options.model'; -import { DsDynamicInputModel } from './models/ds-dynamic-input.model'; import { getSucceededRemoteData } from '../../../../core/shared/operators'; import { RemoteData } from '../../../../core/data/remote-data'; import { Item } from '../../../../core/shared/item.model'; 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 fc618023f9..4b76c0d504 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 @@ -2,6 +2,8 @@ import { DynamicFormControlLayout, DynamicFormGroupModel, DynamicFormGroupModelC import { isNotEmpty } from '../../../../empty.util'; import { DsDynamicInputModel } from './ds-dynamic-input.model'; import { FormFieldMetadataValueObject } from '../../models/form-field-metadata-value.model'; +import { WorkspaceItem } from '../../../../../core/submission/models/workspaceitem.model'; +import { RelationshipOptions } from '../../models/relationship-options.model'; export const CONCAT_GROUP_SUFFIX = '_CONCAT_GROUP'; export const CONCAT_FIRST_INPUT_SUFFIX = '_CONCAT_FIRST_INPUT'; @@ -9,12 +11,19 @@ export const CONCAT_SECOND_INPUT_SUFFIX = '_CONCAT_SECOND_INPUT'; export interface DynamicConcatModelConfig extends DynamicFormGroupModelConfig { separator: string; + value?: any; + workspaceItem: WorkspaceItem; + relationship?: RelationshipOptions; + repeatable: boolean; } export class DynamicConcatModel extends DynamicFormGroupModel { @serializable() separator: string; @serializable() hasLanguages = false; + @serializable() workspaceItem: WorkspaceItem; + @serializable() relationship?: RelationshipOptions; + @serializable() repeatable?: boolean; isCustomGroup = true; constructor(config: DynamicConcatModelConfig, layout?: DynamicFormControlLayout) { @@ -22,6 +31,9 @@ export class DynamicConcatModel extends DynamicFormGroupModel { super(config, layout); this.separator = config.separator + ' '; + this.relationship = config.relationship; + this.workspaceItem = config.workspaceItem; + this.repeatable = config.repeatable; } get value() { 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 02a93641b7..706e96a26d 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 @@ -5,77 +5,22 @@ -