mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
fixed compilation issues
This commit is contained in:
@@ -103,15 +103,16 @@ describe('DsDynamicFormControlContainerComponent test suite', () => {
|
||||
new DynamicSwitchModel({ id: 'switch' }),
|
||||
new DynamicTextAreaModel({ id: 'textarea' }),
|
||||
new DynamicTimePickerModel({ id: 'timepicker' }),
|
||||
new DynamicTypeaheadModel({ id: 'typeahead', metadataFields: [], repeatable: false, submissionId: '1234' }),
|
||||
new DynamicTypeaheadModel({ id: 'typeahead', metadataFields: [], repeatable: false, submissionId: '1234', hasSelectableMetadata: false }),
|
||||
new DynamicScrollableDropdownModel({
|
||||
id: 'scrollableDropdown',
|
||||
authorityOptions: authorityOptions,
|
||||
metadataFields: [],
|
||||
repeatable: false,
|
||||
submissionId: '1234'
|
||||
submissionId: '1234',
|
||||
hasSelectableMetadata: false
|
||||
}),
|
||||
new DynamicTagModel({ id: 'tag', metadataFields: [], repeatable: false, submissionId: '1234' }),
|
||||
new DynamicTagModel({ id: 'tag', metadataFields: [], repeatable: false, submissionId: '1234', hasSelectableMetadata: false }),
|
||||
new DynamicListCheckboxGroupModel({
|
||||
id: 'checkboxList',
|
||||
authorityOptions: authorityOptions,
|
||||
@@ -132,11 +133,12 @@ describe('DsDynamicFormControlContainerComponent test suite', () => {
|
||||
scopeUUID: '',
|
||||
submissionScope: '',
|
||||
repeatable: false,
|
||||
metadataFields: []
|
||||
metadataFields: [],
|
||||
hasSelectableMetadata: false
|
||||
}),
|
||||
new DynamicDsDatePickerModel({ id: 'datepicker' }),
|
||||
new DynamicLookupModel({ id: 'lookup', metadataFields: [], repeatable: false, submissionId: '1234' }),
|
||||
new DynamicLookupNameModel({ id: 'lookupName', metadataFields: [], repeatable: false, submissionId: '1234' }),
|
||||
new DynamicLookupModel({ id: 'lookup', metadataFields: [], repeatable: false, submissionId: '1234', hasSelectableMetadata: false }),
|
||||
new DynamicLookupNameModel({ id: 'lookupName', metadataFields: [], repeatable: false, submissionId: '1234', hasSelectableMetadata: false}),
|
||||
new DynamicQualdropModel({ id: 'combobox', readOnly: false, required: false })
|
||||
];
|
||||
const testModel = formModel[8];
|
||||
|
@@ -1,20 +1,12 @@
|
||||
import { CdkDragDrop } from '@angular/cdk/drag-drop';
|
||||
import {
|
||||
ChangeDetectorRef,
|
||||
Component,
|
||||
EventEmitter,
|
||||
Input,
|
||||
NgZone,
|
||||
OnInit,
|
||||
Output,
|
||||
QueryList
|
||||
} from '@angular/core';
|
||||
import { ChangeDetectorRef, Component, EventEmitter, Input, NgZone, OnInit, Output, QueryList } from '@angular/core';
|
||||
import { AbstractControl, FormControl, FormGroup } from '@angular/forms';
|
||||
import {
|
||||
DynamicFormArrayComponent,
|
||||
DynamicFormArrayGroupModel,
|
||||
DynamicFormControlCustomEvent,
|
||||
DynamicFormControlEvent, DynamicFormControlEventType,
|
||||
DynamicFormControlEvent,
|
||||
DynamicFormControlEventType,
|
||||
DynamicFormLayout,
|
||||
DynamicFormLayoutService,
|
||||
DynamicFormService,
|
||||
@@ -22,25 +14,18 @@ import {
|
||||
DynamicTemplateDirective
|
||||
} from '@ng-dynamic-forms/core';
|
||||
import { combineLatest as observableCombineLatest, Observable, of as observableOf } from 'rxjs';
|
||||
import { map, switchMap, take, tap, filter } from 'rxjs/operators';
|
||||
import { filter, map, switchMap, take } from 'rxjs/operators';
|
||||
import { RelationshipService } from '../../../../../../core/data/relationship.service';
|
||||
import { RemoteData } from '../../../../../../core/data/remote-data';
|
||||
import { Relationship } from '../../../../../../core/shared/item-relationships/relationship.model';
|
||||
import { Item } from '../../../../../../core/shared/item.model';
|
||||
import { MetadataValue } from '../../../../../../core/shared/metadata.models';
|
||||
import {
|
||||
getRemoteDataPayload,
|
||||
getSucceededRemoteData
|
||||
} from '../../../../../../core/shared/operators';
|
||||
import { getRemoteDataPayload, getSucceededRemoteData } from '../../../../../../core/shared/operators';
|
||||
import { SubmissionObject } from '../../../../../../core/submission/models/submission-object.model';
|
||||
import { SubmissionObjectDataService } from '../../../../../../core/submission/submission-object-data.service';
|
||||
import { hasValue, isNotEmpty } from '../../../../../empty.util';
|
||||
import { FormFieldMetadataValueObject } from '../../../models/form-field-metadata-value.model';
|
||||
import {
|
||||
Reorderable,
|
||||
ReorderableFormFieldMetadataValue,
|
||||
ReorderableRelationship
|
||||
} from '../../existing-metadata-list-element/existing-metadata-list-element.component';
|
||||
import { Reorderable, ReorderableFormFieldMetadataValue, ReorderableRelationship } from '../../existing-metadata-list-element/existing-metadata-list-element.component';
|
||||
import { DynamicConcatModel } from '../ds-dynamic-concat.model';
|
||||
import { DynamicRowArrayModel } from '../ds-dynamic-row-array-model';
|
||||
import { Store } from '@ngrx/store';
|
||||
@@ -181,13 +166,10 @@ export class DsDynamicFormArrayComponent extends DynamicFormArrayComponent imple
|
||||
this.reorderables = reorderables;
|
||||
|
||||
if (shouldPropagateChanges) {
|
||||
const movedReoRels: Array<Reorderable> = [];
|
||||
const movedReoRels: Reorderable[] = [];
|
||||
let hasMetadataField = false;
|
||||
this.reorderables.forEach((reorderable: Reorderable, index: number) => {
|
||||
if (reorderable.hasMoved) {
|
||||
const prevIndex = reorderable.oldIndex;
|
||||
const updatedReorderable = reorderable.update().pipe(take(1));
|
||||
updatedReorderables.push(updatedReorderable);
|
||||
if (reorderable instanceof ReorderableFormFieldMetadataValue) {
|
||||
const prevIndex = reorderable.oldIndex;
|
||||
hasMetadataField = true;
|
||||
|
@@ -15,7 +15,7 @@ describe('DsDynamicDisabledComponent', () => {
|
||||
let model;
|
||||
|
||||
function init() {
|
||||
model = new DynamicDisabledModel({ value: 'test', repeatable: false, metadataFields: [], submissionId: '1234', id: '1' });
|
||||
model = new DynamicDisabledModel({ value: 'test', repeatable: false, metadataFields: [], submissionId: '1234', id: '1', hasSelectableMetadata: false });
|
||||
}
|
||||
|
||||
beforeEach(async(() => {
|
||||
|
@@ -15,7 +15,7 @@ import { DynamicFormsNGBootstrapUIModule } from '@ng-dynamic-forms/ui-ng-bootstr
|
||||
import { AuthorityService } from '../../../../../../core/integration/authority.service';
|
||||
import { AuthorityServiceStub } from '../../../../../testing/authority-service-stub';
|
||||
import { DsDynamicLookupComponent } from './dynamic-lookup.component';
|
||||
import { DynamicLookupModel } from './dynamic-lookup.model';
|
||||
import { DynamicLookupModel, DynamicLookupModelConfig } from './dynamic-lookup.model';
|
||||
import { InfiniteScrollModule } from 'ngx-infinite-scroll';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { FormFieldMetadataValueObject } from '../../../models/form-field-metadata-value.model';
|
||||
@@ -30,7 +30,7 @@ import { MOCK_SUBMISSION_CONFIG } from '../../../../../testing/mock-submission-c
|
||||
import { WorkspaceitemsEditPageModule } from '../../../../../../+workspaceitems-edit-page/workspaceitems-edit-page.module';
|
||||
import { WorkspaceItem } from '../../../../../../core/submission/models/workspaceitem.model';
|
||||
|
||||
let LOOKUP_TEST_MODEL_CONFIG = {
|
||||
let LOOKUP_TEST_MODEL_CONFIG: DynamicLookupModelConfig = {
|
||||
authorityOptions: {
|
||||
closed: false,
|
||||
metadata: 'lookup',
|
||||
@@ -47,11 +47,11 @@ let LOOKUP_TEST_MODEL_CONFIG = {
|
||||
readOnly: false,
|
||||
required: true,
|
||||
repeatable: true,
|
||||
separator: ',',
|
||||
validators: { required: null },
|
||||
value: undefined,
|
||||
metadataFields: [],
|
||||
submissionId: '1234'
|
||||
submissionId: '1234',
|
||||
hasSelectableMetadata: false
|
||||
};
|
||||
|
||||
let LOOKUP_NAME_TEST_MODEL_CONFIG = {
|
||||
@@ -71,11 +71,11 @@ let LOOKUP_NAME_TEST_MODEL_CONFIG = {
|
||||
readOnly: false,
|
||||
required: true,
|
||||
repeatable: true,
|
||||
separator: ',',
|
||||
validators: { required: null },
|
||||
value: undefined,
|
||||
metadataFields: [],
|
||||
submissionId: '1234'
|
||||
submissionId: '1234',
|
||||
hasSelectableMetadata: false
|
||||
};
|
||||
|
||||
let LOOKUP_TEST_GROUP = new FormGroup({
|
||||
@@ -104,11 +104,11 @@ describe('Dynamic Lookup component', () => {
|
||||
readOnly: false,
|
||||
required: true,
|
||||
repeatable: true,
|
||||
separator: ',',
|
||||
validators: { required: null },
|
||||
value: undefined,
|
||||
metadataFields: [],
|
||||
submissionId: '1234'
|
||||
submissionId: '1234',
|
||||
hasSelectableMetadata: false
|
||||
};
|
||||
|
||||
LOOKUP_NAME_TEST_MODEL_CONFIG = {
|
||||
@@ -128,11 +128,11 @@ describe('Dynamic Lookup component', () => {
|
||||
readOnly: false,
|
||||
required: true,
|
||||
repeatable: true,
|
||||
separator: ',',
|
||||
validators: { required: null },
|
||||
value: undefined,
|
||||
metadataFields: [],
|
||||
submissionId: '1234'
|
||||
submissionId: '1234',
|
||||
hasSelectableMetadata: false
|
||||
};
|
||||
|
||||
LOOKUP_TEST_GROUP = new FormGroup({
|
||||
|
@@ -82,7 +82,8 @@ function init() {
|
||||
submissionScope: undefined,
|
||||
validators: { required: null },
|
||||
repeatable: false,
|
||||
metadataFields: []
|
||||
metadataFields: [],
|
||||
hasSelectableMetadata: false
|
||||
} as DynamicRelationGroupModelConfig;
|
||||
|
||||
FORM_GROUP_TEST_GROUP = new FormGroup({
|
||||
|
@@ -40,7 +40,8 @@ export const SD_TEST_MODEL_CONFIG = {
|
||||
repeatable: false,
|
||||
value: undefined,
|
||||
metadataFields: [],
|
||||
submissionId: '1234'
|
||||
submissionId: '1234',
|
||||
hasSelectableMetadata: false
|
||||
};
|
||||
|
||||
describe('Dynamic Dynamic Scrollable Dropdown component', () => {
|
||||
|
@@ -63,7 +63,7 @@ describe('DsDynamicLookupRelationModalComponent', () => {
|
||||
listID = '6b0c8221-fcb4-47a8-b483-ca32363fffb3';
|
||||
selection$ = observableOf([searchResult1, searchResult2]);
|
||||
selectableListService = { getSelectableList: () => selection$ };
|
||||
relationship = { filter: 'filter', relationshipType: 'isAuthorOfPublication', nameVariants: true } as RelationshipOptions;
|
||||
relationship = Object.assign(new RelationshipOptions(), { filter: 'filter', relationshipType: 'isAuthorOfPublication', nameVariants: true, searchConfiguration: 'personConfig' });
|
||||
nameVariant = 'Doe, J.';
|
||||
metadataField = 'dc.contributor.author';
|
||||
pSearchOptions = new PaginatedSearchOptions({});
|
||||
|
@@ -39,7 +39,7 @@ describe('DsDynamicLookupRelationSearchTabComponent', () => {
|
||||
let lookupRelationService;
|
||||
|
||||
function init() {
|
||||
relationship = { filter: 'filter', relationshipType: 'isAuthorOfPublication', nameVariants: true } as RelationshipOptions;
|
||||
relationship = Object.assign(new RelationshipOptions(), { filter: 'filter', relationshipType: 'isAuthorOfPublication', nameVariants: true, searchConfiguration: 'personConfig' });
|
||||
pSearchOptions = new PaginatedSearchOptions({});
|
||||
item1 = Object.assign(new Item(), { uuid: 'e1c51c69-896d-42dc-8221-1d5f2ad5516e' });
|
||||
item2 = Object.assign(new Item(), { uuid: 'c8279647-1acc-41ae-b036-951d5f65649b' });
|
||||
|
@@ -195,11 +195,11 @@ describe('FormBuilderService test suite', () => {
|
||||
|
||||
new DynamicColorPickerModel({ id: 'testColorPicker' }),
|
||||
|
||||
new DynamicTypeaheadModel({ id: 'testTypeahead', repeatable: false, metadataFields: [], submissionId: '1234' }),
|
||||
new DynamicTypeaheadModel({ id: 'testTypeahead', repeatable: false, metadataFields: [], submissionId: '1234', hasSelectableMetadata: false }),
|
||||
|
||||
new DynamicScrollableDropdownModel({ id: 'testScrollableDropdown', authorityOptions: authorityOptions, repeatable: false, metadataFields: [], submissionId: '1234' }),
|
||||
new DynamicScrollableDropdownModel({ id: 'testScrollableDropdown', authorityOptions: authorityOptions, repeatable: false, metadataFields: [], submissionId: '1234', hasSelectableMetadata: false }),
|
||||
|
||||
new DynamicTagModel({ id: 'testTag', repeatable: false, metadataFields: [], submissionId: '1234' }),
|
||||
new DynamicTagModel({ id: 'testTag', repeatable: false, metadataFields: [], submissionId: '1234', hasSelectableMetadata: false }),
|
||||
|
||||
new DynamicListCheckboxGroupModel({ id: 'testCheckboxList', authorityOptions: authorityOptions, repeatable: true }),
|
||||
|
||||
@@ -221,7 +221,7 @@ describe('FormBuilderService test suite', () => {
|
||||
authority: 'RPAuthority',
|
||||
closed: false,
|
||||
metadata: 'dc.contributor.author'
|
||||
}],
|
||||
}]
|
||||
} as FormFieldModel]
|
||||
} as FormRowModel, {
|
||||
fields: [{
|
||||
@@ -244,14 +244,15 @@ describe('FormBuilderService test suite', () => {
|
||||
scopeUUID: '',
|
||||
submissionScope: '',
|
||||
repeatable: false,
|
||||
metadataFields: []
|
||||
metadataFields: [],
|
||||
hasSelectableMetadata: true
|
||||
}),
|
||||
|
||||
new DynamicDsDatePickerModel({ id: 'testDate' }),
|
||||
|
||||
new DynamicLookupModel({ id: 'testLookup', repeatable: false, metadataFields: [], submissionId: '1234' }),
|
||||
new DynamicLookupModel({ id: 'testLookup', repeatable: false, metadataFields: [], submissionId: '1234', hasSelectableMetadata: true }),
|
||||
|
||||
new DynamicLookupNameModel({ id: 'testLookupName', repeatable: false, metadataFields: [], submissionId: '1234' }),
|
||||
new DynamicLookupNameModel({ id: 'testLookupName', repeatable: false, metadataFields: [], submissionId: '1234', hasSelectableMetadata: true }),
|
||||
|
||||
new DynamicQualdropModel({ id: 'testCombobox', readOnly: false, required: false }),
|
||||
|
||||
@@ -269,7 +270,8 @@ describe('FormBuilderService test suite', () => {
|
||||
},
|
||||
required: false,
|
||||
metadataKey: 'dc.contributor.author',
|
||||
metadataFields: ['dc.contributor.author']
|
||||
metadataFields: ['dc.contributor.author'],
|
||||
hasSelectableMetadata: true
|
||||
},
|
||||
),
|
||||
];
|
||||
|
@@ -60,7 +60,7 @@ export class SubmissionEditComponent implements OnDestroy, OnInit {
|
||||
* @type {Array}
|
||||
*/
|
||||
private subs: Subscription[] = [];
|
||||
private item: Item;
|
||||
public item: Item;
|
||||
|
||||
/**
|
||||
* Initialize instance variables
|
||||
|
@@ -39,6 +39,7 @@ import {
|
||||
mockSubmissionSelfUrl,
|
||||
mockSubmissionState
|
||||
} from '../../shared/mocks/mock-submission';
|
||||
import { Item } from '../../core/shared/item.model';
|
||||
|
||||
describe('submissionReducer test suite', () => {
|
||||
|
||||
@@ -67,7 +68,7 @@ describe('submissionReducer test suite', () => {
|
||||
}
|
||||
};
|
||||
|
||||
const action = new InitSubmissionFormAction(collectionId, submissionId, selfUrl, submissionDefinition, {}, []);
|
||||
const action = new InitSubmissionFormAction(collectionId, submissionId, selfUrl, submissionDefinition, {}, new Item(), []);
|
||||
const newState = submissionObjectReducer({}, action);
|
||||
|
||||
expect(newState).toEqual(expectedState);
|
||||
@@ -100,7 +101,7 @@ describe('submissionReducer test suite', () => {
|
||||
}
|
||||
};
|
||||
|
||||
const action = new ResetSubmissionFormAction(collectionId, submissionId, selfUrl, {}, submissionDefinition);
|
||||
const action = new ResetSubmissionFormAction(collectionId, submissionId, selfUrl, {}, submissionDefinition, new Item());
|
||||
const newState = submissionObjectReducer(initState, action);
|
||||
|
||||
expect(newState).toEqual(expectedState);
|
||||
@@ -241,7 +242,7 @@ describe('submissionReducer test suite', () => {
|
||||
isValid: false
|
||||
} as any;
|
||||
|
||||
let action: any = new InitSubmissionFormAction(collectionId, submissionId, selfUrl, submissionDefinition, {}, []);
|
||||
let action: any = new InitSubmissionFormAction(collectionId, submissionId, selfUrl, submissionDefinition, {}, new Item(), []);
|
||||
let newState = submissionObjectReducer({}, action);
|
||||
|
||||
action = new InitSectionAction(
|
||||
|
@@ -122,11 +122,11 @@ const testFormConfiguration = {
|
||||
const testFormModel = [
|
||||
new DynamicRowGroupModel({
|
||||
id: 'df-row-group-config-1',
|
||||
group: [new DsDynamicInputModel({ id: 'dc.title', metadataFields: [], repeatable: false, submissionId: '1234' })],
|
||||
group: [new DsDynamicInputModel({ id: 'dc.title', metadataFields: [], repeatable: false, submissionId: '1234', hasSelectableMetadata: false })],
|
||||
}),
|
||||
new DynamicRowGroupModel({
|
||||
id: 'df-row-group-config-2',
|
||||
group: [new DsDynamicInputModel({ id: 'dc.contributor', metadataFields: [], repeatable: false, submissionId: '1234' })],
|
||||
group: [new DsDynamicInputModel({ id: 'dc.contributor', metadataFields: [], repeatable: false, submissionId: '1234', hasSelectableMetadata: false })],
|
||||
})
|
||||
];
|
||||
|
||||
|
@@ -47,6 +47,7 @@ import { getMockSearchService } from '../shared/mocks/mock-search-service';
|
||||
import { getMockRequestService } from '../shared/mocks/mock-request.service';
|
||||
import { RequestService } from '../core/data/request.service';
|
||||
import { SearchService } from '../core/shared/search/search.service';
|
||||
import { Item } from '../core/shared/item.model';
|
||||
|
||||
describe('SubmissionService test suite', () => {
|
||||
const config = MOCK_SUBMISSION_CONFIG;
|
||||
@@ -441,6 +442,7 @@ describe('SubmissionService test suite', () => {
|
||||
selfUrl,
|
||||
submissionDefinition,
|
||||
{},
|
||||
new Item(),
|
||||
[]
|
||||
);
|
||||
const expected = new InitSubmissionFormAction(
|
||||
@@ -449,6 +451,7 @@ describe('SubmissionService test suite', () => {
|
||||
selfUrl,
|
||||
submissionDefinition,
|
||||
{},
|
||||
new Item(),
|
||||
[]);
|
||||
|
||||
expect((service as any).store.dispatch).toHaveBeenCalledWith(expected);
|
||||
@@ -844,14 +847,17 @@ describe('SubmissionService test suite', () => {
|
||||
submissionId,
|
||||
selfUrl,
|
||||
submissionDefinition,
|
||||
{}
|
||||
);
|
||||
{},
|
||||
new Item()
|
||||
)
|
||||
;
|
||||
const expected = new ResetSubmissionFormAction(
|
||||
collectionId,
|
||||
submissionId,
|
||||
selfUrl,
|
||||
{},
|
||||
submissionDefinition
|
||||
submissionDefinition,
|
||||
new Item()
|
||||
);
|
||||
|
||||
expect((service as any).store.dispatch).toHaveBeenCalledWith(expected);
|
||||
|
Reference in New Issue
Block a user