From 41452f0b9dba42932a59eabbb2a542241a108581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Fri, 16 Feb 2024 19:51:16 +0100 Subject: [PATCH] Filter SimpleTransition by StateLabel --- .../simple-gamesystem-editor.component.html | 4 +- .../simple-gamesystem-editor.component.scss | 5 +- .../simple-state-editor.component.html | 141 ++++++++-------- .../simple-transition-editor.component.html | 156 ++++++++++-------- .../simple-transition-editor.component.ts | 10 ++ 5 files changed, 172 insertions(+), 144 deletions(-) diff --git a/src/app/editor/gamesystem-editor/simple-gamesystem-editor/simple-gamesystem-editor.component.html b/src/app/editor/gamesystem-editor/simple-gamesystem-editor/simple-gamesystem-editor.component.html index 5ad3526..4b24edd 100644 --- a/src/app/editor/gamesystem-editor/simple-gamesystem-editor/simple-gamesystem-editor.component.html +++ b/src/app/editor/gamesystem-editor/simple-gamesystem-editor/simple-gamesystem-editor.component.html @@ -1,2 +1,4 @@ - +
+ +
diff --git a/src/app/editor/gamesystem-editor/simple-gamesystem-editor/simple-gamesystem-editor.component.scss b/src/app/editor/gamesystem-editor/simple-gamesystem-editor/simple-gamesystem-editor.component.scss index 7112fce..bfc528d 100644 --- a/src/app/editor/gamesystem-editor/simple-gamesystem-editor/simple-gamesystem-editor.component.scss +++ b/src/app/editor/gamesystem-editor/simple-gamesystem-editor/simple-gamesystem-editor.component.scss @@ -1,3 +1,4 @@ -.transition-editor { - margin-top: 15px; +#transition-editor { + margin-top: 20px !important; + } 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 f723e19..f198dc9 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,77 +1,82 @@ - - - - - + + +
Label - {{state.stateLabel}} - - - warningMissing State-Label Information - -
+ + + + - - - - + + + + - - - + - + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - -
Label + {{state.stateLabel}} + + + warningMissing State-Label Information + + -
-

{{element.stateDescription}}

- - Description - - -
-
+
+

{{element.stateDescription}}

+ + Description + + +
+
Initial -
- done - close -
- + +
Initial +
+ done + close +
+ -
- - - + + + - - + + - - - - + + + +
+ + + + + + + + diff --git a/src/app/editor/gamesystem-editor/transition-editor/simple-transition-editor/simple-transition-editor.component.html b/src/app/editor/gamesystem-editor/transition-editor/simple-transition-editor/simple-transition-editor.component.html index 1ad5505..0834eb0 100644 --- a/src/app/editor/gamesystem-editor/transition-editor/simple-transition-editor/simple-transition-editor.component.html +++ b/src/app/editor/gamesystem-editor/transition-editor/simple-transition-editor/simple-transition-editor.component.html @@ -1,81 +1,91 @@ - - - - + + + +
Starting State - {{transition.startingState.stateLabel}} - - - + + + Filter + + + + + + + - + + warning Starting and Ending State cannot be the same! + warning Select a valid Starting State! + + + - - - - + + + + - - - + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - -
Starting State + {{transition.startingState.stateLabel}} + + + {{state.stateLabel}} - - warning Starting and Ending State cannot be the same! - warning Select a valid Starting State! - - Ending State - {{transition.endingState.stateLabel}} - - - {{state.stateLabel}} - - warning Starting and Ending State cannot be the same! - warning Select a valid Ending State! - - Ending State + {{transition.endingState.stateLabel}} + + + {{state.stateLabel}} + + warning Starting and Ending State cannot be the same! + warning Select a valid Ending State! + + -
-

Expanded Detail

-
-
+
+

Expanded Detail

+
+
- - - + + + - - + + - - - - + + + +
+
+ + + diff --git a/src/app/editor/gamesystem-editor/transition-editor/simple-transition-editor/simple-transition-editor.component.ts b/src/app/editor/gamesystem-editor/transition-editor/simple-transition-editor/simple-transition-editor.component.ts index c1f64ee..b159e13 100644 --- a/src/app/editor/gamesystem-editor/transition-editor/simple-transition-editor/simple-transition-editor.component.ts +++ b/src/app/editor/gamesystem-editor/transition-editor/simple-transition-editor/simple-transition-editor.component.ts @@ -13,6 +13,8 @@ import { import {SimpleTransition} from "../../../../game-model/gamesystems/SimpleTransition"; import {animate, state, style, transition, trigger} from "@angular/animations"; import {SimpleState} from "../../../../game-model/gamesystems/SimpleState"; +import {ProductTransition} from "../../../../game-model/gamesystems/ProductTransition"; +import {LeafGamesystemCalculator} from "../../product-gamesystem-editor/LeafGamesystemCalculator"; @Component({ selector: 'app-simple-transition-editor', @@ -44,6 +46,9 @@ export class SimpleTransitionEditorComponent implements OnInit { transitionEndingStateError = true; ngOnInit() { this.dataSource.data = this.gamesystem!.transitions; + this.dataSource.filterPredicate = (data: SimpleTransition, filter: string) => { + return [data.startingState, data.endingState].some((state) => state.stateLabel.toLowerCase().includes(filter)) + } } addTransition() { @@ -83,4 +88,9 @@ export class SimpleTransitionEditorComponent implements OnInit { this.dataSource.data = this.gamesystem!.transitions; } } + + applyFilter(event: KeyboardEvent) { + const filterValue = (event.target as HTMLInputElement).value; + this.dataSource.filter = filterValue.trim().toLowerCase(); + } }