Filter SimpleTransition by StateLabel
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				E2E Testing / test (push) Successful in 1m36s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	E2E Testing / test (push) Successful in 1m36s
				
			This commit is contained in:
		
							parent
							
								
									02d9fcbbba
								
							
						
					
					
						commit
						41452f0b9d
					
				| @ -1,2 +1,4 @@ | |||||||
| <app-simple-state-editor [states]="simpleGamesystem!.states" [gamesystem]="simpleGamesystem"></app-simple-state-editor> | <app-simple-state-editor [states]="simpleGamesystem!.states" [gamesystem]="simpleGamesystem"></app-simple-state-editor> | ||||||
| <app-simple-transition-editor class="transition-editor" [gamesystem]="simpleGamesystem"></app-simple-transition-editor> | <div id="transition-editor"> | ||||||
|  |   <app-simple-transition-editor [gamesystem]="simpleGamesystem"></app-simple-transition-editor> | ||||||
|  | </div> | ||||||
|  | |||||||
| @ -1,3 +1,4 @@ | |||||||
| .transition-editor { | #transition-editor { | ||||||
|   margin-top: 15px; |   margin-top: 20px !important; | ||||||
|  | 
 | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,4 +1,6 @@ | |||||||
| <table mat-table [dataSource]="dataSource" class="mat-elevation-z8" multiTemplateDataRows> | <mat-card> | ||||||
|  |   <mat-card-content> | ||||||
|  |     <table mat-table [dataSource]="dataSource" class="mat-elevation-z8" multiTemplateDataRows> | ||||||
|       <ng-container matColumnDef="name"> |       <ng-container matColumnDef="name"> | ||||||
|         <th mat-header-cell *matHeaderCellDef>Label</th> |         <th mat-header-cell *matHeaderCellDef>Label</th> | ||||||
|         <td mat-cell *matCellDef="let state"> |         <td mat-cell *matCellDef="let state"> | ||||||
| @ -74,4 +76,7 @@ | |||||||
|           (click)="expandedElement = expandedElement === element ? null : element"> |           (click)="expandedElement = expandedElement === element ? null : element"> | ||||||
|       </tr> |       </tr> | ||||||
|       <tr mat-row *matRowDef="let row; columns: ['expandedDetail']" class="example-detail-row"></tr> |       <tr mat-row *matRowDef="let row; columns: ['expandedDetail']" class="example-detail-row"></tr> | ||||||
| </table> |     </table> | ||||||
|  | 
 | ||||||
|  |   </mat-card-content> | ||||||
|  | </mat-card> | ||||||
|  | |||||||
| @ -1,4 +1,11 @@ | |||||||
| <table mat-table [dataSource]="dataSource" class="mat-elevation-z8" multiTemplateDataRows> | <mat-card> | ||||||
|  |   <mat-card-content> | ||||||
|  |     <mat-form-field class="long-form"> | ||||||
|  |       <mat-label>Filter</mat-label> | ||||||
|  |       <input matInput (keyup)="applyFilter($event)" placeholder="Filter" #input> | ||||||
|  |     </mat-form-field> | ||||||
|  | 
 | ||||||
|  |     <table mat-table [dataSource]="dataSource" class="mat-elevation-z8" multiTemplateDataRows> | ||||||
|       <ng-container matColumnDef="starting-state"> |       <ng-container matColumnDef="starting-state"> | ||||||
|         <th mat-header-cell *matHeaderCellDef>Starting State</th> |         <th mat-header-cell *matHeaderCellDef>Starting State</th> | ||||||
|         <td mat-cell *matCellDef="let transition"> |         <td mat-cell *matCellDef="let transition"> | ||||||
| @ -78,4 +85,7 @@ | |||||||
|           (click)="expandedElement = expandedElement === element ? null : element"> |           (click)="expandedElement = expandedElement === element ? null : element"> | ||||||
|       </tr> |       </tr> | ||||||
|       <tr mat-row *matRowDef="let row; columns: ['expandedDetail']" class="example-detail-row"></tr> |       <tr mat-row *matRowDef="let row; columns: ['expandedDetail']" class="example-detail-row"></tr> | ||||||
| </table> |     </table> | ||||||
|  | 
 | ||||||
|  |   </mat-card-content> | ||||||
|  | </mat-card> | ||||||
|  | |||||||
| @ -13,6 +13,8 @@ import { | |||||||
| import {SimpleTransition} from "../../../../game-model/gamesystems/SimpleTransition"; | import {SimpleTransition} from "../../../../game-model/gamesystems/SimpleTransition"; | ||||||
| import {animate, state, style, transition, trigger} from "@angular/animations"; | import {animate, state, style, transition, trigger} from "@angular/animations"; | ||||||
| import {SimpleState} from "../../../../game-model/gamesystems/SimpleState"; | import {SimpleState} from "../../../../game-model/gamesystems/SimpleState"; | ||||||
|  | import {ProductTransition} from "../../../../game-model/gamesystems/ProductTransition"; | ||||||
|  | import {LeafGamesystemCalculator} from "../../product-gamesystem-editor/LeafGamesystemCalculator"; | ||||||
| 
 | 
 | ||||||
| @Component({ | @Component({ | ||||||
|   selector: 'app-simple-transition-editor', |   selector: 'app-simple-transition-editor', | ||||||
| @ -44,6 +46,9 @@ export class SimpleTransitionEditorComponent implements OnInit { | |||||||
|   transitionEndingStateError = true; |   transitionEndingStateError = true; | ||||||
|   ngOnInit() { |   ngOnInit() { | ||||||
|     this.dataSource.data = this.gamesystem!.transitions; |     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() { |   addTransition() { | ||||||
| @ -83,4 +88,9 @@ export class SimpleTransitionEditorComponent implements OnInit { | |||||||
|       this.dataSource.data = this.gamesystem!.transitions; |       this.dataSource.data = this.gamesystem!.transitions; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  | 
 | ||||||
|  |   applyFilter(event: KeyboardEvent) { | ||||||
|  |     const filterValue = (event.target as HTMLInputElement).value; | ||||||
|  |     this.dataSource.filter = filterValue.trim().toLowerCase(); | ||||||
|  |   } | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user