From 079d6904fb6134e1d13962ecf213182214d439cb Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 4 Jan 2021 15:57:24 +0100 Subject: [PATCH] Fix array sorting in UI. --- .../content/shared/forms/array-editor.component.html | 5 +++-- .../content/shared/forms/array-editor.component.ts | 2 +- .../content/shared/forms/array-item.component.html | 2 +- .../content/shared/forms/array-item.component.ts | 12 ++++++------ 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/frontend/app/features/content/shared/forms/array-editor.component.html b/frontend/app/features/content/shared/forms/array-editor.component.html index 2071c4114..83adc55cd 100644 --- a/frontend/app/features/content/shared/forms/array-editor.component.html +++ b/frontend/app/features/content/shared/forms/array-editor.component.html @@ -9,7 +9,6 @@ cdkDrag cdkDragLockAxis="y"> + (clone)="addItem(itemForm)" + (itemRemove)="removeItem(i)" + (itemMove)="move(itemForm, $event)" > diff --git a/frontend/app/features/content/shared/forms/array-editor.component.ts b/frontend/app/features/content/shared/forms/array-editor.component.ts index 149dd901b..b5d1befa7 100644 --- a/frontend/app/features/content/shared/forms/array-editor.component.ts +++ b/frontend/app/features/content/shared/forms/array-editor.component.ts @@ -83,7 +83,7 @@ export class ArrayEditorComponent implements OnChanges { this.reset(); } - public move(index: number, item: FieldArrayItemForm) { + public move(item: FieldArrayItemForm, index: number) { this.formModel.move(index, item); this.reset(); diff --git a/frontend/app/features/content/shared/forms/array-item.component.html b/frontend/app/features/content/shared/forms/array-item.component.html index 218987d44..d0a3c849f 100644 --- a/frontend/app/features/content/shared/forms/array-item.component.html +++ b/frontend/app/features/content/shared/forms/array-item.component.html @@ -35,7 +35,7 @@ - diff --git a/frontend/app/features/content/shared/forms/array-item.component.ts b/frontend/app/features/content/shared/forms/array-item.component.ts index d4fdaf8d8..79662a334 100644 --- a/frontend/app/features/content/shared/forms/array-item.component.ts +++ b/frontend/app/features/content/shared/forms/array-item.component.ts @@ -25,10 +25,10 @@ interface State { }) export class ArrayItemComponent extends StatefulComponent implements OnChanges { @Output() - public remove = new EventEmitter(); + public itemRemove = new EventEmitter(); @Output() - public move = new EventEmitter(); + public itemMove = new EventEmitter(); @Output() public clone = new EventEmitter(); @@ -113,19 +113,19 @@ export class ArrayItemComponent extends StatefulComponent implements OnCh } public moveTop() { - this.move.emit(0); + this.itemMove.emit(0); } public moveUp() { - this.move.emit(this.index - 1); + this.itemMove.emit(this.index - 1); } public moveDown() { - this.move.emit(this.index + 1); + this.itemMove.emit(this.index + 1); } public moveBottom() { - this.move.emit(99999); + this.itemMove.emit(99999); } public reset() {