Remove common module, add friendy name editing, add enum options editing, fix list option warning
Some checks failed
release-nightly / macos (push) Failing after 23s
release-nightly / web-demo (push) Failing after 4m25s

This commit is contained in:
2025-05-13 20:49:46 +09:30
parent dd8d1374ab
commit ec0f21cf16
20 changed files with 208 additions and 174 deletions

View File

@@ -1,4 +1,3 @@
import { CommonModule } from '@angular/common';
import {
ChangeDetectionStrategy,
Component,
@@ -16,14 +15,13 @@ import { ProtoFieldComponent } from '../proto-field/proto-field.component';
const keyIsEmpty = (key: string | number) => key == null || key === '';
@Component({
selector: 'app-map-field',
imports: [
CommonModule,
forwardRef(() => ProtoFieldComponent),
MatIconModule,
MatButtonModule,
],
template: `<h3>{{ label() }}</h3>
selector: 'app-map-field',
imports: [
forwardRef(() => ProtoFieldComponent),
MatIconModule,
MatButtonModule,
],
template: `<h3>{{ label() }}</h3>
@if(valuePairs()) { @for(value of valuePairs(); track $index) {
<div class="row-wrapper">
<app-proto-field
@@ -44,8 +42,8 @@ const keyIsEmpty = (key: string | number) => key == null || key === '';
<button mat-icon-button class="add-button" (click)="add()">
<mat-icon>add</mat-icon>
</button>`,
styleUrl: './map-field.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush
styleUrl: './map-field.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class MapFieldComponent {
label = input<string>();
@@ -57,22 +55,19 @@ export class MapFieldComponent {
private changedInternal = false;
constructor() {
effect(
() => {
// TODO: Super hacky but can't really think of another way to keep these in sync
// without removing an entry when the key gets blanked. Would need an alternate
// design that updated on blur only perhaps
if (this.changedInternal) {
this.changedInternal = false;
return;
}
const values = this.values();
if (values) {
this.valuePairs.set(Object.entries(values));
}
},
{ allowSignalWrites: true }
);
effect(() => {
// TODO: Super hacky but can't really think of another way to keep these in sync
// without removing an entry when the key gets blanked. Would need an alternate
// design that updated on blur only perhaps
if (this.changedInternal) {
this.changedInternal = false;
return;
}
const values = this.values();
if (values) {
this.valuePairs.set(Object.entries(values));
}
});
}
add() {