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 a528c05..ddae7b8 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 @@ -3,6 +3,10 @@ Name {{itemProperty.propertyName}} + + Name + + @@ -10,7 +14,11 @@
-

{{element.propertyDescription}}

+

{{element.propertyDescription}}

+ + Description + +
@@ -20,17 +28,22 @@ Value -

{{itemProperty.property}}

+

{{itemProperty.property}}

+ + Value + +
- + 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 987fefa..82eb657 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 @@ -3,6 +3,7 @@ import {Item} from "../../../project/game-model/inventory/Item"; import {MatTableDataSource} from "@angular/material/table"; import {ItemProperty} from "../../../project/game-model/inventory/ItemProperty"; import {animate, state, style, transition, trigger} from "@angular/animations"; +import {MatSnackBar} from "@angular/material/snack-bar"; @Component({ selector: 'app-item-property-editor', @@ -22,11 +23,14 @@ export class ItemPropertyEditorComponent implements OnInit{ editedItemProperty: ItemProperty | undefined expandedElement: ItemProperty | undefined - displayedColumns: string[] = ['name', 'property', 'delete'] + displayedColumns: string[] = ['name', 'property', 'edit', 'delete'] columnsToDisplayWithExpand = [...this.displayedColumns, 'expand']; datasource: MatTableDataSource = new MatTableDataSource(); + constructor(private snackbar: MatSnackBar) { + } + ngOnInit() { this.datasource.data = this.item!.itemProperties } @@ -35,4 +39,17 @@ export class ItemPropertyEditorComponent implements OnInit{ this.item!.itemProperties = this.item!.itemProperties.filter(property => property.propertyName !== itemProperty.propertyName) this.datasource.data = this.item!.itemProperties } + + editItemProperty(itemProperty: ItemProperty) { + this.editedItemProperty = itemProperty + } + + finishEditing() { + if(this.editedItemProperty!.propertyName.length < 1) { + this.snackbar.open("PropertyName cannout be empty", "", {duration: 2000}); + } else { + this.editedItemProperty = undefined + } + + } }