From 9e43b3901c2b5ed1a13965441c1805aa8b474f16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Fri, 16 Feb 2024 18:30:01 +0100 Subject: [PATCH 1/6] Filter ProductTransitions by Statelabel --- .../product-gamesystem-editor.component.html | 4 +- .../product-gamesystem-editor.component.scss | 3 + .../product-transition-editor.component.html | 86 +++++++++++-------- .../product-transition-editor.component.scss | 4 + .../product-transition-editor.component.ts | 31 +++++-- .../game-model/gamesystems/ProductState.ts | 11 +++ .../gamesystems/ProductTransition.ts | 3 + 7 files changed, 99 insertions(+), 43 deletions(-) diff --git a/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.html b/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.html index 038300d..b2d1a1f 100644 --- a/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.html +++ b/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.html @@ -1,2 +1,4 @@ - +
+ +
diff --git a/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.scss b/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.scss index e69de29..2739e15 100644 --- a/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.scss +++ b/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.scss @@ -0,0 +1,3 @@ +#productStateEditor { + margin-top: 20px; +} diff --git a/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.html b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.html index cbe907a..e2da5c2 100644 --- a/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.html +++ b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.html @@ -1,42 +1,54 @@ - - - - - + + + + Filter + + +
{{col.displayedName}} - {{getLeafStateByIndex(transition, i).stateLabel}} -
+ + + + - - - - - - + + + + + + - - - + + + - - + + -
{{col.displayedName}} + {{getLeafStateByIndex(transition, i).stateLabel}} + - Starting State - - Ending State - + Starting State + + Ending State +
+ + No data matching the filter "{{input.value}}" + + + + + diff --git a/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.scss b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.scss index e69de29..432fb10 100644 --- a/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.scss +++ b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.scss @@ -0,0 +1,4 @@ +.long-form { + width: 100%; +} + diff --git a/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts index c823260..f3edf0c 100644 --- a/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts +++ b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts @@ -5,7 +5,7 @@ import { MatCell, MatCellDef, MatColumnDef, MatHeaderCell, - MatHeaderCellDef, MatHeaderRow, MatHeaderRowDef, MatRow, MatRowDef, + MatHeaderCellDef, MatHeaderRow, MatHeaderRowDef, MatNoDataRow, MatRow, MatRowDef, MatTable, MatTableDataSource } from "@angular/material/table"; @@ -14,6 +14,10 @@ import {NgForOf, NgIf} from "@angular/common"; import {ProductTransition} from "../../../../game-model/gamesystems/ProductTransition"; import {ProductState} from "../../../../game-model/gamesystems/ProductState"; import {MatTooltip} from "@angular/material/tooltip"; +import {MatFormField} from "@angular/material/form-field"; +import {MatInput} from "@angular/material/input"; +import {Transition} from "../../../../game-model/gamesystems/Transition"; +import {MatCard, MatCardContent, MatCardTitle} from "@angular/material/card"; class DisplayedColumnName { displayedName: string @@ -41,7 +45,13 @@ class DisplayedColumnName { MatRow, MatHeaderRowDef, MatRowDef, - MatTooltip + MatTooltip, + MatFormField, + MatInput, + MatNoDataRow, + MatCard, + MatCardContent, + MatCardTitle ], templateUrl: './product-transition-editor.component.html', styleUrl: './product-transition-editor.component.scss' @@ -51,7 +61,7 @@ export class ProductTransitionEditorComponent implements OnInit{ @Input() gamesystem: ProductGamesystem | undefined @Output() onOpenGamesystem = new EventEmitter(); - dataSource = new MatTableDataSource(); + dataSource = new MatTableDataSource(); displayedColumns: DisplayedColumnName[] = []; columns: string[] = []; numberLeafSystems: number = -1; @@ -66,6 +76,14 @@ export class ProductTransitionEditorComponent implements OnInit{ this.columns = this.displayedColumns.map(column => column.internalName) this.dataSource.data = this.gamesystem.transitions; + this.dataSource.filterPredicate = (data: ProductTransition, filter: string) => { + const leaf_starting_states = LeafGamesystemCalculator.calcLeafStates(data.startingState); + const leaf_ending_states = LeafGamesystemCalculator.calcLeafStates(data.endingState); + + const combined_leaf_states = leaf_starting_states.concat(leaf_ending_states); + + return combined_leaf_states.some((state) => state.stateLabel.toLowerCase().includes(filter)) + } } } @@ -79,8 +97,6 @@ export class ProductTransitionEditorComponent implements OnInit{ index = leafIndex - this.numberLeafSystems; } - - const leafStates = LeafGamesystemCalculator.calcLeafStates(state); console.log(leafStates) return leafStates[index]; @@ -94,4 +110,9 @@ export class ProductTransitionEditorComponent implements OnInit{ this.onOpenGamesystem.emit(leafGamesystems[leafIndex - this.numberLeafSystems]) } } + + applyFilter(event: KeyboardEvent) { + const filterValue = (event.target as HTMLInputElement).value; + this.dataSource.filter = filterValue.trim().toLowerCase(); + } } diff --git a/src/app/game-model/gamesystems/ProductState.ts b/src/app/game-model/gamesystems/ProductState.ts index f499f35..4831c3d 100644 --- a/src/app/game-model/gamesystems/ProductState.ts +++ b/src/app/game-model/gamesystems/ProductState.ts @@ -38,5 +38,16 @@ export class ProductState extends State { return true; } + existsInnerStateByLowerCaseLabel(label: string): boolean { + this.innerStates.forEach(innerState => { + if(innerState instanceof SimpleState && innerState.stateLabel.toLowerCase() === label) { + return true; + } else if(innerState instanceof ProductState) { + return innerState.existsInnerStateByLowerCaseLabel(label); + } + }) + + return false; + } } diff --git a/src/app/game-model/gamesystems/ProductTransition.ts b/src/app/game-model/gamesystems/ProductTransition.ts index 3e862ea..ebd0be5 100644 --- a/src/app/game-model/gamesystems/ProductTransition.ts +++ b/src/app/game-model/gamesystems/ProductTransition.ts @@ -3,4 +3,7 @@ import {ProductState} from "./ProductState"; export class ProductTransition extends Transition { + containsInnerStateByLabel(label: string) { + return this.startingState.existsInnerStateByLowerCaseLabel(label) || this.endingState.existsInnerStateByLowerCaseLabel(label); + } } From e62f156eb267a5df9bddf55a66bdb4b23f68a4c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Fri, 16 Feb 2024 18:35:27 +0100 Subject: [PATCH 2/6] Make ProductGamesystemEditor, ProductState and ProductTransitionEditor not standalone --- src/app/app.module.ts | 14 +++++++-- .../product-gamesystem-editor.component.ts | 5 ---- .../product-state-editor.component.ts | 29 ------------------- .../product-transition-editor.component.ts | 22 -------------- 4 files changed, 11 insertions(+), 59 deletions(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 9a9cb35..2c095d0 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -54,6 +54,12 @@ import {MatOption, MatSelect} from "@angular/material/select"; import { ProductGamesystemEditorComponent } from "./editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component"; +import { + ProductTransitionEditorComponent +} from "./editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component"; +import { + ProductStateEditorComponent +} from "./editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component"; // AoT requires an exported function for factories const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new TranslateHttpLoader(http, './assets/i18n/', '.json'); @@ -70,7 +76,10 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl GamesystemEditorComponent, SimpleGamesystemEditorComponent, SimpleStateEditorComponent, - SimpleTransitionEditorComponent + SimpleTransitionEditorComponent, + ProductTransitionEditorComponent, + ProductStateEditorComponent, + ProductGamesystemEditorComponent ], imports: [ BrowserModule, @@ -124,8 +133,7 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl MatCheckbox, MatSelect, MatOption, - MatHint, - ProductGamesystemEditorComponent + MatHint ], providers: [], bootstrap: [AppComponent] diff --git a/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.ts b/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.ts index 1a90798..eebcefd 100644 --- a/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.ts +++ b/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.ts @@ -10,11 +10,6 @@ import { @Component({ selector: 'app-product-gamesystem-editor', - standalone: true, - imports: [ - ProductStateEditorComponent, - ProductTransitionEditorComponent - ], templateUrl: './product-gamesystem-editor.component.html', styleUrl: './product-gamesystem-editor.component.scss' }) diff --git a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.ts b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.ts index 8e4b02b..8f8ad77 100644 --- a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.ts +++ b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.ts @@ -2,43 +2,14 @@ import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; import {ProductGamesystem} from "../../../../game-model/gamesystems/ProductGamesystem"; import {SimpleGamesystem} from "../../../../game-model/gamesystems/SimpleGamesystem"; import { - MatCell, MatCellDef, - MatColumnDef, MatHeaderCell, MatHeaderCellDef, - MatHeaderRow, - MatHeaderRowDef, - MatRow, - MatRowDef, - MatTable, MatTableDataSource } from "@angular/material/table"; import {SimpleState} from "../../../../game-model/gamesystems/SimpleState"; import {State} from "../../../../game-model/gamesystems/State"; -import {NgForOf, NgIf} from "@angular/common"; -import {ProductState} from "../../../../game-model/gamesystems/ProductState"; -import {MatIcon} from "@angular/material/icon"; -import {Gamesystem} from "../../../../game-model/gamesystems/Gamesystem"; import {LeafGamesystemCalculator} from "../../product-gamesystem-editor/LeafGamesystemCalculator"; -import {MatTooltip} from "@angular/material/tooltip"; @Component({ selector: 'app-product-state-editor', - standalone: true, - imports: [ - MatTable, - MatRow, - MatRowDef, - MatHeaderRow, - MatHeaderRowDef, - MatColumnDef, - MatHeaderCell, - MatHeaderCellDef, - MatCell, - MatCellDef, - NgForOf, - NgIf, - MatIcon, - MatTooltip - ], templateUrl: './product-state-editor.component.html', styleUrl: './product-state-editor.component.scss' }) diff --git a/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts index f3edf0c..79c485a 100644 --- a/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts +++ b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts @@ -31,28 +31,6 @@ class DisplayedColumnName { } @Component({ selector: 'app-product-transition-editor', - standalone: true, - imports: [ - MatTable, - NgForOf, - MatColumnDef, - MatHeaderCell, - MatHeaderCellDef, - MatCell, - MatCellDef, - NgIf, - MatHeaderRow, - MatRow, - MatHeaderRowDef, - MatRowDef, - MatTooltip, - MatFormField, - MatInput, - MatNoDataRow, - MatCard, - MatCardContent, - MatCardTitle - ], templateUrl: './product-transition-editor.component.html', styleUrl: './product-transition-editor.component.scss' }) From 153140a1bfea4faf2ac549b318450d7968a55b82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Fri, 16 Feb 2024 18:38:50 +0100 Subject: [PATCH 3/6] Import MatTooTip in app.module --- src/app/app.module.ts | 10 ++++++++-- .../product-transition-editor.component.ts | 12 ------------ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 2c095d0..0de963f 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -43,7 +43,7 @@ import { MatColumnDef, MatHeaderCell, MatHeaderCellDef, - MatHeaderRow, MatHeaderRowDef, MatRow, MatRowDef, + MatHeaderRow, MatHeaderRowDef, MatNoDataRow, MatRow, MatRowDef, MatTable } from "@angular/material/table"; import {MatCheckbox} from "@angular/material/checkbox"; @@ -60,6 +60,8 @@ import { import { ProductStateEditorComponent } from "./editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component"; +import {MatTooltip} from "@angular/material/tooltip"; +import {MatCard, MatCardContent} from "@angular/material/card"; // AoT requires an exported function for factories const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new TranslateHttpLoader(http, './assets/i18n/', '.json'); @@ -133,7 +135,11 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl MatCheckbox, MatSelect, MatOption, - MatHint + MatHint, + MatTooltip, + MatCardContent, + MatCard, + MatNoDataRow ], providers: [], bootstrap: [AppComponent] diff --git a/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts index 79c485a..8a22044 100644 --- a/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts +++ b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts @@ -2,23 +2,11 @@ import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; import {ProductGamesystem} from "../../../../game-model/gamesystems/ProductGamesystem"; import {SimpleGamesystem} from "../../../../game-model/gamesystems/SimpleGamesystem"; import { - MatCell, MatCellDef, - MatColumnDef, - MatHeaderCell, - MatHeaderCellDef, MatHeaderRow, MatHeaderRowDef, MatNoDataRow, MatRow, MatRowDef, - MatTable, MatTableDataSource } from "@angular/material/table"; import {LeafGamesystemCalculator} from "../../product-gamesystem-editor/LeafGamesystemCalculator"; -import {NgForOf, NgIf} from "@angular/common"; import {ProductTransition} from "../../../../game-model/gamesystems/ProductTransition"; import {ProductState} from "../../../../game-model/gamesystems/ProductState"; -import {MatTooltip} from "@angular/material/tooltip"; -import {MatFormField} from "@angular/material/form-field"; -import {MatInput} from "@angular/material/input"; -import {Transition} from "../../../../game-model/gamesystems/Transition"; -import {MatCard, MatCardContent, MatCardTitle} from "@angular/material/card"; - class DisplayedColumnName { displayedName: string internalName: string From 02d9fcbbbaaee6442bc418d988d199cf40a2a1cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Fri, 16 Feb 2024 19:34:11 +0100 Subject: [PATCH 4/6] Filter ProductState after StateLabel --- src/app/app.module.ts | 5 ++- .../product-state-editor.component.html | 34 ++++++++++++------- .../product-state-editor.component.scss | 4 +++ .../product-state-editor.component.ts | 13 ++++++- 4 files changed, 39 insertions(+), 17 deletions(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 0de963f..5009811 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -43,7 +43,7 @@ import { MatColumnDef, MatHeaderCell, MatHeaderCellDef, - MatHeaderRow, MatHeaderRowDef, MatNoDataRow, MatRow, MatRowDef, + MatHeaderRow, MatHeaderRowDef, MatRow, MatRowDef, MatTable } from "@angular/material/table"; import {MatCheckbox} from "@angular/material/checkbox"; @@ -137,9 +137,8 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl MatOption, MatHint, MatTooltip, - MatCardContent, MatCard, - MatNoDataRow + MatCardContent ], providers: [], bootstrap: [AppComponent] diff --git a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html index 2d7eda7..7ca4627 100644 --- a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html +++ b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html @@ -1,14 +1,22 @@ - - - - - + + + + Filter + + +
{{col}} - {{getLeafState(state, i).stateLabel}} - - {{state.initial? 'done':'close'}} - -
+ + + + - - -
{{col}} + {{getLeafState(state, i).stateLabel}} + + {{state.initial? 'done':'close'}} + +
+ + + + + diff --git a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.scss b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.scss index d53103d..f2c3344 100644 --- a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.scss +++ b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.scss @@ -5,3 +5,7 @@ table { .mat-column-Initial { width: 32px; } + +.long-form { + width: 100%; +} diff --git a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.ts b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.ts index 8f8ad77..79a5880 100644 --- a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.ts +++ b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.ts @@ -7,6 +7,8 @@ import { import {SimpleState} from "../../../../game-model/gamesystems/SimpleState"; import {State} from "../../../../game-model/gamesystems/State"; import {LeafGamesystemCalculator} from "../../product-gamesystem-editor/LeafGamesystemCalculator"; +import {ProductTransition} from "../../../../game-model/gamesystems/ProductTransition"; +import {ProductState} from "../../../../game-model/gamesystems/ProductState"; @Component({ selector: 'app-product-state-editor', @@ -18,7 +20,7 @@ export class ProductStateEditorComponent implements OnInit{ @Input() gamesystem: ProductGamesystem | undefined @Output('onOpenGamesystemEditor') openGamesystemEditorEmitter = new EventEmitter(); displayedColumns: string[] = []; - datasource = new MatTableDataSource(); + datasource = new MatTableDataSource(); ngOnInit() { @@ -26,6 +28,10 @@ export class ProductStateEditorComponent implements OnInit{ this.generateColumnNamesRecursively(this.gamesystem!, ""); this.displayedColumns.push('Initial'); this.datasource.data = this.gamesystem!.states; + this.datasource.filterPredicate = (data: ProductState, filter: string) => { + const leaf_states = LeafGamesystemCalculator.calcLeafStates(data); + return leaf_states.some((state) => state.stateLabel.toLowerCase().includes(filter)) + } } generateColumnNamesRecursively(gamesystem: ProductGamesystem, nestedColumnName: string) { @@ -50,4 +56,9 @@ export class ProductStateEditorComponent implements OnInit{ this.openGamesystemEditorEmitter.emit(clicked_gamesystem); } + applyFilter(event: KeyboardEvent) { + const filterValue = (event.target as HTMLInputElement).value; + this.datasource.filter = filterValue.trim().toLowerCase(); + } + } 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 5/6] 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(); + } } From bfe500426fe4d249378b5678c38bfcf21b82d43f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Fri, 16 Feb 2024 19:54:36 +0100 Subject: [PATCH 6/6] Filter SimpleStates by StateLabel --- .../simple-state-editor.component.html | 4 ++++ .../simple-state-editor.component.ts | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) 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