added typedoc

This commit is contained in:
lotte
2020-01-08 10:34:24 +01:00
parent 4dd66073fc
commit f9fa8f0347
3 changed files with 22 additions and 0 deletions

View File

@@ -390,6 +390,11 @@ export class RelationshipService extends DataService<Relationship> {
return update$
}
/**
* Method to update the the right or left place of a relationship
* The useLeftItem field in the reorderable relationship determines which place should be updated
* @param reoRel
*/
public updatePlace(reoRel: ReorderableRelationship): Observable<RemoteData<Relationship>> {
let updatedRelationship;
if (reoRel.useLeftItem) {

View File

@@ -343,6 +343,11 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
modalComp.item = this.item;
}
/**
* Method to move a relationship inside the list of relationships
* This will update the view and update the right or left place field of the relationships in the list
* @param event
*/
moveSelection(event: CdkDragDrop<Relationship>) {
this.zone.runOutsideAngular(() => {
moveItemInArray(this.reorderables, event.previousIndex, event.currentIndex);

View File

@@ -16,6 +16,9 @@ import { AppState } from '../../../../../app.reducer';
import { ItemSearchResult } from '../../../../object-collection/shared/item-search-result.model';
// tslint:disable:max-classes-per-file
/**
* Abstract class that defines objects that can be reordered
*/
export abstract class Reorderable {
constructor(public oldIndex?: number, public newIndex?: number) {
}
@@ -25,6 +28,9 @@ export abstract class Reorderable {
abstract getPlace(): number;
}
/**
* Represents a single relationship that can be reordered in a list of multiple relationships
*/
export class ReorderableRelationship extends Reorderable {
relationship: Relationship;
useLeftItem: boolean;
@@ -48,6 +54,9 @@ export class ReorderableRelationship extends Reorderable {
}
}
/**
* Represents a single existing relationship value as metadata in submission
*/
@Component({
selector: 'ds-existing-metadata-list-element',
templateUrl: './existing-metadata-list-element.component.html',
@@ -93,6 +102,9 @@ export class ExistingMetadataListElementComponent implements OnChanges, OnDestro
}));
}
/**
* Removes the selected relationship from the list
*/
removeSelection() {
this.selectableListService.deselectSingle(this.listId, Object.assign(new ItemSearchResult(), { indexableObject: this.relatedItem }));
this.store.dispatch(new RemoveRelationshipAction(this.submissionItem, this.relatedItem, this.relationshipOptions.relationshipType))