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