Thor/Thor.BlazorCommon/Components/TemplateFiller.razor
2025-09-03 04:25:16 +02:00

52 lines
1.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<h3>@Grid.Name <Button @onclick=@(async () => await AddChildTitle())></Button></h3>
@foreach (var i in Grid.Register.Forge())
{
<TemplateFillerItem Grid=@Grid Item=@i OnAddChild="async () => await AddChildTitle(i.Identifier)"/>
}
@code {
[Parameter]
public TemplateGrid Grid { get; set; } = default!;
protected async Task AddChildTitle(string? parent = null)
{
var id = Guid.NewGuid().ToString();
Grid.Register.Add(new()
{
Identifier = Guid.NewGuid().ToString(),
Target = id,
Author = "",
Type = TemplateEntry.EntryType.Set,
Field = TemplateEntry.FieldType.Type,
Content = TemplateEntry.TYPE_TITLE,
});
Grid.Register.Add(new()
{
Identifier = Guid.NewGuid().ToString(),
Target = id,
Author = "",
Type = TemplateEntry.EntryType.Set,
Field = TemplateEntry.FieldType.Parent,
Content = parent
});
Grid.Register.Add(new()
{
Identifier = Guid.NewGuid().ToString(),
Target = id,
Author = "",
Type = TemplateEntry.EntryType.Set,
Field = TemplateEntry.FieldType.Label,
Content = "TEST "
});
StateHasChanged();
}
}