template-systems #41

Merged
sebastian merged 30 commits from template-systems into main 2024-04-19 21:10:01 +02:00
4 changed files with 76 additions and 70 deletions
Showing only changes of commit 2e6363e090 - Show all commits

View File

@ -79,6 +79,9 @@ import {
import {
TemplateSpecificatorComponent
} from "./editor/gamesystem-editor/template-specificator/template-specificator.component";
import {
StateInitialCellComponent
} from "./editor/gamesystem-editor/state-editor/simple-state-editor/state-initial-cell/state-initial-cell.component";
// AoT requires an exported function for factories
const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new TranslateHttpLoader(http, './assets/i18n/', '.json');
@ -103,71 +106,72 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl
ScriptaccountConditionEditorComponent,
CharacterOverviewComponent,
CharacterEditorComponent,
TemplateSpecificatorComponent
],
imports: [
BrowserModule,
FormsModule,
HttpClientModule,
CoreModule,
SharedModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: httpLoaderFactory,
deps: [HttpClient]
}
}),
BrowserAnimationsModule,
MatIcon,
MatToolbar,
MatButton,
MatFormField,
MatInput,
MatDrawerContainer,
MatDrawer,
MatIconButton,
MatMenuTrigger,
MatMenu,
MatMenuItem,
MatListItem,
MatActionList,
MatTabGroup,
MatTab,
MatTabLabel,
MatLabel,
MatFormField,
ReactiveFormsModule,
MatError,
MatDialogTitle,
MatDialogContent,
MatDialogActions,
MatMiniFabButton,
MatTreeModule,
MatTable,
MatColumnDef,
MatHeaderCell,
MatHeaderCellDef,
MatCellDef,
MatCell,
MatHeaderRow,
MatRow,
MatHeaderRowDef,
MatRowDef,
MatCheckbox,
MatSelect,
MatOption,
MatHint,
MatTooltip,
MatCard,
MatCardContent,
MatCardHeader,
MatAccordion,
MatExpansionPanel,
MatExpansionPanelTitle,
MatCardTitle,
MatExpansionPanelHeader
TemplateSpecificatorComponent,
StateInitialCellComponent
],
imports: [
BrowserModule,
FormsModule,
HttpClientModule,
CoreModule,
SharedModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: httpLoaderFactory,
deps: [HttpClient]
}
}),
BrowserAnimationsModule,
MatIcon,
MatToolbar,
MatButton,
MatFormField,
MatInput,
MatDrawerContainer,
MatDrawer,
MatIconButton,
MatMenuTrigger,
MatMenu,
MatMenuItem,
MatListItem,
MatActionList,
MatTabGroup,
MatTab,
MatTabLabel,
MatLabel,
MatFormField,
ReactiveFormsModule,
MatError,
MatDialogTitle,
MatDialogContent,
MatDialogActions,
MatMiniFabButton,
MatTreeModule,
MatTable,
MatColumnDef,
MatHeaderCell,
MatHeaderCellDef,
MatCellDef,
MatCell,
MatHeaderRow,
MatRow,
MatHeaderRowDef,
MatRowDef,
MatCheckbox,
MatSelect,
MatOption,
MatHint,
MatTooltip,
MatCard,
MatCardContent,
MatCardHeader,
MatAccordion,
MatExpansionPanel,
MatExpansionPanelTitle,
MatCardTitle,
MatExpansionPanelHeader
],
providers: [],
bootstrap: [AppComponent]
})

View File

@ -39,12 +39,7 @@
<ng-container matColumnDef="initial">
<th mat-header-cell *matHeaderCellDef>Initial</th>
<td mat-cell *matCellDef="let state">
<div *ngIf="editedElement !== state">
<mat-icon *ngIf="state.initial">done</mat-icon>
<mat-icon *ngIf="!state.initial">close</mat-icon>
</div>
<mat-checkbox *ngIf="editedElement === state" [(ngModel)]="state.initial" (ngModelChange)="onStateChange()"></mat-checkbox>
<app-state-initial-cell [templateElement]="templateElement" [editedState]="editedElement" [state]="state"></app-state-initial-cell>
</td>
</ng-container>

View File

@ -35,11 +35,14 @@ export class SimpleStateEditorComponent implements OnInit{
editedStateLabelError: boolean = false;
testState: SimpleState | undefined = undefined
constructor(private snackbar: MatSnackBar) {
}
ngOnInit() {
this.dataSource.data = this.states;
this.testState = this.states[0]
this.dataSource.filterPredicate = (data: SimpleState, filter: string) => {
return data.stateLabel.toLowerCase().includes(filter);
}
@ -127,4 +130,6 @@ export class SimpleStateEditorComponent implements OnInit{
return [];
}
}
}

View File

@ -5,10 +5,12 @@ import {ScriptAccountCondition} from "../../gamesystems/conditions/ScriptAccount
export class SimpleTemplateState extends SimpleState {
conditionMap: Map<TemplateElement, ScriptAccountCondition[]> = new Map();
initialMap: Map<TemplateElement, boolean> = new Map<TemplateElement, boolean>();
addTemplateElement(templateElement: TemplateElement) {
if(!this.conditionMap.has(templateElement)) {
this.conditionMap.set(templateElement, this.conditions)
this.initialMap.set(templateElement, this.initial);
}
}