diff --git a/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/simple-state-editor.component.html b/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/simple-state-editor.component.html index f198dc9..1100328 100644 --- a/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/simple-state-editor.component.html +++ b/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/simple-state-editor.component.html @@ -1,5 +1,9 @@ + + Filter + + diff --git a/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/simple-state-editor.component.ts b/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/simple-state-editor.component.ts index 76c5bef..3d4d1ed 100644 --- a/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/simple-state-editor.component.ts +++ b/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/simple-state-editor.component.ts @@ -4,6 +4,8 @@ import {MatTableDataSource} from "@angular/material/table"; import {animate, state, style, transition, trigger} from "@angular/animations"; import {MatSnackBar} from "@angular/material/snack-bar"; import {SimpleGamesystem} from "../../../../game-model/gamesystems/SimpleGamesystem"; +import {ProductState} from "../../../../game-model/gamesystems/ProductState"; +import {LeafGamesystemCalculator} from "../../product-gamesystem-editor/LeafGamesystemCalculator"; @Component({ selector: 'app-simple-state-editor', @@ -21,7 +23,7 @@ export class SimpleStateEditorComponent implements OnInit{ @Input() states: SimpleState[] = []; @Input() gamesystem: SimpleGamesystem | undefined - dataSource = new MatTableDataSource(); + dataSource = new MatTableDataSource(); displayedColumns = ["name", "initial", "edit", "delete"]; columnsToDisplayWithExpand = [...this.displayedColumns, 'expand']; expandedElement: SimpleState | null = null; @@ -34,6 +36,9 @@ export class SimpleStateEditorComponent implements OnInit{ ngOnInit() { this.dataSource.data = this.states; + this.dataSource.filterPredicate = (data: SimpleState, filter: string) => { + return data.stateLabel.toLowerCase().includes(filter); + } } editState(state: SimpleState) { @@ -83,4 +88,9 @@ export class SimpleStateEditorComponent implements OnInit{ onStateChange() { this.gamesystem!.onModifyContent(); } + + applyFilter(event: KeyboardEvent) { + const filterValue = (event.target as HTMLInputElement).value; + this.dataSource.filter = filterValue.trim().toLowerCase(); + } }
Label