You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Components/Components/Table/TableGroupRow.razor

78 lines
2.8 KiB

@namespace Connected.Components
@implements IDisposable
@inherits UIComponent
@typeparam T
@*HEADER:*@
@if (HeaderTemplate != null && GroupDefinition != null)
{
<tr class="@HeaderClassname" @onclick="@OnRowClick" style="@HeaderStyle" @attributes="@UserAttributes">
@if ((GroupDefinition?.IsThisOrParentExpandable ?? false) || (Context?.Table.MultiSelection ?? false))
{
<Td>
<div class="d-flex">
@if (GroupDefinition.Expandable)
{
<IconButton Class="mud-table-row-expander" Icon="@(IsExpanded ? ExpandIcon : CollapseIcon)" OnClick="@(() => IsExpanded = !IsExpanded)"/>
}
else
{
if (GroupDefinition?.IsParentExpandable ?? false)
{
<div style="@ActionsStylename"></div>
}
}
@if (IsCheckable)
{
<CheckBox @bind-Checked="IsChecked" Class="mud-table-cell-checkbox"/>
}
</div>
</Td>
}
@HeaderTemplate(new TableGroupData<object, T>(GroupDefinition.GroupName, Items.Key, Items.ToList()))
@if ((Context?.Table.IsEditable ?? false))
{
<Td />
}
</tr>
}
else
{
<TextContent @attributes="@UserAttributes">@("There aren't any group definition to use with this component.")</TextContent>
}
@if (IsExpanded)
{
@*CHILDREN:*@
@if (_innerGroupItems != null && GroupDefinition != null)
{
@foreach (var group in _innerGroupItems)
{
<TableGroupRow GroupDefinition="GroupDefinition.InnerGroup" Items="@group" IsCheckable="@IsCheckable"
HeaderClass="@HeaderClass" HeaderStyle="@HeaderStyle"
FooterClass="@FooterClass" FooterStyle="@FooterStyle"
HeaderTemplate="@HeaderTemplate" FooterTemplate="@FooterTemplate" T="T" @attributes="@UserAttributes" />
}
}
else
{
@Table?.RenderRows(Items, (GroupDefinition?.Indentation ?? false) ? $"mud-table-row-group-indented-{GroupDefinition?.Level - 1}" : null, GroupDefinition?.IsThisOrParentExpandable ?? false)
}
@*FOOTER:*@
@if (FooterTemplate != null && GroupDefinition != null)
{
<tr class="@FooterClassname" @onclick="@OnRowClick" style="@FooterStyle" @attributes="@UserAttributes">
@if ((GroupDefinition?.IsThisOrParentExpandable ?? false) || (Context?.Table.MultiSelection ?? false))
{
<Td/>
}
@FooterTemplate(new TableGroupData<object, T>(GroupDefinition.GroupName, Items.Key, Items.ToList()))
@if ((Context?.Table.IsEditable ?? false))
{
<Td />
}
</tr>
}
}