From c7c150a7dd8fbe5624339f179c3c65972c59499c Mon Sep 17 00:00:00 2001 From: lotte Date: Wed, 31 Jul 2019 16:53:05 +0200 Subject: [PATCH] moving lookup button outside of input field --- .../mocks/mock-submission-response.json | 2 +- ...amic-form-control-container.component.html | 75 +++++++++++-------- ...ynamic-form-control-container.component.ts | 20 ++--- ...namic-lookup-relation-modal.component.html | 0 ...namic-lookup-relation-modal.component.scss | 0 ...dynamic-lookup-relation-modal.component.ts | 33 ++++---- .../disabled/dynamic-disabled.component.html | 13 ++++ .../dynamic-disabled.component.ts} | 15 ++-- .../dynamic-disabled.model.ts} | 14 ++-- .../models/ds-dynamic-input.model.ts | 6 +- .../models/empty/dynamic-empty.component.html | 40 ---------- .../form/builder/models/form-field.model.ts | 4 +- .../relationship-options.model.ts | 0 .../builder/parsers/disabled-field-parser.ts | 11 +++ .../builder/parsers/empty-field-parser.ts | 11 --- .../form/builder/parsers/field-parser.ts | 8 +- .../form/builder/parsers/parser-factory.ts | 4 +- src/app/shared/mocks/mock-form-models.ts | 15 ++-- src/app/shared/shared.module.ts | 8 +- 19 files changed, 130 insertions(+), 149 deletions(-) rename src/app/shared/form/builder/ds-dynamic-form-ui/{models/empty => lookup-modal}/dynamic-lookup-relation-modal.component.html (100%) rename src/app/shared/form/builder/ds-dynamic-form-ui/{models/empty => lookup-modal}/dynamic-lookup-relation-modal.component.scss (100%) rename src/app/shared/form/builder/ds-dynamic-form-ui/{models/empty => lookup-modal}/dynamic-lookup-relation-modal.component.ts (75%) create mode 100644 src/app/shared/form/builder/ds-dynamic-form-ui/models/disabled/dynamic-disabled.component.html rename src/app/shared/form/builder/ds-dynamic-form-ui/models/{empty/dynamic-empty.component.ts => disabled/dynamic-disabled.component.ts} (58%) rename src/app/shared/form/builder/ds-dynamic-form-ui/models/{empty/dynamic-empty.model.ts => disabled/dynamic-disabled.model.ts} (51%) delete mode 100644 src/app/shared/form/builder/ds-dynamic-form-ui/models/empty/dynamic-empty.component.html rename src/app/shared/form/builder/{ds-dynamic-form-ui/models/empty/model => models}/relationship-options.model.ts (100%) create mode 100644 src/app/shared/form/builder/parsers/disabled-field-parser.ts delete mode 100644 src/app/shared/form/builder/parsers/empty-field-parser.ts diff --git a/src/app/core/dspace-rest-v2/mocks/mock-submission-response.json b/src/app/core/dspace-rest-v2/mocks/mock-submission-response.json index 50231bdcbf..398b1b9907 100644 --- a/src/app/core/dspace-rest-v2/mocks/mock-submission-response.json +++ b/src/app/core/dspace-rest-v2/mocks/mock-submission-response.json @@ -48,7 +48,7 @@ "closed": null } ], - "languageCodes": [] + "languageCodes": ["en", "nl"] } ] }, 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 f204ff856d..9f84bd358f 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,45 +9,60 @@ -
-
+
+
- + - + -
- {{ message | translate:model.validators }} -
+
+ {{ message | translate:model.validators }} +
+
+ +
+ +
+ +
+ +
-
- -
-
- -
- -
+
+
    +
  • + + + {{v | dsObjectKeys}} + {{v.name}} + +
  • +
+
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 cc6bb65824..e9dea24290 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 @@ -69,7 +69,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 } from 'rxjs/operators'; +import { map, tap } from 'rxjs/operators'; import { SelectableListState } from '../../../object-list/selectable-list/selectable-list.reducer'; import { Observable } from 'rxjs'; import { SearchResult } from '../../../search/search-result.model'; @@ -77,9 +77,9 @@ import { DSpaceObject } from '../../../../core/shared/dspace-object.model'; import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; import { RelationshipService } from '../../../../core/data/relationship.service'; import { SelectableListService } from '../../../object-list/selectable-list/selectable-list.service'; -import { DsDynamicEmptyComponent } from './models/empty/dynamic-empty.component'; -import { DYNAMIC_FORM_CONTROL_TYPE_EMPTY } from './models/empty/dynamic-empty.model'; -import { DsDynamicLookupRelationModalComponent } from './models/empty/dynamic-lookup-relation-modal.component'; +import { DsDynamicDisabledComponent } from './models/disabled/dynamic-disabled.component'; +import { DYNAMIC_FORM_CONTROL_TYPE_DISABLED } from './models/disabled/dynamic-disabled.model'; +import { DsDynamicLookupRelationModalComponent } from './lookup-modal/dynamic-lookup-relation-modal.component'; export function dsDynamicFormControlMapFn(model: DynamicFormControlModel): Type | null { switch (model.type) { @@ -136,8 +136,8 @@ export function dsDynamicFormControlMapFn(model: DynamicFormControlModel): Type< case DYNAMIC_FORM_CONTROL_TYPE_LOOKUP_NAME: return DsDynamicLookupComponent; - case DYNAMIC_FORM_CONTROL_TYPE_EMPTY: - return DsDynamicEmptyComponent; + case DYNAMIC_FORM_CONTROL_TYPE_DISABLED: + return DsDynamicDisabledComponent; default: return null; @@ -195,7 +195,6 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo private relationService: RelationshipService, private selectableListService: SelectableListService ) { - super(componentFactoryResolver, layoutService, validationService); } @@ -207,6 +206,7 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo this.listId = 'list-' + this.model.relationship.relationshipType; this.model.value = this.selectableListService.getSelectableList(this.listId).pipe( map((listState: SelectableListState) => hasValue(listState) && hasValue(listState.selection) ? listState.selection : []), + tap((t) => console.log(t)) ); } } @@ -259,12 +259,8 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo modalComp.relationKey = this.model.name; modalComp.listId = this.listId; modalComp.filter = this.filter; - modalComp.fieldName = this.searchConfig; + modalComp.searchConfiguration = this.searchConfig; modalComp.label = this.model.label; - - this.modalRef.result.then((resultString = '') => { - this.modalValuesString = resultString; - }); } removeSelection(object: SearchResult) { diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/empty/dynamic-lookup-relation-modal.component.html b/src/app/shared/form/builder/ds-dynamic-form-ui/lookup-modal/dynamic-lookup-relation-modal.component.html similarity index 100% rename from src/app/shared/form/builder/ds-dynamic-form-ui/models/empty/dynamic-lookup-relation-modal.component.html rename to src/app/shared/form/builder/ds-dynamic-form-ui/lookup-modal/dynamic-lookup-relation-modal.component.html diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/empty/dynamic-lookup-relation-modal.component.scss b/src/app/shared/form/builder/ds-dynamic-form-ui/lookup-modal/dynamic-lookup-relation-modal.component.scss similarity index 100% rename from src/app/shared/form/builder/ds-dynamic-form-ui/models/empty/dynamic-lookup-relation-modal.component.scss rename to src/app/shared/form/builder/ds-dynamic-form-ui/lookup-modal/dynamic-lookup-relation-modal.component.scss diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/empty/dynamic-lookup-relation-modal.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/lookup-modal/dynamic-lookup-relation-modal.component.ts similarity index 75% rename from src/app/shared/form/builder/ds-dynamic-form-ui/models/empty/dynamic-lookup-relation-modal.component.ts rename to src/app/shared/form/builder/ds-dynamic-form-ui/lookup-modal/dynamic-lookup-relation-modal.component.ts index 23f37bde2e..4553268733 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/empty/dynamic-lookup-relation-modal.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/lookup-modal/dynamic-lookup-relation-modal.component.ts @@ -1,26 +1,23 @@ import { Component, OnInit } from '@angular/core'; -import { PaginatedList } from '../../../../../../core/data/paginated-list'; -import { SearchResult } from '../../../../../search/search-result.model'; -import { RemoteData } from '../../../../../../core/data/remote-data'; +import { PaginatedList } from '../../../../../core/data/paginated-list'; +import { SearchResult } from '../../../../search/search-result.model'; +import { RemoteData } from '../../../../../core/data/remote-data'; import { Observable, ReplaySubject } from 'rxjs'; -import { SearchService } from '../../../../../../core/shared/search/search.service'; -import { PaginatedSearchOptions } from '../../../../../search/paginated-search-options.model'; -import { DSpaceObject } from '../../../../../../core/shared/dspace-object.model'; -import { PaginationComponentOptions } from '../../../../../pagination/pagination-component-options.model'; +import { SearchService } from '../../../../../core/shared/search/search.service'; +import { PaginatedSearchOptions } from '../../../../search/paginated-search-options.model'; +import { DSpaceObject } from '../../../../../core/shared/dspace-object.model'; +import { PaginationComponentOptions } from '../../../../pagination/pagination-component-options.model'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { hasValue, isNotEmpty } from '../../../../../empty.util'; +import { hasValue, isNotEmpty } from '../../../../empty.util'; import { concat, map, multicast, switchMap, take, takeWhile, tap } from 'rxjs/operators'; import { Router } from '@angular/router'; -import { SEARCH_CONFIG_SERVICE } from '../../../../../../+my-dspace-page/my-dspace-page.component'; -import { SearchConfigurationService } from '../../../../../../core/shared/search/search-configuration.service'; -import { SelectableListService } from '../../../../../object-list/selectable-list/selectable-list.service'; -import { SelectableListState } from '../../../../../object-list/selectable-list/selectable-list.reducer'; -import { ListableObject } from '../../../../../object-collection/shared/listable-object.model'; -import { RouteService } from '../../../../../services/route.service'; -import { getSucceededRemoteData } from '../../../../../../core/shared/operators'; - -const RELATION_TYPE_FILTER_PREFIX = 'f.entityType='; - +import { SEARCH_CONFIG_SERVICE } from '../../../../../+my-dspace-page/my-dspace-page.component'; +import { SearchConfigurationService } from '../../../../../core/shared/search/search-configuration.service'; +import { SelectableListService } from '../../../../object-list/selectable-list/selectable-list.service'; +import { SelectableListState } from '../../../../object-list/selectable-list/selectable-list.reducer'; +import { ListableObject } from '../../../../object-collection/shared/listable-object.model'; +import { RouteService } from '../../../../services/route.service'; +import { getSucceededRemoteData } from '../../../../../core/shared/operators'; @Component({ selector: 'ds-dynamic-lookup-relation-modal', diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/disabled/dynamic-disabled.component.html b/src/app/shared/form/builder/ds-dynamic-form-ui/models/disabled/dynamic-disabled.component.html new file mode 100644 index 0000000000..6681b08798 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/disabled/dynamic-disabled.component.html @@ -0,0 +1,13 @@ +
+
+
+ +
+
+
diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/empty/dynamic-empty.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/disabled/dynamic-disabled.component.ts similarity index 58% rename from src/app/shared/form/builder/ds-dynamic-form-ui/models/empty/dynamic-empty.component.ts rename to src/app/shared/form/builder/ds-dynamic-form-ui/models/disabled/dynamic-disabled.component.ts index d0e1944938..ef2cf25523 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/empty/dynamic-empty.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/disabled/dynamic-disabled.component.ts @@ -2,20 +2,17 @@ import { Component, EventEmitter, Input, Output } from '@angular/core'; import { DynamicFormControlComponent, DynamicFormLayoutService, DynamicFormValidationService } from '@ng-dynamic-forms/core'; import { FormGroup } from '@angular/forms'; -import { DynamicEmptyModel } from './dynamic-empty.model'; - -/* TODO take a look at this when the REST entities submission is finished: we will probably need to get the fixed filter from the REST instead of filtering is out from the metadata field */ -const RELATION_TYPE_METADATA_PREFIX = 'relation.isPublicationOf'; +import { DynamicDisabledModel } from './dynamic-disabled.model'; @Component({ - selector: 'ds-dynamic-empty', - templateUrl: './dynamic-empty.component.html' + selector: 'ds-dynamic-disabled', + templateUrl: './dynamic-disabled.component.html' }) -export class DsDynamicEmptyComponent extends DynamicFormControlComponent { +export class DsDynamicDisabledComponent extends DynamicFormControlComponent { @Input() formId: string; @Input() group: FormGroup; - @Input() model: DynamicEmptyModel; + @Input() model: DynamicDisabledModel; @Output() blur: EventEmitter = new EventEmitter(); @Output() change: EventEmitter = new EventEmitter(); @@ -27,6 +24,4 @@ export class DsDynamicEmptyComponent extends DynamicFormControlComponent { ) { super(layoutService, validationService); } - - } diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/empty/dynamic-empty.model.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/disabled/dynamic-disabled.model.ts similarity index 51% rename from src/app/shared/form/builder/ds-dynamic-form-ui/models/empty/dynamic-empty.model.ts rename to src/app/shared/form/builder/ds-dynamic-form-ui/models/disabled/dynamic-disabled.model.ts index aab05acbdc..eb1f3660e6 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/empty/dynamic-empty.model.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/disabled/dynamic-disabled.model.ts @@ -1,26 +1,22 @@ import { DynamicFormControlLayout, serializable } from '@ng-dynamic-forms/core'; import { DsDynamicInputModel, DsDynamicInputModelConfig } from '../ds-dynamic-input.model'; -export const DYNAMIC_FORM_CONTROL_TYPE_EMPTY = 'EMPTY'; +export const DYNAMIC_FORM_CONTROL_TYPE_DISABLED = 'EMPTY'; -export interface DsDynamicEmptyModelConfig extends DsDynamicInputModelConfig { +export interface DsDynamicDisabledModelConfig extends DsDynamicInputModelConfig { value?: any; - repeatable: boolean; } -export class DynamicEmptyModel extends DsDynamicInputModel { +export class DynamicDisabledModel extends DsDynamicInputModel { - @serializable() readonly type: string = DYNAMIC_FORM_CONTROL_TYPE_EMPTY; + @serializable() readonly type: string = DYNAMIC_FORM_CONTROL_TYPE_DISABLED; @serializable() value: any; - @serializable() repeatable: boolean; - - constructor(config: DsDynamicEmptyModelConfig, layout?: DynamicFormControlLayout) { + constructor(config: DsDynamicDisabledModelConfig, layout?: DynamicFormControlLayout) { super(config, layout); this.readOnly = true; this.disabled = true; - this.repeatable = config.repeatable; this.valueUpdates.next(config.value); } } diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-input.model.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-input.model.ts index 58f4deba81..fc39e8c2c4 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-input.model.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-input.model.ts @@ -11,7 +11,7 @@ import { AuthorityOptions } from '../../../../../core/integration/models/authori import { hasValue } from '../../../../empty.util'; import { FormFieldMetadataValueObject } from '../../models/form-field-metadata-value.model'; import { Workspaceitem } from '../../../../../core/submission/models/workspaceitem.model'; -import { RelationshipOptions } from './empty/model/relationship-options.model'; +import { RelationshipOptions } from '../../models/relationship-options.model'; import { Item } from '../../../../../core/shared/item.model'; export interface DsDynamicInputModelConfig extends DynamicInputModelConfig { @@ -21,6 +21,7 @@ export interface DsDynamicInputModelConfig extends DynamicInputModelConfig { language?: string; value?: any; relationship?: RelationshipOptions; + repeatable: boolean; } export class DsDynamicInputModel extends DynamicInputModel { @@ -31,10 +32,11 @@ export class DsDynamicInputModel extends DynamicInputModel { @serializable() languageUpdates: Subject; @serializable() workspaceItem: Workspaceitem; @serializable() relationship?: RelationshipOptions; + @serializable() repeatable?: boolean; constructor(config: DsDynamicInputModelConfig, layout?: DynamicFormControlLayout) { super(config, layout); - + this.repeatable = config.repeatable; this.readOnly = config.readOnly; this.value = config.value; this.relationship = config.relationship; diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/empty/dynamic-empty.component.html b/src/app/shared/form/builder/ds-dynamic-form-ui/models/empty/dynamic-empty.component.html deleted file mode 100644 index 9791b32023..0000000000 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/empty/dynamic-empty.component.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/app/shared/form/builder/models/form-field.model.ts b/src/app/shared/form/builder/models/form-field.model.ts index 28eef7c215..2e6f83c449 100644 --- a/src/app/shared/form/builder/models/form-field.model.ts +++ b/src/app/shared/form/builder/models/form-field.model.ts @@ -2,7 +2,7 @@ import { autoserialize } from 'cerialize'; import { FormRowModel } from '../../../../core/config/models/config-submission-forms.model'; import { LanguageCode } from './form-field-language-value.model'; import { FormFieldMetadataValueObject } from './form-field-metadata-value.model'; -import { RelationshipOptions } from '../ds-dynamic-form-ui/models/empty/model/relationship-options.model'; +import { RelationshipOptions } from './relationship-options.model'; export class FormFieldModel { @@ -34,7 +34,7 @@ export class FormFieldModel { selectableMetadata: FormFieldMetadataValueObject[]; @autoserialize - selectableRelationships: RelationshipOptions[]; + selectableRelationship: RelationshipOptions; @autoserialize rows: FormRowModel[]; diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/empty/model/relationship-options.model.ts b/src/app/shared/form/builder/models/relationship-options.model.ts similarity index 100% rename from src/app/shared/form/builder/ds-dynamic-form-ui/models/empty/model/relationship-options.model.ts rename to src/app/shared/form/builder/models/relationship-options.model.ts diff --git a/src/app/shared/form/builder/parsers/disabled-field-parser.ts b/src/app/shared/form/builder/parsers/disabled-field-parser.ts new file mode 100644 index 0000000000..5cccff4591 --- /dev/null +++ b/src/app/shared/form/builder/parsers/disabled-field-parser.ts @@ -0,0 +1,11 @@ +import { FieldParser } from './field-parser'; +import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model'; +import { DsDynamicDisabledModelConfig, DynamicDisabledModel } from '../ds-dynamic-form-ui/models/disabled/dynamic-disabled.model'; + +export class DisabledFieldParser extends FieldParser { + + public modelFactory(fieldValue?: FormFieldMetadataValueObject | any, label?: boolean): any { + const emptyModelConfig: DsDynamicDisabledModelConfig = this.initModel(null, label); + return new DynamicDisabledModel(emptyModelConfig) + } +} diff --git a/src/app/shared/form/builder/parsers/empty-field-parser.ts b/src/app/shared/form/builder/parsers/empty-field-parser.ts deleted file mode 100644 index 2716eac25d..0000000000 --- a/src/app/shared/form/builder/parsers/empty-field-parser.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { FieldParser } from './field-parser'; -import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model'; -import { DsDynamicEmptyModelConfig, DynamicEmptyModel } from '../ds-dynamic-form-ui/models/empty/dynamic-empty.model'; - -export class EmptyFieldParser extends FieldParser { - - public modelFactory(fieldValue?: FormFieldMetadataValueObject | any, label?: boolean): any { - const emptyModelConfig: DsDynamicEmptyModelConfig = this.initModel(null, label); - return new DynamicEmptyModel(emptyModelConfig) - } -} diff --git a/src/app/shared/form/builder/parsers/field-parser.ts b/src/app/shared/form/builder/parsers/field-parser.ts index e4060aeec1..7c07af10d9 100644 --- a/src/app/shared/form/builder/parsers/field-parser.ts +++ b/src/app/shared/form/builder/parsers/field-parser.ts @@ -1,4 +1,4 @@ -import { hasValue, isNotEmpty, isNotNull, isNotUndefined } from '../../../empty.util'; +import { hasValue, isEmpty, isNotEmpty, isNotNull, isNotUndefined } from '../../../empty.util'; import { FormFieldModel } from '../models/form-field.model'; import { uniqueId } from 'lodash'; @@ -27,6 +27,7 @@ export abstract class FieldParser { && (this.configData.input.type !== 'list') && (this.configData.input.type !== 'tag') && (this.configData.input.type !== 'group') + && isEmpty(this.configData.selectableRelationship) ) { let arrayCounter = 0; let fieldArrayCounter = 0; @@ -71,7 +72,7 @@ export abstract class FieldParser { } else { const model = this.modelFactory(this.getInitFieldValue()); - if (model.hasLanguages) { + if (model.hasLanguages || isNotEmpty(model.relationship)) { setLayout(model, 'grid', 'control', 'col'); } return model; @@ -185,7 +186,8 @@ export abstract class FieldParser { controlModel.readOnly = this.parserOptions.readOnly; controlModel.disabled = this.parserOptions.readOnly; controlModel.workspaceItem = this.workspaceItem; - controlModel.relationship = this.configData.selectableRelationships; + controlModel.relationship = this.configData.selectableRelationship; + controlModel.repeatable = this.configData.repeatable; // Set label this.setLabel(controlModel, label, labelEmpty); diff --git a/src/app/shared/form/builder/parsers/parser-factory.ts b/src/app/shared/form/builder/parsers/parser-factory.ts index ae38179b21..f0fed02466 100644 --- a/src/app/shared/form/builder/parsers/parser-factory.ts +++ b/src/app/shared/form/builder/parsers/parser-factory.ts @@ -12,7 +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 { EmptyFieldParser } from './empty-field-parser'; +import { DisabledFieldParser } from './disabled-field-parser'; export class ParserFactory { public static getConstructor(type: ParserType): GenericConstructor { @@ -51,7 +51,7 @@ export class ParserFactory { return TextareaFieldParser } case undefined: { - return EmptyFieldParser + return DisabledFieldParser } default: { return undefined; diff --git a/src/app/shared/mocks/mock-form-models.ts b/src/app/shared/mocks/mock-form-models.ts index fb9cbf1051..3ee0114519 100644 --- a/src/app/shared/mocks/mock-form-models.ts +++ b/src/app/shared/mocks/mock-form-models.ts @@ -1,9 +1,6 @@ import { DsDynamicInputModel } from '../form/builder/ds-dynamic-form-ui/models/ds-dynamic-input.model'; import { DynamicQualdropModel } from '../form/builder/ds-dynamic-form-ui/models/ds-dynamic-qualdrop.model'; -import { - DynamicRowArrayModel, - DynamicRowArrayModelConfig -} from '../form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-array-model'; +import { DynamicRowArrayModel, DynamicRowArrayModelConfig } from '../form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-array-model'; import { DynamicSelectModel } from '@ng-dynamic-forms/core'; import { FormRowModel } from '../../core/config/models/config-submission-forms.model'; import { SubmissionScopeType } from '../../core/submission/submission-scope-type'; @@ -14,7 +11,6 @@ import { AuthorityValue } from '../../core/integration/models/authority.value'; import { FormFieldMetadataValueObject } from '../form/builder/models/form-field-metadata-value.model'; import { DynamicRowGroupModel } from '../form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-group-model'; import { Workspaceitem } from '../../core/submission/models/workspaceitem.model'; -import { Item } from '../../core/shared/item.model'; export const qualdropSelectConfig = { name: 'dc.identifier_QUALDROP_METADATA', @@ -57,6 +53,7 @@ export const qualdropInputConfig = { id: 'dc_identifier_QUALDROP_VALUE', readOnly: false, disabled: false, + repeatable: false, value: 'test', workspaceItem: new Workspaceitem() }; @@ -123,6 +120,7 @@ const relationGroupConfig = { mandatoryField: 'false', relationFields: ['journal', 'issue'], scopeUUID: 'scope', + repeatable: false, submissionScope: SubmissionScopeType.WorkspaceItem, value: { journal: [ @@ -156,6 +154,7 @@ export const inputWithLanguageAndAuthorityConfig = { id: 'testWithAuthority', readOnly: false, disabled: false, + repeatable: false, value: { value: 'testWithLanguageAndAuthority', display: 'testWithLanguageAndAuthority', @@ -182,6 +181,7 @@ export const inputWithLanguageConfig = { id: 'testWithLanguage', readOnly: false, disabled: false, + repeatable: false, value: 'testWithLanguage', workspaceItem: new Workspaceitem() }; @@ -205,6 +205,7 @@ export const inputWithLanguageAndAuthorityArrayConfig = { id: 'testWithLanguageAndAuthorityArray', readOnly: false, disabled: false, + repeatable: false, value: [{ value: 'testLanguageAndAuthorityArray', display: 'testLanguageAndAuthorityArray', @@ -220,6 +221,7 @@ export const inputWithFormFieldValueConfig = { id: 'testWithFormField', readOnly: false, disabled: false, + repeatable: false, value: new FormFieldMetadataValueObject('testWithFormFieldValue'), workspaceItem: new Workspaceitem() }; @@ -231,6 +233,7 @@ export const inputWithAuthorityValueConfig = { id: 'testWithAuthorityField', readOnly: false, disabled: false, + repeatable: false, value: Object.assign({}, new AuthorityValue(), { value: 'testWithAuthorityValue', id: 'testWithAuthorityValue', display: 'testWithAuthorityValue' }), workspaceItem: new Workspaceitem() }; @@ -242,6 +245,7 @@ export const inputWithObjectValueConfig = { id: 'testWithObjectValue', readOnly: false, disabled: false, + repeatable: false, value: { value: 'testWithObjectValue', id: 'testWithObjectValue', display: 'testWithObjectValue' }, workspaceItem: new Workspaceitem() }; @@ -258,6 +262,7 @@ export const fileFormEditInputConfig = { id: 'dc_title', readOnly: false, disabled: false, + repeatable: false, workspaceItem: new Workspaceitem() }; diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index da911d4fd3..b99cab16fd 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -138,7 +138,7 @@ 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/empty/dynamic-lookup-relation-modal.component'; +import { DsDynamicLookupRelationModalComponent } from './form/builder/ds-dynamic-form-ui/lookup-modal/dynamic-lookup-relation-modal.component'; import { SearchResultsComponent } from './search/search-results/search-results.component'; import { SearchSidebarComponent } from './search/search-sidebar/search-sidebar.component'; import { SearchSettingsComponent } from './search/search-settings/search-settings.component'; @@ -159,7 +159,7 @@ import { SearchFacetSelectedOptionComponent } from './search/search-filters/sear import { SearchFacetRangeOptionComponent } from './search/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component'; import { SearchSwitchConfigurationComponent } from './search/search-switch-configuration/search-switch-configuration.component'; import { SearchAuthorityFilterComponent } from './search/search-filters/search-filter/search-authority-filter/search-authority-filter.component'; -import { DsDynamicEmptyComponent } from './form/builder/ds-dynamic-form-ui/models/empty/dynamic-empty.component'; +import { DsDynamicDisabledComponent } from './form/builder/ds-dynamic-form-ui/models/disabled/dynamic-disabled.component'; const MODULES = [ // Do NOT include UniversalModule, HttpModule, or JsonpModule here @@ -220,7 +220,7 @@ const COMPONENTS = [ DsDynamicFormControlContainerComponent, DsDynamicListComponent, DsDynamicLookupComponent, - DsDynamicEmptyComponent, + DsDynamicDisabledComponent, DsDynamicLookupRelationModalComponent, DsDynamicScrollableDropdownComponent, DsDynamicTagComponent, @@ -325,7 +325,7 @@ const ENTRY_COMPONENTS = [ SearchResultGridElementComponent, DsDynamicListComponent, DsDynamicLookupComponent, - DsDynamicEmptyComponent, + DsDynamicDisabledComponent, DsDynamicLookupRelationModalComponent, DsDynamicScrollableDropdownComponent, DsDynamicTagComponent,