mirror of
https://github.com/radzenhq/radzen-blazor.git
synced 2026-02-04 05:35:44 +00:00
52 lines
1.3 KiB
Plaintext
52 lines
1.3 KiB
Plaintext
@implements IRadzenForm
|
|
|
|
<tr class="@CssClass" @attributes="@Attributes">
|
|
<CascadingValue Value=this>
|
|
@ChildContent
|
|
</CascadingValue>
|
|
</tr>
|
|
@code {
|
|
[Parameter(CaptureUnmatchedValues = true)]
|
|
public IReadOnlyDictionary<string, object> Attributes { get; set; } = new Dictionary<string, object>();
|
|
|
|
[Parameter]
|
|
public RenderFragment? ChildContent { get; set; }
|
|
|
|
[Parameter]
|
|
public string CssClass { get; set; } = string.Empty;
|
|
|
|
[Parameter]
|
|
public bool InEditMode { get; set; }
|
|
|
|
List<IRadzenFormComponent> components = new();
|
|
|
|
public void AddComponent(IRadzenFormComponent component)
|
|
{
|
|
if (components != null)
|
|
{
|
|
if (components.IndexOf(component) == -1)
|
|
{
|
|
components.Add(component);
|
|
}
|
|
}
|
|
}
|
|
public void RemoveComponent(IRadzenFormComponent component)
|
|
{
|
|
components?.Remove(component);
|
|
}
|
|
|
|
public override Task SetParametersAsync(ParameterView parameters)
|
|
{
|
|
if (InEditMode != parameters.GetValueOrDefault<bool>("InEditMode"))
|
|
{
|
|
components = new List<IRadzenFormComponent>();
|
|
}
|
|
|
|
return base.SetParametersAsync(parameters);
|
|
}
|
|
|
|
public IRadzenFormComponent FindComponent(string name)
|
|
{
|
|
return components.Where(component => component.Name == name).FirstOrDefault()!;
|
|
}
|
|
} |