Introduce state-initial-editor
All checks were successful
E2E Testing / test (push) Successful in 1m31s

This commit is contained in:
Sebastian Böckelmann 2024-04-19 20:47:00 +02:00
parent 2e6363e090
commit ce344fe303
4 changed files with 64 additions and 0 deletions

View File

@ -0,0 +1,8 @@
<div *ngIf="state != undefined">
<div *ngIf="editedState !== state">
<mat-icon *ngIf="initialValue">done</mat-icon>
<mat-icon *ngIf="!initialValue">close</mat-icon>
</div>
<mat-checkbox *ngIf="editedState === state" [(ngModel)]="initialValue"></mat-checkbox>
</div>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { StateInitialCellComponent } from './state-initial-cell.component';
describe('StateInitialCellComponent', () => {
let component: StateInitialCellComponent;
let fixture: ComponentFixture<StateInitialCellComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [StateInitialCellComponent]
})
.compileComponents();
fixture = TestBed.createComponent(StateInitialCellComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,33 @@
import {Component, Input} from '@angular/core';
import {SimpleState} from "../../../../../project/game-model/gamesystems/states/SimpleState";
import {NgIf} from "@angular/common";
import {TemplateElement} from "../../../../../project/game-model/templates/TemplateElement";
import {SimpleTemplateState} from "../../../../../project/game-model/templates/simpleGamesystem/SimpleTemplateState";
@Component({
selector: 'app-state-initial-cell',
templateUrl: './state-initial-cell.component.html',
styleUrl: './state-initial-cell.component.scss'
})
export class StateInitialCellComponent {
@Input() state: SimpleState | undefined
@Input() editedState: SimpleState | undefined | null
@Input() templateElement: TemplateElement | undefined
get initialValue(): boolean {
if(this.templateElement != undefined && this.state instanceof SimpleTemplateState && this.state.initialMap.has(this.templateElement!)) {
return this.state!.initialMap.get(this.templateElement!)!
} else {
return this.state!.initial;
}
}
set initialValue(value: boolean) {
if(this.templateElement != undefined && this.state instanceof SimpleTemplateState && this.state.initialMap.has(this.templateElement!)) {
this.state.initialMap.set(this.templateElement!, value)
} else {
this.state!.initial = value;
}
}
}