49 lines
1.4 KiB
Plaintext
49 lines
1.4 KiB
Plaintext
<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();
|
||
}
|
||
}
|