diff --git a/src/app/core/core.module.ts b/src/app/core/core.module.ts index 704f6c9e62..1a4be5f6ae 100644 --- a/src/app/core/core.module.ts +++ b/src/app/core/core.module.ts @@ -337,12 +337,6 @@ export const models = }) export class CoreModule { - constructor(@Optional() @SkipSelf() parentModule: CoreModule) { - if (isNotEmpty(parentModule)) { - throw new Error('CoreModule is already loaded. Import it in the AppModule only'); - } - } - static forRoot(): ModuleWithProviders { return { ngModule: CoreModule, @@ -351,4 +345,10 @@ export class CoreModule { ] }; } + + constructor(@Optional() @SkipSelf() parentModule: CoreModule) { + if (isNotEmpty(parentModule)) { + throw new Error('CoreModule is already loaded. Import it in the AppModule only'); + } + } } diff --git a/src/app/core/submission/vocabularies/vocabulary-entries-response-parsing.service.ts b/src/app/core/submission/vocabularies/vocabulary-entries-response-parsing.service.ts index 1e5b67b261..f0c20fe7c5 100644 --- a/src/app/core/submission/vocabularies/vocabulary-entries-response-parsing.service.ts +++ b/src/app/core/submission/vocabularies/vocabulary-entries-response-parsing.service.ts @@ -23,5 +23,4 @@ export class VocabularyEntriesResponseParsingService extends EntriesResponsePars return VocabularyEntry; } - } diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/dynamic-vocabulary.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/dynamic-vocabulary.component.ts index bf09e237a5..92cf623447 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/dynamic-vocabulary.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/dynamic-vocabulary.component.ts @@ -31,9 +31,9 @@ export abstract class DsDynamicVocabularyComponent extends DynamicFormControlCom public abstract pageInfo: PageInfo; - constructor(protected vocabularyService: VocabularyService, - protected layoutService: DynamicFormLayoutService, - protected validationService: DynamicFormValidationService + protected constructor(protected vocabularyService: VocabularyService, + protected layoutService: DynamicFormLayoutService, + protected validationService: DynamicFormValidationService ) { super(layoutService, validationService); } @@ -75,7 +75,6 @@ export abstract class DsDynamicVocabularyComponent extends DynamicFormControlCom return initValue$; } - /** * Emits a blur event containing a given value. * @param event The value to emit. diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list-checkbox-group.model.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list-checkbox-group.model.ts index fab371483c..1bc427f9a6 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list-checkbox-group.model.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list-checkbox-group.model.ts @@ -22,6 +22,7 @@ export class DynamicListCheckboxGroupModel extends DynamicCheckboxGroupModel { @serializable() vocabularyOptions: VocabularyOptions; @serializable() repeatable: boolean; @serializable() groupLength: number; + @serializable() _value: VocabularyEntry[]; isListGroup = true; valueUpdates: Subject; @@ -38,7 +39,9 @@ export class DynamicListCheckboxGroupModel extends DynamicCheckboxGroupModel { this.valueUpdates.next(config.value); } - @serializable() _value: VocabularyEntry[]; + get hasAuthority(): boolean { + return this.vocabularyOptions && hasValue(this.vocabularyOptions.name); + } get value() { return this._value; @@ -55,8 +58,4 @@ export class DynamicListCheckboxGroupModel extends DynamicCheckboxGroupModel { } } } - - get hasAuthority(): boolean { - return this.vocabularyOptions && hasValue(this.vocabularyOptions.name); - } } diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.ts index 9ae4ad0737..3d946caa5e 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.ts @@ -16,7 +16,6 @@ import { ConfidenceType } from '../../../../../../core/shared/confidence-type'; import { PaginatedList } from '../../../../../../core/data/paginated-list'; import { getFirstSucceededRemoteDataPayload } from '../../../../../../core/shared/operators'; import { DsDynamicVocabularyComponent } from '../dynamic-vocabulary.component'; -import { DynamicLookupModel } from './dynamic-lookup.model'; /** * Component representing a lookup or lookup-name input field @@ -29,7 +28,7 @@ import { DynamicLookupModel } from './dynamic-lookup.model'; export class DsDynamicLookupComponent extends DsDynamicVocabularyComponent implements OnDestroy, OnInit { @Input() bindId = true; @Input() group: FormGroup; - @Input() model: DynamicLookupModel | DynamicLookupNameModel; + @Input() model: any; @Output() blur: EventEmitter = new EventEmitter(); @Output() change: EventEmitter = new EventEmitter(); @@ -272,7 +271,7 @@ export class DsDynamicLookupComponent extends DsDynamicVocabularyComponent imple public setCurrentValue(value: any, init = false) { if (init) { this.getInitValueFromModel() - .subscribe((value: FormFieldMetadataValueObject) => this.setDisplayInputValue(value.display)); + .subscribe((formValue: FormFieldMetadataValueObject) => this.setDisplayInputValue(formValue.display)); } else if (hasValue(value)) { if (value instanceof FormFieldMetadataValueObject || value instanceof VocabularyEntry) { this.setDisplayInputValue(value.display); diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.ts index af8fb1b008..7da3424e54 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.ts @@ -148,7 +148,7 @@ export class DsDynamicScrollableDropdownComponent extends DsDynamicVocabularyCom if (init) { result = this.getInitValueFromModel().pipe( - map((value: FormFieldMetadataValueObject) => value.display) + map((formValue: FormFieldMetadataValueObject) => formValue.display) ); } else { if (isEmpty(value)) { diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.component.ts index cee5e7ed05..dc2b17ce90 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.component.ts @@ -187,8 +187,8 @@ export class DsDynamicTypeaheadComponent extends DsDynamicVocabularyComponent im let result: string; if (init) { this.getInitValueFromModel() - .subscribe((value: FormFieldMetadataValueObject) => { - this.currentValue = value; + .subscribe((formValue: FormFieldMetadataValueObject) => { + this.currentValue = formValue; }); } else { if (isEmpty(value)) { diff --git a/src/app/shared/testing/vocabulary-service.stub.ts b/src/app/shared/testing/vocabulary-service.stub.ts index fef9b72557..0639294dc4 100644 --- a/src/app/shared/testing/vocabulary-service.stub.ts +++ b/src/app/shared/testing/vocabulary-service.stub.ts @@ -7,7 +7,6 @@ import { createSuccessfulRemoteDataObject$ } from '../remote-data.utils'; import { RemoteData } from '../../core/data/remote-data'; import { VocabularyOptions } from '../../core/submission/vocabularies/models/vocabulary-options.model'; - export class VocabularyServiceStub { private _payload = [ diff --git a/src/app/shared/vocabulary-treeview/vocabulary-treeview.component.ts b/src/app/shared/vocabulary-treeview/vocabulary-treeview.component.ts index 3236824376..34c9a52c60 100644 --- a/src/app/shared/vocabulary-treeview/vocabulary-treeview.component.ts +++ b/src/app/shared/vocabulary-treeview/vocabulary-treeview.component.ts @@ -270,7 +270,6 @@ export class VocabularyTreeviewComponent implements OnDestroy, OnInit { return isNotEmpty(this.searchText); } - /** * Reset tree resulting from a previous search */