mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 02:24:11 +00:00
autoselect + small fixes
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<div class="modal-body">
|
||||
{{'submission.sections.describe.relationship-lookup.name-variant.notification.content' | translate: { value: value } }}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<div class="modal-footer justify-content-between">
|
||||
<button type="button" class="btn btn-light" (click)="modal.close()">{{'submission.sections.describe.relationship-lookup.name-variant.notification.confirm' | translate }}</button>
|
||||
<button type="button" class="btn btn-light" (click)="modal.dismiss()">{{'submission.sections.describe.relationship-lookup.name-variant.notification.decline' | translate }}</button>
|
||||
</div>
|
@@ -96,7 +96,7 @@ export class PersonSearchResultListSubmissionElementComponent extends SearchResu
|
||||
}
|
||||
|
||||
openModal(value): Promise<any> {
|
||||
const modalRef = this.modalService.open(NameVariantModalComponent, { size: 'lg' });
|
||||
const modalRef = this.modalService.open(NameVariantModalComponent, { centered: true });
|
||||
const modalComp = modalRef.componentInstance;
|
||||
modalComp.value = value;
|
||||
return modalRef.result;
|
||||
|
@@ -276,7 +276,7 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
|
||||
|
||||
openLookup() {
|
||||
this.item$.subscribe((item: Item) => {
|
||||
this.modalRef = this.modalService.open(DsDynamicLookupRelationModalComponent, { size: 'lg' });
|
||||
this.modalRef = this.modalService.open(DsDynamicLookupRelationModalComponent, { size: 'lg', centered: true});
|
||||
const modalComp = this.modalRef.componentInstance;
|
||||
modalComp.repeatable = this.model.repeatable;
|
||||
modalComp.listId = this.listId;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { Component, ComponentFactoryResolver, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
|
||||
import { ListableObject } from './listable-object.model';
|
||||
import { SelectableListService } from '../../object-list/selectable-list/selectable-list.service';
|
||||
import { map, take } from 'rxjs/operators';
|
||||
import { ListableObject } from '../listable-object.model';
|
||||
import { SelectableListService } from '../../../object-list/selectable-list/selectable-list.service';
|
||||
import { map, skip, take } from 'rxjs/operators';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
@@ -32,6 +32,7 @@ export class SelectableListItemControlComponent implements OnInit {
|
||||
|
||||
|
||||
selected$: Observable<boolean>;
|
||||
|
||||
constructor(private selectionService: SelectableListService) {
|
||||
}
|
||||
|
||||
@@ -39,19 +40,22 @@ export class SelectableListItemControlComponent implements OnInit {
|
||||
* Setup the dynamic child component
|
||||
*/
|
||||
ngOnInit(): void {
|
||||
this.selected$ = this.selectionService?.isObjectSelected(this.selectionConfig.listId, this.object);
|
||||
this.selected$.subscribe((selected: ListableObject) => {
|
||||
|
||||
this.selected$ = this.selectionService.isObjectSelected(this.selectionConfig.listId, this.object);
|
||||
this.selected$
|
||||
.pipe(skip(1)).subscribe((selected: boolean) => {
|
||||
if (selected) {
|
||||
this.selectObject.emit(this.object);
|
||||
} else {
|
||||
this.deselectObject.emit(this.object);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
selectCheckbox(value: boolean, object: ListableObject) {
|
||||
if (value) {
|
||||
this.selectionService.selectSingle(this.selectionConfig.listId, object);
|
||||
this.selectObject.emit(object);
|
||||
} else {
|
||||
this.selectionService.deselectSingle(this.selectionConfig.listId, object);
|
||||
this.deselectObject.emit(object);
|
||||
}
|
||||
}
|
||||
|
@@ -85,9 +85,7 @@ export class SelectableListService {
|
||||
*/
|
||||
isObjectSelected(id: string, object: ListableObject): Observable<boolean> {
|
||||
return this.getSelectableList(id).pipe(
|
||||
filter((state: SelectableListState) => hasValue(state)),
|
||||
map((state: SelectableListState) => isNotEmpty(state.selection) && hasValue(state.selection.find((selected) => selected.equals(object)))),
|
||||
startWith(false),
|
||||
map((state: SelectableListState) => hasValue(state) && isNotEmpty(state.selection) && hasValue(state.selection.find((selected) => selected.equals(object)))),
|
||||
distinctUntilChanged()
|
||||
);
|
||||
}
|
||||
|
@@ -169,7 +169,7 @@ import { ListableObjectDirective } from './object-collection/shared/listable-obj
|
||||
import { SearchLabelComponent } from './search/search-labels/search-label/search-label.component';
|
||||
import { ItemMetadataRepresentationListElementComponent } from './object-list/metadata-representation-list-element/item/item-metadata-representation-list-element.component';
|
||||
import { MetadataRepresentationListComponent } from '../+item-page/simple/metadata-representation-list/metadata-representation-list.component';
|
||||
import { SelectableListItemControlComponent } from './object-collection/shared/selectable-list-item-control.component';
|
||||
import { SelectableListItemControlComponent } from './object-collection/shared/selectable-list-item-control/selectable-list-item-control.component';
|
||||
|
||||
const MODULES = [
|
||||
// Do NOT include UniversalModule, HttpModule, or JsonpModule here
|
||||
|
Reference in New Issue
Block a user