mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
67478: JSDocs intermediate commit
This commit is contained in:
@@ -4,6 +4,9 @@ import { ExternalSourceEntry } from '../../shared/external-source-entry.model';
|
|||||||
import { mapsTo } from '../builders/build-decorators';
|
import { mapsTo } from '../builders/build-decorators';
|
||||||
import { MetadataMap, MetadataMapSerializer } from '../../shared/metadata.models';
|
import { MetadataMap, MetadataMapSerializer } from '../../shared/metadata.models';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalized model class for an external source entry
|
||||||
|
*/
|
||||||
@mapsTo(ExternalSourceEntry)
|
@mapsTo(ExternalSourceEntry)
|
||||||
@inheritSerialization(NormalizedObject)
|
@inheritSerialization(NormalizedObject)
|
||||||
export class NormalizedExternalSourceEntry extends NormalizedObject<ExternalSourceEntry> {
|
export class NormalizedExternalSourceEntry extends NormalizedObject<ExternalSourceEntry> {
|
||||||
|
@@ -3,6 +3,9 @@ import { NormalizedObject } from './normalized-object.model';
|
|||||||
import { ExternalSource } from '../../shared/external-source.model';
|
import { ExternalSource } from '../../shared/external-source.model';
|
||||||
import { mapsTo } from '../builders/build-decorators';
|
import { mapsTo } from '../builders/build-decorators';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalized model class for an external source
|
||||||
|
*/
|
||||||
@mapsTo(ExternalSource)
|
@mapsTo(ExternalSource)
|
||||||
@inheritSerialization(NormalizedObject)
|
@inheritSerialization(NormalizedObject)
|
||||||
export class NormalizedExternalSource extends NormalizedObject<ExternalSource> {
|
export class NormalizedExternalSource extends NormalizedObject<ExternalSource> {
|
||||||
|
@@ -21,6 +21,9 @@ import { PaginatedList } from './paginated-list';
|
|||||||
import { ExternalSourceEntry } from '../shared/external-source-entry.model';
|
import { ExternalSourceEntry } from '../shared/external-source-entry.model';
|
||||||
import { DefaultChangeAnalyzer } from './default-change-analyzer.service';
|
import { DefaultChangeAnalyzer } from './default-change-analyzer.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A service handling all external source requests
|
||||||
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ExternalSourceService extends DataService<ExternalSource> {
|
export class ExternalSourceService extends DataService<ExternalSource> {
|
||||||
protected linkPath = 'externalsources';
|
protected linkPath = 'externalsources';
|
||||||
@@ -38,6 +41,11 @@ export class ExternalSourceService extends DataService<ExternalSource> {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the endpoint to browse external sources
|
||||||
|
* @param options
|
||||||
|
* @param linkPath
|
||||||
|
*/
|
||||||
getBrowseEndpoint(options: FindListOptions = {}, linkPath: string = this.linkPath): Observable<string> {
|
getBrowseEndpoint(options: FindListOptions = {}, linkPath: string = this.linkPath): Observable<string> {
|
||||||
return this.halService.getEndpoint(linkPath);
|
return this.halService.getEndpoint(linkPath);
|
||||||
}
|
}
|
||||||
|
@@ -288,24 +288,51 @@ export class RelationshipService extends DataService<Relationship> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a name variant for item with ID "itemID" part of list with ID "listID"
|
||||||
|
* @param listID ID of the list the item is a part of
|
||||||
|
* @param itemID ID of the item
|
||||||
|
* @param nameVariant A name variant for the item
|
||||||
|
*/
|
||||||
public setNameVariant(listID: string, itemID: string, nameVariant: string) {
|
public setNameVariant(listID: string, itemID: string, nameVariant: string) {
|
||||||
this.appStore.dispatch(new SetNameVariantAction(listID, itemID, nameVariant));
|
this.appStore.dispatch(new SetNameVariantAction(listID, itemID, nameVariant));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name variant for item with ID "itemID" part of list with ID "listID"
|
||||||
|
* @param listID ID of the list the item is a part of
|
||||||
|
* @param itemID ID of the item
|
||||||
|
*/
|
||||||
public getNameVariant(listID: string, itemID: string): Observable<string> {
|
public getNameVariant(listID: string, itemID: string): Observable<string> {
|
||||||
return this.appStore.pipe(
|
return this.appStore.pipe(
|
||||||
select(relationshipStateSelector(listID, itemID))
|
select(relationshipStateSelector(listID, itemID))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the name variant for item with ID "itemID" part of list with ID "listID"
|
||||||
|
* @param listID ID of the list the item is a part of
|
||||||
|
* @param itemID ID of the item
|
||||||
|
*/
|
||||||
public removeNameVariant(listID: string, itemID: string) {
|
public removeNameVariant(listID: string, itemID: string) {
|
||||||
this.appStore.dispatch(new RemoveNameVariantAction(listID, itemID));
|
this.appStore.dispatch(new RemoveNameVariantAction(listID, itemID));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name variants of all items part of list with ID "listID"
|
||||||
|
* @param listID ID of the list the items are a part of
|
||||||
|
*/
|
||||||
public getNameVariantsByListID(listID: string) {
|
public getNameVariantsByListID(listID: string) {
|
||||||
return this.appStore.pipe(select(relationshipListStateSelector(listID)));
|
return this.appStore.pipe(select(relationshipListStateSelector(listID)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the relationship between two items with a name variant for the item on the opposite side of the relationship-label
|
||||||
|
* @param item1 Related item
|
||||||
|
* @param item2 Other related item
|
||||||
|
* @param relationshipLabel The label describing the relationship between the two items
|
||||||
|
* @param nameVariant The name variant to give the item on the opposite side of the relationship-label
|
||||||
|
*/
|
||||||
public updateNameVariant(item1: Item, item2: Item, relationshipLabel: string, nameVariant: string): Observable<RemoteData<Relationship>> {
|
public updateNameVariant(item1: Item, item2: Item, relationshipLabel: string, nameVariant: string): Observable<RemoteData<Relationship>> {
|
||||||
return this.getRelationshipByItemsAndLabel(item1, item2, relationshipLabel)
|
return this.getRelationshipByItemsAndLabel(item1, item2, relationshipLabel)
|
||||||
.pipe(
|
.pipe(
|
||||||
|
@@ -187,14 +187,27 @@ export class RouteService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a parameter to the current route
|
||||||
|
* @param key The parameter name
|
||||||
|
* @param value The parameter value
|
||||||
|
*/
|
||||||
public addParameter(key, value) {
|
public addParameter(key, value) {
|
||||||
this.store.dispatch(new AddParameterAction(key, value));
|
this.store.dispatch(new AddParameterAction(key, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a parameter in the current route (overriding the previous value)
|
||||||
|
* @param key The parameter name
|
||||||
|
* @param value The parameter value
|
||||||
|
*/
|
||||||
public setParameter(key, value) {
|
public setParameter(key, value) {
|
||||||
this.store.dispatch(new SetParameterAction(key, value));
|
this.store.dispatch(new SetParameterAction(key, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current query and route parameters and add them
|
||||||
|
*/
|
||||||
public setCurrentRouteInfo() {
|
public setCurrentRouteInfo() {
|
||||||
combineLatest(this.getRouteParams(), this.route.queryParams)
|
combineLatest(this.getRouteParams(), this.route.queryParams)
|
||||||
.pipe(take(1))
|
.pipe(take(1))
|
||||||
|
@@ -1,6 +1,12 @@
|
|||||||
import { getExcludedFromEqualsFor, getFieldsForEquals } from './equals.decorators';
|
import { getExcludedFromEqualsFor, getFieldsForEquals } from './equals.decorators';
|
||||||
import { hasNoValue, hasValue } from '../../shared/empty.util';
|
import { hasNoValue, hasValue } from '../../shared/empty.util';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare two objects by comparing a given list of their properties
|
||||||
|
* @param object1 The first object
|
||||||
|
* @param object2 The second object
|
||||||
|
* @param fieldList A list of fields to compare the two objects by
|
||||||
|
*/
|
||||||
function equalsByFields(object1, object2, fieldList): boolean {
|
function equalsByFields(object1, object2, fieldList): boolean {
|
||||||
const unequalProperty = fieldList.find((key) => {
|
const unequalProperty = fieldList.find((key) => {
|
||||||
if (object1[key] === object2[key]) {
|
if (object1[key] === object2[key]) {
|
||||||
@@ -27,6 +33,9 @@ function equalsByFields(object1, object2, fieldList): boolean {
|
|||||||
return hasNoValue(unequalProperty);
|
return hasNoValue(unequalProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An object with a defined equals method
|
||||||
|
*/
|
||||||
export abstract class EquatableObject<T> {
|
export abstract class EquatableObject<T> {
|
||||||
equals(other: T): boolean {
|
equals(other: T): boolean {
|
||||||
if (hasNoValue(other)) {
|
if (hasNoValue(other)) {
|
||||||
|
@@ -13,6 +13,9 @@ import { MetadataValue } from '../../../../../core/shared/metadata.models';
|
|||||||
styleUrls: ['./external-source-entry-list-submission-element.component.scss'],
|
styleUrls: ['./external-source-entry-list-submission-element.component.scss'],
|
||||||
templateUrl: './external-source-entry-list-submission-element.component.html'
|
templateUrl: './external-source-entry-list-submission-element.component.html'
|
||||||
})
|
})
|
||||||
|
/**
|
||||||
|
* The component for displaying a list element of an external source entry
|
||||||
|
*/
|
||||||
export class ExternalSourceEntryListSubmissionElementComponent extends AbstractListableElementComponent<ExternalSourceEntry> implements OnInit {
|
export class ExternalSourceEntryListSubmissionElementComponent extends AbstractListableElementComponent<ExternalSourceEntry> implements OnInit {
|
||||||
/**
|
/**
|
||||||
* The metadata value for the object's uri
|
* The metadata value for the object's uri
|
||||||
|
@@ -6,7 +6,13 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
|||||||
templateUrl: './name-variant-modal.component.html',
|
templateUrl: './name-variant-modal.component.html',
|
||||||
styleUrls: ['./name-variant-modal.component.scss']
|
styleUrls: ['./name-variant-modal.component.scss']
|
||||||
})
|
})
|
||||||
|
/**
|
||||||
|
* The component for the modal to add a name variant to an item
|
||||||
|
*/
|
||||||
export class NameVariantModalComponent {
|
export class NameVariantModalComponent {
|
||||||
|
/**
|
||||||
|
* The name variant
|
||||||
|
*/
|
||||||
@Input() value: string;
|
@Input() value: string;
|
||||||
|
|
||||||
constructor(public modal: NgbActiveModal) {
|
constructor(public modal: NgbActiveModal) {
|
||||||
|
@@ -9,6 +9,9 @@ import { RelationshipTypeService } from '../../../../../../core/data/relationshi
|
|||||||
selector: 'ds-dynamic-disabled',
|
selector: 'ds-dynamic-disabled',
|
||||||
templateUrl: './dynamic-disabled.component.html'
|
templateUrl: './dynamic-disabled.component.html'
|
||||||
})
|
})
|
||||||
|
/**
|
||||||
|
* Component for displaying a form input with a disabled property
|
||||||
|
*/
|
||||||
export class DsDynamicDisabledComponent extends DynamicFormControlComponent {
|
export class DsDynamicDisabledComponent extends DynamicFormControlComponent {
|
||||||
|
|
||||||
@Input() formId: string;
|
@Input() formId: string;
|
||||||
|
@@ -41,16 +41,53 @@ import { ExternalSourceService } from '../../../../../core/data/external-source.
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
/**
|
||||||
|
* Modal component for looking up relations
|
||||||
|
*/
|
||||||
export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy {
|
export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy {
|
||||||
|
/**
|
||||||
|
* The label to use to display i18n messages (describing the type of relationship)
|
||||||
|
*/
|
||||||
label: string;
|
label: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Options for searching related items
|
||||||
|
*/
|
||||||
relationshipOptions: RelationshipOptions;
|
relationshipOptions: RelationshipOptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the list to add/remove selected items to/from
|
||||||
|
*/
|
||||||
listId: string;
|
listId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The item we're adding relationships to
|
||||||
|
*/
|
||||||
item;
|
item;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the selection repeatable?
|
||||||
|
*/
|
||||||
repeatable: boolean;
|
repeatable: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The list of selected items
|
||||||
|
*/
|
||||||
selection$: Observable<ListableObject[]>;
|
selection$: Observable<ListableObject[]>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The context to display lists
|
||||||
|
*/
|
||||||
context: Context;
|
context: Context;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The metadata-fields describing these relationships
|
||||||
|
*/
|
||||||
metadataFields: string;
|
metadataFields: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A map of subscriptions within this component
|
||||||
|
*/
|
||||||
subMap: {
|
subMap: {
|
||||||
[uuid: string]: Subscription
|
[uuid: string]: Subscription
|
||||||
} = {};
|
} = {};
|
||||||
@@ -104,6 +141,10 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy
|
|||||||
this.modal.close();
|
this.modal.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select (a list of) objects and add them to the store
|
||||||
|
* @param selectableObjects
|
||||||
|
*/
|
||||||
select(...selectableObjects: Array<SearchResult<Item>>) {
|
select(...selectableObjects: Array<SearchResult<Item>>) {
|
||||||
this.zone.runOutsideAngular(
|
this.zone.runOutsideAngular(
|
||||||
() => {
|
() => {
|
||||||
@@ -131,6 +172,10 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a subscription updating relationships with name variants
|
||||||
|
* @param sri The search result to track name variants for
|
||||||
|
*/
|
||||||
private addNameVariantSubscription(sri: SearchResult<Item>) {
|
private addNameVariantSubscription(sri: SearchResult<Item>) {
|
||||||
const nameVariant$ = this.relationshipService.getNameVariant(this.listId, sri.indexableObject.uuid);
|
const nameVariant$ = this.relationshipService.getNameVariant(this.listId, sri.indexableObject.uuid);
|
||||||
this.subMap[sri.indexableObject.uuid] = nameVariant$.pipe(
|
this.subMap[sri.indexableObject.uuid] = nameVariant$.pipe(
|
||||||
@@ -138,6 +183,10 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy
|
|||||||
).subscribe((nameVariant: string) => this.store.dispatch(new UpdateRelationshipAction(this.item, sri.indexableObject, this.relationshipOptions.relationshipType, nameVariant)))
|
).subscribe((nameVariant: string) => this.store.dispatch(new UpdateRelationshipAction(this.item, sri.indexableObject, this.relationshipOptions.relationshipType, nameVariant)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deselect (a list of) objects and remove them from the store
|
||||||
|
* @param selectableObjects
|
||||||
|
*/
|
||||||
deselect(...selectableObjects: Array<SearchResult<Item>>) {
|
deselect(...selectableObjects: Array<SearchResult<Item>>) {
|
||||||
this.zone.runOutsideAngular(
|
this.zone.runOutsideAngular(
|
||||||
() => selectableObjects.forEach((object) => {
|
() => selectableObjects.forEach((object) => {
|
||||||
@@ -147,6 +196,9 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set existing name variants for items by the item's virtual metadata
|
||||||
|
*/
|
||||||
private setExistingNameVariants() {
|
private setExistingNameVariants() {
|
||||||
const virtualMDs: MetadataValue[] = this.item.allMetadata(this.metadataFields).filter((mdValue) => mdValue.isVirtual);
|
const virtualMDs: MetadataValue[] = this.item.allMetadata(this.metadataFields).filter((mdValue) => mdValue.isVirtual);
|
||||||
|
|
||||||
|
@@ -30,15 +30,43 @@ import { PaginationComponentOptions } from '../../../../../pagination/pagination
|
|||||||
fadeInOut
|
fadeInOut
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
/**
|
||||||
|
* The tab displaying a list of importable entries for an external source
|
||||||
|
*/
|
||||||
export class DsDynamicLookupRelationExternalSourceTabComponent implements OnInit {
|
export class DsDynamicLookupRelationExternalSourceTabComponent implements OnInit {
|
||||||
|
/**
|
||||||
|
* The label to use to display i18n messages (describing the type of relationship)
|
||||||
|
*/
|
||||||
@Input() label: string;
|
@Input() label: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the list to add/remove selected items to/from
|
||||||
|
*/
|
||||||
@Input() listId: string;
|
@Input() listId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the selection repeatable?
|
||||||
|
*/
|
||||||
@Input() repeatable: boolean;
|
@Input() repeatable: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The context to display lists
|
||||||
|
*/
|
||||||
@Input() context: Context;
|
@Input() context: Context;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send an event to deselect an object from the list
|
||||||
|
*/
|
||||||
@Output() deselectObject: EventEmitter<ListableObject> = new EventEmitter<ListableObject>();
|
@Output() deselectObject: EventEmitter<ListableObject> = new EventEmitter<ListableObject>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send an event to select an object from the list
|
||||||
|
*/
|
||||||
@Output() selectObject: EventEmitter<ListableObject> = new EventEmitter<ListableObject>();
|
@Output() selectObject: EventEmitter<ListableObject> = new EventEmitter<ListableObject>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The initial pagination to start with
|
||||||
|
*/
|
||||||
initialPagination = Object.assign(new PaginationComponentOptions(), {
|
initialPagination = Object.assign(new PaginationComponentOptions(), {
|
||||||
id: 'submission-external-source-relation-list',
|
id: 'submission-external-source-relation-list',
|
||||||
pageSize: 5
|
pageSize: 5
|
||||||
|
@@ -33,25 +33,81 @@ import { LookupRelationService } from '../../../../../../core/data/lookup-relati
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
/**
|
||||||
|
* Tab for browsing local entities to add to the selection
|
||||||
|
*/
|
||||||
export class DsDynamicLookupRelationSearchTabComponent implements OnInit, OnDestroy {
|
export class DsDynamicLookupRelationSearchTabComponent implements OnInit, OnDestroy {
|
||||||
|
/**
|
||||||
|
* Options for searching related items
|
||||||
|
*/
|
||||||
@Input() relationship: RelationshipOptions;
|
@Input() relationship: RelationshipOptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the list to add/remove selected items to/from
|
||||||
|
*/
|
||||||
@Input() listId: string;
|
@Input() listId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the selection repeatable?
|
||||||
|
*/
|
||||||
@Input() repeatable: boolean;
|
@Input() repeatable: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The list of selected items
|
||||||
|
*/
|
||||||
@Input() selection$: Observable<ListableObject[]>;
|
@Input() selection$: Observable<ListableObject[]>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The context to display lists
|
||||||
|
*/
|
||||||
@Input() context: Context;
|
@Input() context: Context;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send an event to deselect an object from the list
|
||||||
|
*/
|
||||||
@Output() deselectObject: EventEmitter<ListableObject> = new EventEmitter<ListableObject>();
|
@Output() deselectObject: EventEmitter<ListableObject> = new EventEmitter<ListableObject>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send an event to select an object from the list
|
||||||
|
*/
|
||||||
@Output() selectObject: EventEmitter<ListableObject> = new EventEmitter<ListableObject>();
|
@Output() selectObject: EventEmitter<ListableObject> = new EventEmitter<ListableObject>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search results
|
||||||
|
*/
|
||||||
resultsRD$: Observable<RemoteData<PaginatedList<SearchResult<Item>>>>;
|
resultsRD$: Observable<RemoteData<PaginatedList<SearchResult<Item>>>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Are all results selected?
|
||||||
|
*/
|
||||||
allSelected: boolean;
|
allSelected: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Are some results selected?
|
||||||
|
*/
|
||||||
someSelected$: Observable<boolean>;
|
someSelected$: Observable<boolean>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is it currently loading to select all results?
|
||||||
|
*/
|
||||||
selectAllLoading: boolean;
|
selectAllLoading: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subscription to unsubscribe from
|
||||||
|
*/
|
||||||
subscription;
|
subscription;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The initial pagination to use
|
||||||
|
*/
|
||||||
initialPagination = Object.assign(new PaginationComponentOptions(), {
|
initialPagination = Object.assign(new PaginationComponentOptions(), {
|
||||||
id: 'submission-relation-list',
|
id: 'submission-relation-list',
|
||||||
pageSize: 5
|
pageSize: 5
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of links to display
|
||||||
|
*/
|
||||||
linkTypes = CollectionElementLinkType;
|
linkTypes = CollectionElementLinkType;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -76,12 +132,19 @@ export class DsDynamicLookupRelationSearchTabComponent implements OnInit, OnDest
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the route parameters
|
||||||
|
*/
|
||||||
resetRoute() {
|
resetRoute() {
|
||||||
this.router.navigate([], {
|
this.router.navigate([], {
|
||||||
queryParams: Object.assign({}, { pageSize: this.initialPagination.pageSize }, this.route.snapshot.queryParams, { page: 1 })
|
queryParams: Object.assign({}, { pageSize: this.initialPagination.pageSize }, this.route.snapshot.queryParams, { page: 1 })
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select all results within the page provided
|
||||||
|
* @param page
|
||||||
|
*/
|
||||||
selectPage(page: Array<SearchResult<Item>>) {
|
selectPage(page: Array<SearchResult<Item>>) {
|
||||||
this.selection$
|
this.selection$
|
||||||
.pipe(take(1))
|
.pipe(take(1))
|
||||||
@@ -92,6 +155,10 @@ export class DsDynamicLookupRelationSearchTabComponent implements OnInit, OnDest
|
|||||||
this.selectableListService.select(this.listId, page);
|
this.selectableListService.select(this.listId, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deselect all results within the page provided
|
||||||
|
* @param page
|
||||||
|
*/
|
||||||
deselectPage(page: Array<SearchResult<Item>>) {
|
deselectPage(page: Array<SearchResult<Item>>) {
|
||||||
this.allSelected = false;
|
this.allSelected = false;
|
||||||
this.selection$
|
this.selection$
|
||||||
@@ -103,6 +170,9 @@ export class DsDynamicLookupRelationSearchTabComponent implements OnInit, OnDest
|
|||||||
this.selectableListService.deselect(this.listId, page);
|
this.selectableListService.deselect(this.listId, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select all results
|
||||||
|
*/
|
||||||
selectAll() {
|
selectAll() {
|
||||||
this.allSelected = true;
|
this.allSelected = true;
|
||||||
this.selectAllLoading = true;
|
this.selectAllLoading = true;
|
||||||
@@ -128,6 +198,9 @@ export class DsDynamicLookupRelationSearchTabComponent implements OnInit, OnDest
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deselect all
|
||||||
|
*/
|
||||||
deselectAll() {
|
deselectAll() {
|
||||||
this.allSelected = false;
|
this.allSelected = false;
|
||||||
this.selection$
|
this.selection$
|
||||||
|
@@ -24,15 +24,48 @@ import { Context } from '../../../../../../core/shared/context.model';
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
/**
|
||||||
|
* Tab displaying the currently selected relations to add
|
||||||
|
*/
|
||||||
export class DsDynamicLookupRelationSelectionTabComponent {
|
export class DsDynamicLookupRelationSelectionTabComponent {
|
||||||
|
/**
|
||||||
|
* The label to use to display i18n messages (describing the type of relationship)
|
||||||
|
*/
|
||||||
@Input() label: string;
|
@Input() label: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the list to add/remove selected items to/from
|
||||||
|
*/
|
||||||
@Input() listId: string;
|
@Input() listId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the selection repeatable?
|
||||||
|
*/
|
||||||
@Input() repeatable: boolean;
|
@Input() repeatable: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The list of selected items
|
||||||
|
*/
|
||||||
@Input() selection$: Observable<ListableObject[]>;
|
@Input() selection$: Observable<ListableObject[]>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The paginated list of selected items
|
||||||
|
*/
|
||||||
@Input() selectionRD$: Observable<RemoteData<PaginatedList<ListableObject>>>;
|
@Input() selectionRD$: Observable<RemoteData<PaginatedList<ListableObject>>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The context to display lists
|
||||||
|
*/
|
||||||
@Input() context: Context;
|
@Input() context: Context;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send an event to deselect an object from the list
|
||||||
|
*/
|
||||||
@Output() deselectObject: EventEmitter<ListableObject> = new EventEmitter<ListableObject>();
|
@Output() deselectObject: EventEmitter<ListableObject> = new EventEmitter<ListableObject>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send an event to select an object from the list
|
||||||
|
*/
|
||||||
@Output() selectObject: EventEmitter<ListableObject> = new EventEmitter<ListableObject>();
|
@Output() selectObject: EventEmitter<ListableObject> = new EventEmitter<ListableObject>();
|
||||||
|
|
||||||
constructor(private router: Router,
|
constructor(private router: Router,
|
||||||
|
@@ -1,5 +1,8 @@
|
|||||||
const RELATION_METADATA_PREFIX = 'relation.'
|
const RELATION_METADATA_PREFIX = 'relation.'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extra options for displaying search results of relationships
|
||||||
|
*/
|
||||||
export class RelationshipOptions {
|
export class RelationshipOptions {
|
||||||
relationshipType: string;
|
relationshipType: string;
|
||||||
filter: string;
|
filter: string;
|
||||||
|
Reference in New Issue
Block a user