From eb42ebb7e35afd893246b014a070163da40afff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Sat, 20 Apr 2024 08:03:25 +0200 Subject: [PATCH] Delete ItemProperties of Item --- .../item-property-editor.component.html | 10 +++++----- .../item-property-editor.component.ts | 7 ++++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/app/editor/inventory-item-editor/item-property-editor/item-property-editor.component.html b/src/app/editor/inventory-item-editor/item-property-editor/item-property-editor.component.html index 5fe9335..a528c05 100644 --- a/src/app/editor/inventory-item-editor/item-property-editor/item-property-editor.component.html +++ b/src/app/editor/inventory-item-editor/item-property-editor/item-property-editor.component.html @@ -18,7 +18,7 @@ - Characteristic + Value

{{itemProperty.property}}

@@ -30,14 +30,14 @@ -
+ --> - - + + - --> + diff --git a/src/app/editor/inventory-item-editor/item-property-editor/item-property-editor.component.ts b/src/app/editor/inventory-item-editor/item-property-editor/item-property-editor.component.ts index eb88c61..987fefa 100644 --- a/src/app/editor/inventory-item-editor/item-property-editor/item-property-editor.component.ts +++ b/src/app/editor/inventory-item-editor/item-property-editor/item-property-editor.component.ts @@ -22,7 +22,7 @@ export class ItemPropertyEditorComponent implements OnInit{ editedItemProperty: ItemProperty | undefined expandedElement: ItemProperty | undefined - displayedColumns: string[] = ['name', 'property'] + displayedColumns: string[] = ['name', 'property', 'delete'] columnsToDisplayWithExpand = [...this.displayedColumns, 'expand']; datasource: MatTableDataSource = new MatTableDataSource(); @@ -30,4 +30,9 @@ export class ItemPropertyEditorComponent implements OnInit{ ngOnInit() { this.datasource.data = this.item!.itemProperties } + + deleteItemProperty(itemProperty: ItemProperty) { + this.item!.itemProperties = this.item!.itemProperties.filter(property => property.propertyName !== itemProperty.propertyName) + this.datasource.data = this.item!.itemProperties + } }