Tidy up editor, file tree, get list field working, allow creating new items

This commit is contained in:
2024-07-05 17:45:43 +09:30
parent 0f60377e91
commit a22b6943aa
11 changed files with 171 additions and 127 deletions

View File

@@ -1,6 +1,8 @@
<h2>{{ selectedMessage().name }}</h2>
<div>
@for (item of selectedMessage().values; track $index) {
<app-proto-field
[label]="item.name"
[configuration]="item.configuration"
[(value)]="values()[$index]"
></app-proto-field>

View File

@@ -0,0 +1,3 @@
:host {
padding: var(--mat-sidenav-container-shape);
}

View File

@@ -2,6 +2,7 @@ import { CommonModule } from '@angular/common';
import {
Component,
ElementRef,
computed,
effect,
input,
signal,
@@ -22,8 +23,12 @@ export class EditorComponent {
// TODO: This needs to be reworked so we have a local property and implement some kind of auto-save
fileContents = input<string>();
selectedMessage = input.required<ProtoMessage>();
// TODO: This needs to start with the parsed file contents, and get updated when the code value changes
protected values = signal([]);
protected values = computed(() => {
const message = this.selectedMessage();
return message.values.map((value) => null);
});
private code = viewChild<ElementRef<HTMLElement>>('code');
constructor() {