added new input field type and started on lookup modal

This commit is contained in:
lotte
2019-06-26 16:46:15 +02:00
parent 0746aaed43
commit 96959b401c
18 changed files with 478 additions and 434 deletions

View File

@@ -104,7 +104,6 @@
"https": "1.0.0",
"js-cookie": "2.2.0",
"js.clone": "0.0.3",
"json-loader": "^0.5.7",
"jsonschema": "1.2.2",
"jwt-decode": "^2.2.0",
"methods": "1.1.2",

View File

@@ -861,7 +861,10 @@
"submit": "Submit",
"cancel": "Cancel",
"search": "Search",
"search-help": "Click here to looking for an existing correspondence",
"lookup": "Lookup",
"add": "Add",
"lookup-help": "Click here to look up an existing relation",
"add-help": "Click here to add the current entry and to add another one",
"remove": "Remove",
"clear": "Clear",
"clear-help": "Click here to remove the selected value",

View File

@@ -39,7 +39,7 @@ const effects = [
const components = [
SearchPageComponent,
SearchResultsComponent,
// SearchResultsComponent,
SearchSidebarComponent,
SearchSettingsComponent,
ItemSearchResultGridElementComponent,

View File

@@ -1,10 +1,10 @@
import { InjectionToken } from '@angular/core';
import mockSubmissionResponse from './mock-submission-response.json';
import mockSubmissionResponse from '../mocks/mock-submission-response.json';
export class MockResponseMap extends Map<string, any> {};
export const MOCK_RESPONSE_MAP: InjectionToken<MockResponseMap> = new InjectionToken<MockResponseMap>('mockResponseMap');
export const mockResponseMap: MockResponseMap = new Map([
[ 'workspaceitems', mockSubmissionResponse ]
[ '/config/submissionforms/traditionalpageone', mockSubmissionResponse ]
]);

View File

@@ -1,377 +1,291 @@
{
"id": 733,
"errors": [
{
"message": "error.validation.required",
"paths": [
"/sections/traditionalpageone/dc.title",
"/sections/traditionalpageone/dc.date.issued"
]
}
],
"lastModified": "2019-06-25T13:44:29.178+0000",
"sections": {
"license": {
"url": null,
"acceptanceDate": null,
"granted": false
},
"upload": {
"files": []
},
"collection": "51715dd3-5590-49f2-b227-6a663c849921",
"traditionalpagetwo": {},
"traditionalpageone": {}
},
"type": "workspaceitem",
"_links": {
"collection": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/submission/workspaceitems/733/collection"
},
"item": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/submission/workspaceitems/733/item"
},
"submissionDefinition": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/submission/workspaceitems/733/submissionDefinition"
},
"submitter": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/submission/workspaceitems/733/submitter"
},
"self": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/submission/workspaceitems/733"
}
},
"_embedded": {
"submitter": {
"id": "335647b6-8a52-4ecb-a8c1-7ebabb199bda",
"uuid": "335647b6-8a52-4ecb-a8c1-7ebabb199bda",
"name": "dspacedemo+admin@gmail.com",
"handle": null,
"metadata": {
"eperson.firstname": [
{
"value": "Demo",
"language": null,
"authority": null,
"confidence": -1,
"place": 0
}
],
"eperson.language": [
{
"value": "en",
"language": null,
"authority": null,
"confidence": -1,
"place": 0
}
],
"eperson.lastname": [
{
"value": "Site Administrator",
"language": null,
"authority": null,
"confidence": -1,
"place": 0
}
]
},
"netid": null,
"lastActive": "2019-06-25T13:44:28.616+0000",
"canLogIn": true,
"email": "dspacedemo+admin@gmail.com",
"requireCertificate": false,
"selfRegistered": false,
"type": "eperson",
"_links": {
"groups": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/eperson/epersons/335647b6-8a52-4ecb-a8c1-7ebabb199bda/groups"
},
"self": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/eperson/epersons/335647b6-8a52-4ecb-a8c1-7ebabb199bda"
}
},
"_embedded": {
"groups": null
}
},
"item": {
"id": "0b692d3b-70b9-415f-a56d-e557f026accc",
"uuid": "0b692d3b-70b9-415f-a56d-e557f026accc",
"name": null,
"handle": null,
"metadata": {},
"inArchive": false,
"discoverable": true,
"withdrawn": false,
"lastModified": "2019-06-25T13:44:29.160+0000",
"type": "item",
"_links": {
"bitstreams": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/core/items/0b692d3b-70b9-415f-a56d-e557f026accc/bitstreams"
},
"owningCollection": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/core/items/0b692d3b-70b9-415f-a56d-e557f026accc/owningCollection"
},
"relationships": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/core/items/0b692d3b-70b9-415f-a56d-e557f026accc/relationships"
},
"templateItemOf": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/core/items/0b692d3b-70b9-415f-a56d-e557f026accc/templateItemOf"
},
"self": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/core/items/0b692d3b-70b9-415f-a56d-e557f026accc"
}
},
"_embedded": {
"relationships": {
"_embedded": {
"relationships": []
},
"page": {
"number": 0,
"size": 0,
"totalPages": 1,
"totalElements": 0
},
"_links": {
"self": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/core/items/0b692d3b-70b9-415f-a56d-e557f026accc/relationships"
}
}
},
"owningCollection": null,
"templateItemOf": null,
"bitstreams": {
"_embedded": {
"bitstreams": []
},
"page": {
"number": 0,
"size": 0,
"totalPages": 1,
"totalElements": 0
},
"_links": {
"self": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/core/items/0b692d3b-70b9-415f-a56d-e557f026accc/bitstreams"
}
}
}
}
},
"submissionDefinition": {
"id": "traditional",
"name": "traditional",
"type": "submissiondefinition",
"isDefault": true,
"_links": {
"collections": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissiondefinitions/traditional/collections"
},
"sections": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissiondefinitions/traditional/sections"
},
"self": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissiondefinitions/traditional"
}
},
"_embedded": {
"collections": {
"_embedded": {
"collections": []
},
"page": {
"number": 0,
"size": 0,
"totalPages": 1,
"totalElements": 0
},
"_links": {
"self": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissiondefinitions/traditional/collections"
}
}
},
"sections": {
"_embedded": {
"sections": [
{
"id": "collection",
"mandatory": true,
"sectionType": "collection",
"visibility": {
"main": "HIDDEN",
"other": "HIDDEN"
},
"type": "submissionsection",
"_links": {
"self": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissionsections/collection"
}
}
},
{
"id": "relationships",
"header": "submit.progressbar.relationships",
"mandatory": true,
"sectionType": "relationships",
"type": "submissionsection",
"_links": {
"self": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissionsections/relationships"
}
}
},
{
"id": "traditionalpageone",
"header": "submit.progressbar.describe.stepone",
"name": "traditionalpageone",
"rows": [
{
"fields": [
{
"input": {
"type": "lookup-relation"
},
"label": "Journal Issue",
"mandatory": true,
"sectionType": "submission-form",
"type": "submissionsection",
"repeatable": false,
"mandatoryMessage": "Required field!",
"hints": "Select a journal issue for this publication.",
"selectableMetadata": [
{
"metadata": "relation.isPublicationOfJournalIssue",
"label": null,
"authority": null,
"closed": null
}
],
"languageCodes": []
}
]
},
{
"fields": [
{
"input": {
"type": "name"
},
"label": "Authors",
"mandatory": false,
"repeatable": true,
"hints": "Enter the names of the authors of this item.",
"selectableMetadata": [
{
"metadata": "dc.contributor.author",
"label": null,
"authority": null,
"closed": null
}
],
"languageCodes": []
}
]
},
{
"fields": [
{
"input": {
"type": "onebox"
},
"label": "Title",
"mandatory": true,
"repeatable": false,
"mandatoryMessage": "You must enter a main title for this item.",
"hints": "Enter the main title of the item.",
"selectableMetadata": [
{
"metadata": "dc.title",
"label": null,
"authority": null,
"closed": null
}
],
"languageCodes": []
}
]
},
{
"fields": [
{
"input": {
"type": "onebox"
},
"label": "Other Titles",
"mandatory": false,
"repeatable": true,
"hints": "If the item has any alternative titles, please enter them here.",
"selectableMetadata": [
{
"metadata": "dc.title.alternative",
"label": null,
"authority": null,
"closed": null
}
],
"languageCodes": []
}
]
},
{
"fields": [
{
"input": {
"type": "date"
},
"label": "Date of Issue",
"mandatory": true,
"repeatable": false,
"mandatoryMessage": "You must enter at least the year.",
"hints": "Please give the date of previous publication or public distribution.\n You can leave out the day and/or month if they aren't\n applicable.",
"style": "col-sm-4",
"selectableMetadata": [
{
"metadata": "dc.date.issued",
"label": null,
"authority": null,
"closed": null
}
],
"languageCodes": []
},
{
"input": {
"type": "onebox"
},
"label": "Publisher",
"mandatory": false,
"repeatable": false,
"hints": "Enter the name of the publisher of the previously issued instance of this item.",
"style": "col-sm-8",
"selectableMetadata": [
{
"metadata": "dc.publisher",
"label": null,
"authority": null,
"closed": null
}
],
"languageCodes": []
}
]
},
{
"fields": [
{
"input": {
"type": "onebox"
},
"label": "Citation",
"mandatory": false,
"repeatable": false,
"hints": "Enter the standard citation for the previously issued instance of this item.",
"selectableMetadata": [
{
"metadata": "dc.identifier.citation",
"label": null,
"authority": null,
"closed": null
}
],
"languageCodes": []
}
]
},
{
"fields": [
{
"input": {
"type": "series"
},
"label": "Series/Report No.",
"mandatory": false,
"repeatable": true,
"hints": "Enter the series and number assigned to this item by your community.",
"selectableMetadata": [
{
"metadata": "dc.relation.ispartofseries",
"label": null,
"authority": null,
"closed": null
}
],
"languageCodes": []
}
]
},
{
"fields": [
{
"input": {
"type": "onebox"
},
"label": "Identifiers",
"mandatory": false,
"repeatable": true,
"hints": "If the item has any identification numbers or codes associated with\nit, please enter the types and the actual numbers or codes.",
"selectableMetadata": [
{
"metadata": "dc.identifier.issn",
"label": "ISSN",
"authority": null,
"closed": null
},
{
"metadata": "dc.identifier.other",
"label": "Other",
"authority": null,
"closed": null
},
{
"metadata": "dc.identifier.ismn",
"label": "ISMN",
"authority": null,
"closed": null
},
{
"metadata": "dc.identifier.govdoc",
"label": "Gov't Doc #",
"authority": null,
"closed": null
},
{
"metadata": "dc.identifier.uri",
"label": "URI",
"authority": null,
"closed": null
},
{
"metadata": "dc.identifier.isbn",
"label": "ISBN",
"authority": null,
"closed": null
},
{
"metadata": "dc.identifier.doi",
"label": "DOI",
"authority": null,
"closed": null
}
],
"languageCodes": []
}
]
},
{
"fields": [
{
"input": {
"type": "dropdown"
},
"label": "Type",
"mandatory": false,
"repeatable": true,
"hints": "Select the type(s) of content of the item. To select more than one value in the list, you may have to hold down the \"CTRL\" or \"Shift\" key.",
"selectableMetadata": [
{
"metadata": "dc.type",
"label": null,
"authority": "common_types",
"closed": false
}
],
"languageCodes": []
}
]
},
{
"fields": [
{
"input": {
"type": "dropdown"
},
"label": "Language",
"mandatory": false,
"repeatable": false,
"hints": "Select the language of the main content of the item. If the language does not appear in the list, please select 'Other'. If the content does not really have a language (for example, if it is a dataset or an image) please select 'N/A'.",
"selectableMetadata": [
{
"metadata": "dc.language.iso",
"label": null,
"authority": "common_iso_languages",
"closed": false
}
],
"languageCodes": []
}
]
}
],
"type": "submissionform",
"_links": {
"self": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissionsections/traditionalpageone"
},
"config": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissionforms/traditionalpageone"
}
}
},
{
"id": "traditionalpagetwo",
"header": "submit.progressbar.describe.steptwo",
"mandatory": true,
"sectionType": "submission-form",
"type": "submissionsection",
"_links": {
"self": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissionsections/traditionalpagetwo"
},
"config": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissionforms/traditionalpagetwo"
}
}
},
{
"id": "upload",
"header": "submit.progressbar.upload",
"mandatory": true,
"sectionType": "upload",
"type": "submissionsection",
"_links": {
"self": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissionsections/upload"
},
"config": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissionuploads/upload"
}
}
},
{
"id": "license",
"header": "submit.progressbar.license",
"mandatory": true,
"sectionType": "license",
"visibility": {
"main": null,
"other": "READONLY"
},
"type": "submissionsection",
"_links": {
"self": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissionsections/license"
}
}
}
]
},
"page": {
"number": 0,
"size": 20,
"totalPages": 1,
"totalElements": 5
},
"_links": {
"self": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissiondefinitions/traditional/sections"
}
}
}
}
},
"collection": {
"id": "51715dd3-5590-49f2-b227-6a663c849921",
"uuid": "51715dd3-5590-49f2-b227-6a663c849921",
"name": "1-step Workflow collection",
"handle": "123456789/500",
"metadata": {
"dc.description": [
{
"value": "Start a new <a href=\"/submit\">submission</a>.",
"language": null,
"authority": null,
"confidence": -1,
"place": 0
}
],
"dc.title": [
{
"value": "1-step Workflow collection",
"language": null,
"authority": null,
"confidence": -1,
"place": 0
}
]
},
"type": "collection",
"_links": {
"license": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/core/collections/51715dd3-5590-49f2-b227-6a663c849921/license"
},
"defaultAccessConditions": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/core/collections/51715dd3-5590-49f2-b227-6a663c849921/defaultAccessConditions"
},
"logo": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/core/collections/51715dd3-5590-49f2-b227-6a663c849921/logo"
},
"self": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/core/collections/51715dd3-5590-49f2-b227-6a663c849921"
}
},
"_embedded": {
"logo": null,
"defaultAccessConditions": {
"_embedded": {
"defaultAccessConditions": [
{
"id": 3649,
"name": null,
"groupUUID": "f2c7eb75-aec0-4604-ab7f-6676723818ad",
"action": "DEFAULT_BITSTREAM_READ",
"type": "resourcePolicy",
"_links": {
"self": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/authz/resourcePolicies/3649"
}
}
}
]
},
"page": {
"number": 0,
"size": 20,
"totalPages": 1,
"totalElements": 1
},
"_links": {
"self": {
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/core/collections/51715dd3-5590-49f2-b227-6a663c849921/defaultAccessConditions"
}
}
}
}
}
}
}

View File

@@ -68,10 +68,12 @@ 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 { DYNAMIC_FORM_CONTROL_TYPE_LOOKUP_RELATION } from './models/lookup-relation/dynamic-lookup-relation.model';
import { DsDynamicLookupRelationComponent } from './models/lookup-relation/dynamic-lookup-relation.component';
export function dsDynamicFormControlMapFn(model: DynamicFormControlModel): Type<DynamicFormControl> | null {
console.log(model.type);
switch (model.type) {
case DYNAMIC_FORM_CONTROL_TYPE_ARRAY:
return DsDynamicFormArrayComponent;
@@ -125,6 +127,9 @@ export function dsDynamicFormControlMapFn(model: DynamicFormControlModel): Type<
case DYNAMIC_FORM_CONTROL_TYPE_LOOKUP_NAME:
return DsDynamicLookupComponent;
case DYNAMIC_FORM_CONTROL_TYPE_LOOKUP_RELATION:
return DsDynamicLookupRelationComponent;
default:
return null;
}
@@ -166,6 +171,7 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
}
protected test: boolean;
constructor(
protected componentFactoryResolver: ComponentFactoryResolver,
protected layoutService: DynamicFormLayoutService,

View File

@@ -0,0 +1,7 @@
<div>
LOOKUP WINDOW FOR {{relationKey}}
<ds-search-results [searchResults]="resultsRD$ | async"
[searchConfig]="{}"
[fixedFilter]="relationKey"
[disableHeader]="true"></ds-search-results>
</div>

View File

@@ -0,0 +1,29 @@
import { Component, OnInit } from '@angular/core';
import { PaginatedList } from '../../../../../../core/data/paginated-list';
import { SearchResult } from '../../../../../../+search-page/search-result.model';
import { RemoteData } from '../../../../../../core/data/remote-data';
import { Observable } from 'rxjs';
import { SearchService } from '../../../../../../+search-page/search-service/search.service';
import { PaginatedSearchOptions } from '../../../../../../+search-page/paginated-search-options.model';
import { DSpaceObject } from '../../../../../../core/shared/dspace-object.model';
const RELATION_TYPE_FILTER_PREFIX = 'f.entityType=';
@Component({
selector: 'ds-dynamic-lookup-relation-modal',
// styleUrls: ['./dynamic-lookup-relation-modal.component.scss'],
templateUrl: './dynamic-lookup-relation-modal.component.html'
})
export class DsDynamicLookupRelationModalComponent implements OnInit {
relationKey: string;
resultsRD$: Observable<RemoteData<PaginatedList<SearchResult<DSpaceObject>>>>;
constructor(private searchService: SearchService) {
}
ngOnInit(): void {
this.resultsRD$ = this.searchService.search(
new PaginatedSearchOptions({ fixedFilter: RELATION_TYPE_FILTER_PREFIX + this.relationKey }));
}
}

View File

@@ -0,0 +1,34 @@
<div>
<div class="form-row align-items-center">
<!--Simple lookup, first field -->
<div class="col right-addon">
<input class="form-control"
[attr.autoComplete]="model.autoComplete"
[class.is-invalid]="showErrorMessages"
[dynamicId]="bindId && model.id"
[name]="model.name"
[type]="model.inputType"
[(ngModel)]="model.value"
[disabled]="model.disabled"
[placeholder]="model.placeholder | translate"
[readonly]="model.readOnly">
</div>
<div class="col-auto text-center">
<button class="btn btn-secondary"
type="button"
ngbTooltip="{{'form.lookup-help' | translate}}"
placement="top"
(click)="openLookup(); $event.stopPropagation();">{{'form.lookup' | translate}}
</button>
</div>
<div class="col-auto text-center">
<button class="btn btn-secondary"
type="button"
ngbTooltip="{{'form.add-help' | translate}}"
placement="top"
[disabled]="!hasEmptyValue()"
(click)="alert('add'); $event.stopPropagation();">{{'form.add' | translate}}
</button>
</div>
</div>
</div>

View File

@@ -0,0 +1,56 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import {
DynamicFormControlComponent,
DynamicFormLayoutService,
DynamicFormValidationService
} from '@ng-dynamic-forms/core';
import { FormGroup } from '@angular/forms';
import { DynamicRelationGroupModel } from '../relation-group/dynamic-relation-group.model';
import { isNotEmpty } from '../../../../../empty.util';
import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import { DsDynamicLookupRelationModalComponent } from './dynamic-lookup-relation-modal.component';
@Component({
selector: 'ds-dynamic-lookup-relation',
// styleUrls: ['./dynamic-lookup-relation.component.scss'],
templateUrl: './dynamic-lookup-relation.component.html'
})
export class DsDynamicLookupRelationComponent extends DynamicFormControlComponent implements OnInit {
@Input() formId: string;
@Input() group: FormGroup;
@Input() model: DynamicRelationGroupModel;
@Output() blur: EventEmitter<any> = new EventEmitter<any>();
@Output() change: EventEmitter<any> = new EventEmitter<any>();
@Output() focus: EventEmitter<any> = new EventEmitter<any>();
modalRef: NgbModalRef;
constructor(private modalService: NgbModal,
protected layoutService: DynamicFormLayoutService,
protected validationService: DynamicFormValidationService
) {
super(layoutService, validationService);
}
ngOnInit(): void {
}
public hasEmptyValue() {
return isNotEmpty(this.model.value);
}
openLookup() {
this.modalRef = this.modalService.open(DsDynamicLookupRelationModalComponent);
this.modalRef.componentInstance.relationKey = this.model.name;
this.modalRef.result.then((result) => {
this.model.value = result;
});
}
alert(t: string) {
alert(t);
}
}

View File

@@ -0,0 +1,23 @@
import { DynamicFormControlLayout, serializable } from '@ng-dynamic-forms/core';
import { DsDynamicInputModel, DsDynamicInputModelConfig } from '../ds-dynamic-input.model';
export const DYNAMIC_FORM_CONTROL_TYPE_LOOKUP_RELATION = 'LOOKUP_RELATION';
export interface DynamicLookupRelationModelConfig extends DsDynamicInputModelConfig {
value?: any;
}
export class DynamicLookupRelationModel extends DsDynamicInputModel {
@serializable() readonly type: string = DYNAMIC_FORM_CONTROL_TYPE_LOOKUP_RELATION;
@serializable() value: any;
constructor(config: DynamicLookupRelationModelConfig, layout?: DynamicFormControlLayout) {
super(config, layout);
this.readOnly = true;
this.disabled = true;
this.valueUpdates.next(config.value);
}
}

View File

@@ -0,0 +1,17 @@
import { FieldParser } from './field-parser';
import { DynamicLookupModel, DynamicLookupModelConfig } from '../ds-dynamic-form-ui/models/lookup/dynamic-lookup.model';
import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model';
import {
DynamicLookupRelationModel,
DynamicLookupRelationModelConfig
} from '../ds-dynamic-form-ui/models/lookup-relation/dynamic-lookup-relation.model';
export class LookupRelationFieldParser extends FieldParser {
public modelFactory(fieldValue?: FormFieldMetadataValueObject | any, label?: boolean): any {
const lookupModelConfig: DynamicLookupRelationModelConfig = this.initModel(null, label);
return new DynamicLookupRelationModel(lookupModelConfig);
}
}

View File

@@ -12,6 +12,7 @@ import { NameFieldParser } from './name-field-parser';
import { SeriesFieldParser } from './series-field-parser';
import { TagFieldParser } from './tag-field-parser';
import { TextareaFieldParser } from './textarea-field-parser';
import { LookupRelationFieldParser } from './lookup-relation-field-parser';
export class ParserFactory {
public static getConstructor(type: ParserType): GenericConstructor<FieldParser> {
@@ -34,6 +35,9 @@ export class ParserFactory {
case ParserType.LookupName: {
return LookupNameFieldParser
}
case ParserType.LookupRelation: {
return LookupRelationFieldParser
}
case ParserType.Onebox: {
return OneboxFieldParser
}

View File

@@ -5,6 +5,7 @@ export enum ParserType {
List = 'list',
Lookup = 'lookup',
LookupName = 'lookup-name',
LookupRelation = 'lookup-relation',
Onebox = 'onebox',
Name = 'name',
Series = 'series',

View File

@@ -78,6 +78,7 @@ import { SortablejsModule } from 'angular-sortablejs';
import { NumberPickerComponent } from './number-picker/number-picker.component';
import { DsDatePickerComponent } from './form/builder/ds-dynamic-form-ui/models/date-picker/date-picker.component';
import { DsDynamicLookupComponent } from './form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component';
import { DsDynamicLookupRelationComponent } from './form/builder/ds-dynamic-form-ui/models/lookup-relation/dynamic-lookup-relation.component';
import { MockAdminGuard } from './mocks/mock-admin-guard.service';
import { AlertComponent } from './alert/alert.component';
import { MyDSpaceResultListElementComponent } from './object-list/my-dspace-result-list-element/my-dspace-result-list-element.component';
@@ -138,6 +139,8 @@ import { RoleDirective } from './roles/role.directive';
import { UserMenuComponent } from './auth-nav-menu/user-menu/user-menu.component';
import { ClaimedTaskActionsReturnToPoolComponent } from './mydspace-actions/claimed-task/return-to-pool/claimed-task-actions-return-to-pool.component';
import { ItemDetailPreviewFieldComponent } from './object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview-field/item-detail-preview-field.component';
import { DsDynamicLookupRelationModalComponent } from './form/builder/ds-dynamic-form-ui/models/lookup-relation/dynamic-lookup-relation-modal.component';
import { SearchResultsComponent } from '../+search-page/search-results/search-results.component';
const MODULES = [
// Do NOT include UniversalModule, HttpModule, or JsonpModule here
@@ -198,6 +201,8 @@ const COMPONENTS = [
DsDynamicFormControlContainerComponent,
DsDynamicListComponent,
DsDynamicLookupComponent,
DsDynamicLookupRelationComponent,
DsDynamicLookupRelationModalComponent,
DsDynamicScrollableDropdownComponent,
DsDynamicTagComponent,
DsDynamicTypeaheadComponent,
@@ -257,7 +262,8 @@ const COMPONENTS = [
ItemSearchResultListElementComponent,
TypedItemSearchResultListElementComponent,
ItemTypeSwitcherComponent,
BrowseByComponent
BrowseByComponent,
SearchResultsComponent
];
const ENTRY_COMPONENTS = [
@@ -280,6 +286,8 @@ const ENTRY_COMPONENTS = [
SearchResultGridElementComponent,
DsDynamicListComponent,
DsDynamicLookupComponent,
DsDynamicLookupRelationComponent,
DsDynamicLookupRelationModalComponent,
DsDynamicScrollableDropdownComponent,
DsDynamicTagComponent,
DsDynamicTypeaheadComponent,
@@ -300,7 +308,8 @@ const ENTRY_COMPONENTS = [
StartsWithTextComponent,
PlainTextMetadataListElementComponent,
ItemMetadataListElementComponent,
MetadataRepresentationListElementComponent
MetadataRepresentationListElementComponent,
SearchResultsComponent
];
const SHARED_ITEM_PAGE_COMPONENTS = [

View File

@@ -1,49 +0,0 @@
import { ChangeDetectorRef, Component, Inject } from '@angular/core';
import { Observable } from 'rxjs';
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
import { FormService } from '../../../shared/form/form.service';
import { SectionModelComponent } from '../models/section.model';
import { SectionDataObject } from '../models/section-data.model';
import { renderSectionFor } from '../sections-decorator';
import { SectionsType } from '../sections-type';
import { SubmissionService } from '../../submission.service';
import { SectionsService } from '../sections.service';
import { CollectionDataService } from '../../../core/data/collection-data.service';
import { JsonPatchOperationsBuilder } from '../../../core/json-patch/builder/json-patch-operations-builder';
/**
* This component represents a section that contains a Form.
*/
@Component({
selector: 'ds-submission-section-relationships',
styleUrls: ['./section-relationships.component.scss'],
templateUrl: './section-relationships.component.html',
})
@renderSectionFor(SectionsType.Relationships)
export class SubmissionSectionRelationshipComponent extends SectionModelComponent {
constructor(protected changeDetectorRef: ChangeDetectorRef,
protected collectionDataService: CollectionDataService,
protected formBuilderService: FormBuilderService,
protected formService: FormService,
protected operationsBuilder: JsonPatchOperationsBuilder,
protected sectionService: SectionsService,
protected submissionService: SubmissionService,
@Inject('collectionIdProvider') public injectedCollectionId: string,
@Inject('sectionDataProvider') public injectedSectionData: SectionDataObject,
@Inject('submissionIdProvider') public injectedSubmissionId: string) {
super(injectedCollectionId, injectedSectionData, injectedSubmissionId);
}
protected getSectionStatus(): Observable<boolean> {
return undefined;
}
protected onSectionDestroy(): void {
}
protected onSectionInit(): void {
}
}

View File

@@ -91,10 +91,6 @@ module.exports = {
{
test: /\.html$/,
loader: 'raw-loader'
},
{
test: /\.json$/,
loader: 'json-loader'
}
]
},

View File

@@ -5582,11 +5582,6 @@ jsesc@~0.5.0:
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d"
integrity sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=
json-loader@^0.5.7:
version "0.5.7"
resolved "https://registry.yarnpkg.com/json-loader/-/json-loader-0.5.7.tgz#dca14a70235ff82f0ac9a3abeb60d337a365185d"
integrity sha512-QLPs8Dj7lnf3e3QYS1zkCo+4ZwqOiF9d/nZnYozTISxXWCfNs9yuky5rJw4/W34s7POaNlbZmQGaB5NiXCbP4w==
json-parse-better-errors@^1.0.1, json-parse-better-errors@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9"