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.
83 lines
4.6 KiB
83 lines
4.6 KiB
2 years ago
|
@namespace Connected.Components
|
||
|
@implements IDisposable
|
||
|
@inherits UIComponent
|
||
|
|
||
|
<tr class="@Classname" @onclick="@OnRowClicked" style="@Style" @attributes="@UserAttributes">
|
||
|
@if (IsEditable && ((Context?.Table.EditButtonPosition.DisplayEditButtonAtStart() == true && Context?.Table.EditTrigger == TableEditTrigger.EditButton) || Context?.Table.ApplyButtonPosition.DisplayApplyButtonAtStart() == true))
|
||
|
{
|
||
|
@* Add datalabel as a placeholder to avoid jumps on small viewports *@
|
||
|
<Td DataLabel=" " Class="py-3">
|
||
|
@if (Context?.Table.EditTrigger == TableEditTrigger.EditButton && !object.ReferenceEquals(Context?.Table._editingItem, Item) && (!Context?.Table.ReadOnly ?? false) && Context?.Table.EditButtonPosition.DisplayEditButtonAtStart() == true)
|
||
|
{
|
||
|
@if (Context?.Table.EditButtonContent != null)
|
||
|
{
|
||
|
@Context?.Table.EditButtonContent(new EditButtonContext(StartEditingItem, Context.EditButtonDisabled(Item)))
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
<IconButton Size="@Size.Small" Icon="@Icons.Outlined.Edit" Class="pa-0" OnClick="StartEditingItem" Disabled="Context.EditButtonDisabled(Item)" />
|
||
|
}
|
||
|
}
|
||
|
else if (object.ReferenceEquals(Context?.Table._editingItem, Item) && (!Context?.Table.ReadOnly ?? false) && Context?.Table.ApplyButtonPosition.DisplayApplyButtonAtStart() == true)
|
||
|
{
|
||
|
<div style="display: flex;">
|
||
|
<Tooltip Text="@Context.Table.CommitEditTooltip">
|
||
|
<IconButton Class="pa-0" Icon="@Context.Table.CommitEditIcon" OnClick="FinishEdit" Size="@Size.Small" Disabled="@(!(Context?.Table.Validator?.IsValid ?? false))" />
|
||
|
</Tooltip>
|
||
|
@if (Context.Table.CanCancelEdit)
|
||
|
{
|
||
|
<Tooltip Text="@Context.Table.CancelEditTooltip">
|
||
|
<IconButton Class="pa-0 ml-4" Icon="@Context.Table.CancelEditIcon" OnClick="CancelEdit" Size="@Size.Small" />
|
||
|
</Tooltip>
|
||
|
}
|
||
|
</div>
|
||
|
}
|
||
|
</Td>
|
||
|
}
|
||
|
@if (IsExpandable || IsCheckable)
|
||
|
{
|
||
|
<Element HtmlTag="@("Td")" Class="mud-table-cell">
|
||
|
<div class="d-flex" style="@ActionsStylename">
|
||
|
@if (IsCheckable)
|
||
|
{
|
||
|
<CheckBox @bind-Checked="IsChecked" StopClickPropagation="true" Class="mud-table-cell-checkbox"></CheckBox>
|
||
|
}
|
||
|
</div>
|
||
|
</Element>
|
||
|
}
|
||
|
@ChildContent
|
||
|
@if (IsEditable && ((Context?.Table.EditButtonPosition.DisplayEditButtonAtEnd() == true && Context?.Table.EditTrigger == TableEditTrigger.EditButton) || Context?.Table.ApplyButtonPosition.DisplayApplyButtonAtEnd() == true))
|
||
|
{
|
||
|
@* Add datalabel as a placeholder to avoid jumps on small viewports *@
|
||
|
<Td DataLabel=" " Class="py-3">
|
||
|
@if (Context?.Table.EditTrigger == TableEditTrigger.EditButton && !object.ReferenceEquals(Context?.Table._editingItem, Item) && (!Context?.Table.ReadOnly ?? false) && Context?.Table.EditButtonPosition.DisplayEditButtonAtEnd() == true)
|
||
|
{
|
||
|
@if (Context?.Table.EditButtonContent != null)
|
||
|
{
|
||
|
@Context?.Table.EditButtonContent(new EditButtonContext(StartEditingItem, Context.EditButtonDisabled(Item)))
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
<IconButton Size="@Size.Small" Icon="@Icons.Outlined.Edit" Class="pa-0" OnClick="StartEditingItem" Disabled="Context.EditButtonDisabled(Item)" />
|
||
|
}
|
||
|
}
|
||
|
else if (object.ReferenceEquals(Context?.Table._editingItem, Item) && (!Context?.Table.ReadOnly ?? false) && Context?.Table.ApplyButtonPosition.DisplayApplyButtonAtEnd() == true)
|
||
|
{
|
||
|
<div style="display: flex;">
|
||
|
<Tooltip Text="@Context.Table.CommitEditTooltip">
|
||
|
<IconButton Class="pa-0" Icon="@Context.Table.CommitEditIcon" OnClick="FinishEdit" Size="@Size.Small" Disabled="@(!(Context?.Table.Validator?.IsValid ?? false))" />
|
||
|
</Tooltip>
|
||
|
@if (Context.Table.CanCancelEdit)
|
||
|
{
|
||
|
<Tooltip Text="@Context.Table.CancelEditTooltip">
|
||
|
<MudIconButton Class="pa-0 ml-4" Icon="@Context.Table.CancelEditIcon" OnClick="CancelEdit" Size="@Size.Small" />
|
||
|
</Tooltip>
|
||
|
}
|
||
|
</div>
|
||
|
}
|
||
|
</Td>
|
||
|
}
|
||
|
</tr>
|
||
|
|
||
|
|