mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
UX improvements
This commit is contained in:
@@ -84,7 +84,7 @@ describe('ExistingMetadataListElementComponent', () => {
|
||||
|
||||
it('should dispatch a RemoveRelationshipAction', () => {
|
||||
component.removeSelection();
|
||||
const action = new RemoveRelationshipAction(submissionItem, relatedItem, relationshipOptions.relationshipType);
|
||||
const action = new RemoveRelationshipAction(submissionItem, relatedItem, relationshipOptions.relationshipType, '1234');
|
||||
expect(store.dispatch).toHaveBeenCalledWith(action);
|
||||
|
||||
});
|
||||
|
@@ -12,9 +12,10 @@
|
||||
<div *ngFor="let groupModel of model.groups; let idx = index" role="group"
|
||||
[formGroupName]="idx" [ngClass]="[getClass('element', 'group'), getClass('grid', 'group')]" cdkDrag>
|
||||
<ng-container *ngIf="idx > 0">
|
||||
<button type="button" class="close float-left drag-button" aria-label="Move button" cdkDragHandle>
|
||||
<i aria-hidden="true" class="fas fa-arrows-alt fa-xs"></i>
|
||||
<button type="button" class="close float-left drag-button" cdkDragHandle>
|
||||
<i class="fas fa-grip-vertical fa-fw"></i>
|
||||
</button>
|
||||
{{idx}}
|
||||
<ng-container *ngTemplateOutlet="startTemplate?.templateRef; context: groupModel"></ng-container>
|
||||
<ng-container *ngTemplateOutlet="controlContainer; context: {$implicit: idx}"></ng-container>
|
||||
<ng-container *ngTemplateOutlet="endTemplate?.templateRef; context: groupModel"></ng-container>
|
||||
|
@@ -82,7 +82,7 @@ export class DsDynamicFormArrayComponent extends DynamicFormArrayComponent imple
|
||||
)
|
||||
).subscribe((item) => this.submissionItem = item);
|
||||
|
||||
this.updateReorderables();
|
||||
// this.updateReorderables();
|
||||
}
|
||||
|
||||
private updateReorderables(): void {
|
||||
@@ -185,12 +185,12 @@ export class DsDynamicFormArrayComponent extends DynamicFormArrayComponent imple
|
||||
|
||||
onChange($event) {
|
||||
let event = $event;
|
||||
if (hasNoValue($event.context)) {
|
||||
const context = Object.assign({}, $event.context, { index: this.reorderables.length });
|
||||
event = Object.assign({}, $event, { context });
|
||||
} else {
|
||||
this.updateReorderables();
|
||||
}
|
||||
// if (hasNoValue($event.context)) {
|
||||
// const context = Object.assign({}, $event.context, { index: this.reorderables.length });
|
||||
// event = Object.assign({}, $event, { context });
|
||||
// } else {
|
||||
// this.updateReorderables();
|
||||
// }
|
||||
super.onChange(event);
|
||||
|
||||
}
|
||||
|
@@ -119,8 +119,8 @@ describe('DsDynamicLookupRelationModalComponent', () => {
|
||||
|
||||
it('should dispatch an RemoveRelationshipAction for each deselected object', () => {
|
||||
component.deselect(searchResult1, searchResult2);
|
||||
const action = new RemoveRelationshipAction(component.item, searchResult1.indexableObject, relationship.relationshipType);
|
||||
const action2 = new RemoveRelationshipAction(component.item, searchResult2.indexableObject, relationship.relationshipType);
|
||||
const action = new RemoveRelationshipAction(component.item, searchResult1.indexableObject, relationship.relationshipType, '1234');
|
||||
const action2 = new RemoveRelationshipAction(component.item, searchResult2.indexableObject, relationship.relationshipType, '1234');
|
||||
|
||||
expect((component as any).store.dispatch).toHaveBeenCalledWith(action);
|
||||
expect((component as any).store.dispatch).toHaveBeenCalledWith(action2);
|
||||
|
@@ -112,7 +112,7 @@ describe('RelationshipEffects', () => {
|
||||
describe('When it\'s the first time for this identifier', () => {
|
||||
let action;
|
||||
it('should set the current value debounceMap and the value of the initialActionMap to ADD_RELATIONSHIP', () => {
|
||||
action = new AddRelationshipAction(leftItem, rightItem, relationshipType.leftwardType);
|
||||
action = new AddRelationshipAction(leftItem, rightItem, relationshipType.leftwardType, '1234');
|
||||
actions = hot('--a-', { a: action });
|
||||
const expected = cold('--b-', { b: undefined });
|
||||
expect(relationEffects.mapLastActions$).toBeObservable(expected);
|
||||
@@ -131,7 +131,7 @@ describe('RelationshipEffects', () => {
|
||||
});
|
||||
|
||||
it('should set the current value debounceMap to ADD_RELATIONSHIP but not change the value of the initialActionMap', () => {
|
||||
action = new AddRelationshipAction(leftItem, rightItem, relationshipType.leftwardType);
|
||||
action = new AddRelationshipAction(leftItem, rightItem, relationshipType.leftwardType, '1234');
|
||||
actions = hot('--a-', { a: action });
|
||||
const expected = cold('--b-', { b: undefined });
|
||||
expect(relationEffects.mapLastActions$).toBeObservable(expected);
|
||||
@@ -150,7 +150,7 @@ describe('RelationshipEffects', () => {
|
||||
spyOn((relationEffects as any), 'addRelationship');
|
||||
});
|
||||
it('should call addRelationship on the effect', () => {
|
||||
action = new AddRelationshipAction(leftItem, rightItem, relationshipType.leftwardType);
|
||||
action = new AddRelationshipAction(leftItem, rightItem, relationshipType.leftwardType, '1234');
|
||||
actions = hot('--a-', { a: action });
|
||||
const expected = cold('--b-', { b: undefined });
|
||||
expect(relationEffects.mapLastActions$).toBeObservable(expected);
|
||||
@@ -168,8 +168,8 @@ describe('RelationshipEffects', () => {
|
||||
spyOn((relationEffects as any), 'removeRelationship');
|
||||
});
|
||||
it('should <b>not</b> call removeRelationship or addRelationship on the effect', () => {
|
||||
const actiona = new AddRelationshipAction(leftItem, rightItem, relationshipType.leftwardType);
|
||||
const actionb = new RemoveRelationshipAction(leftItem, rightItem, relationshipType.leftwardType);
|
||||
const actiona = new AddRelationshipAction(leftItem, rightItem, relationshipType.leftwardType, '1234');
|
||||
const actionb = new RemoveRelationshipAction(leftItem, rightItem, relationshipType.leftwardType, '1234');
|
||||
actions = hot('--ab-', { a: actiona, b: actionb });
|
||||
const expected = cold('--bb-', { b: undefined });
|
||||
expect(relationEffects.mapLastActions$).toBeObservable(expected);
|
||||
@@ -184,7 +184,7 @@ describe('RelationshipEffects', () => {
|
||||
describe('When it\'s the first time for this identifier', () => {
|
||||
let action;
|
||||
it('should set the current value debounceMap and the value of the initialActionMap to REMOVE_RELATIONSHIP', () => {
|
||||
action = new RemoveRelationshipAction(leftItem, rightItem, relationshipType.leftwardType);
|
||||
action = new RemoveRelationshipAction(leftItem, rightItem, relationshipType.leftwardType, '1234');
|
||||
actions = hot('--a-', { a: action });
|
||||
const expected = cold('--b-', { b: undefined });
|
||||
expect(relationEffects.mapLastActions$).toBeObservable(expected);
|
||||
@@ -203,7 +203,7 @@ describe('RelationshipEffects', () => {
|
||||
});
|
||||
|
||||
it('should set the current value debounceMap to REMOVE_RELATIONSHIP but not change the value of the initialActionMap', () => {
|
||||
action = new RemoveRelationshipAction(leftItem, rightItem, relationshipType.leftwardType);
|
||||
action = new RemoveRelationshipAction(leftItem, rightItem, relationshipType.leftwardType, '1234');
|
||||
actions = hot('--a-', { a: action });
|
||||
const expected = cold('--b-', { b: undefined });
|
||||
expect(relationEffects.mapLastActions$).toBeObservable(expected);
|
||||
@@ -223,7 +223,7 @@ describe('RelationshipEffects', () => {
|
||||
});
|
||||
|
||||
it('should call removeRelationship on the effect', () => {
|
||||
action = new RemoveRelationshipAction(leftItem, rightItem, relationshipType.leftwardType);
|
||||
action = new RemoveRelationshipAction(leftItem, rightItem, relationshipType.leftwardType, '1234');
|
||||
actions = hot('--a-', { a: action });
|
||||
const expected = cold('--b-', { b: undefined });
|
||||
expect(relationEffects.mapLastActions$).toBeObservable(expected);
|
||||
@@ -241,8 +241,8 @@ describe('RelationshipEffects', () => {
|
||||
spyOn((relationEffects as any), 'removeRelationship');
|
||||
});
|
||||
it('should <b>not</b> call addRelationship or removeRelationship on the effect', () => {
|
||||
const actionb = new RemoveRelationshipAction(leftItem, rightItem, relationshipType.leftwardType);
|
||||
const actiona = new AddRelationshipAction(leftItem, rightItem, relationshipType.leftwardType);
|
||||
const actionb = new RemoveRelationshipAction(leftItem, rightItem, relationshipType.leftwardType, '1234');
|
||||
const actiona = new AddRelationshipAction(leftItem, rightItem, relationshipType.leftwardType, '1234');
|
||||
actions = hot('--ab-', { a: actiona, b: actionb });
|
||||
const expected = cold('--bb-', { b: undefined });
|
||||
expect(relationEffects.mapLastActions$).toBeObservable(expected);
|
||||
|
@@ -86,6 +86,7 @@ export abstract class FieldParser {
|
||||
if (model.hasLanguages || isNotEmpty(model.relationship)) {
|
||||
setLayout(model, 'grid', 'control', 'col');
|
||||
}
|
||||
console.log(model);
|
||||
return [model];
|
||||
}
|
||||
} as DynamicRowArrayModelConfig;
|
||||
|
@@ -11,8 +11,10 @@
|
||||
(dfChange)="onChange($event)"
|
||||
(dfFocus)="onFocus($event)">
|
||||
<ng-template modelType="ARRAY" let-group let-index="index" let-context="context">
|
||||
{{group.index}}-{{index}}
|
||||
|
||||
<!--Array with repeatable items-->
|
||||
<div *ngIf="!context.notRepeatable && (!context.relationshipConfig || (context.relationshipConfig && index < 1))"
|
||||
<div *ngIf="!context.notRepeatable && index < 1"
|
||||
class="col-xs-2 d-flex flex-column justify-content-sm-start align-items-end">
|
||||
<div class="btn-group" role="group" aria-label="Add and remove button">
|
||||
<button type="button" class="btn btn-secondary"
|
||||
@@ -29,7 +31,7 @@
|
||||
</div>
|
||||
|
||||
<!--Array with non repeatable items - Only delete button-->
|
||||
<div *ngIf="context.notRepeatable && group.context.groups.length > 1 || (context.relationshipConfig && index > 0 && !group.group[0]?.value?.isVirtual)"
|
||||
<div *ngIf="context.notRepeatable && group.context.groups.length > 1 || index > 0 && !group.group[0]?.value?.isVirtual"
|
||||
class="col-xs-2 d-flex flex-column justify-content-sm-start align-items-end">
|
||||
<div class="btn-group" role="group" aria-label="Remove button">
|
||||
<button type="button" class="btn btn-secondary"
|
||||
|
@@ -301,7 +301,8 @@ export class FormComponent implements OnDestroy, OnInit {
|
||||
|
||||
insertItem($event, arrayContext: DynamicFormArrayModel, index: number): void {
|
||||
const formArrayControl = this.formGroup.get(this.formBuilderService.getPath(arrayContext)) as FormArray;
|
||||
this.formBuilderService.insertFormArrayGroup(index, formArrayControl, arrayContext);
|
||||
this.formBuilderService.addFormArrayGroup(formArrayControl, arrayContext);
|
||||
this.formBuilderService.moveFormArrayGroup(0, formArrayControl.length - 1, formArrayControl, arrayContext);
|
||||
this.addArrayItem.emit(this.getEvent($event, arrayContext, index, 'add'));
|
||||
this.formService.changeForm(this.formId, this.formModel);
|
||||
}
|
||||
|
Reference in New Issue
Block a user