mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-05 05:27:37 +08:00
643c6de31e
* feat(module:table): header template and item template * add demos * fix merge conflict * rename some api Co-authored-by: anranruye <hehewewe@hotmail.com>
76 lines
2.2 KiB
C#
76 lines
2.2 KiB
C#
@namespace AntDesign
|
|
@inherits AntDomComponentBase
|
|
@using AntDesign.TableModels
|
|
|
|
@{
|
|
Dictionary<string, object> attributes = null;
|
|
if (RowAttributes?.Any() != true)
|
|
{
|
|
attributes = AdditionalAttributes;
|
|
}
|
|
else if (AdditionalAttributes?.Any() != true)
|
|
{
|
|
attributes = RowAttributes;
|
|
}
|
|
else
|
|
{
|
|
attributes = new Dictionary<string, object>();
|
|
foreach (var (key, value) in RowAttributes)
|
|
{
|
|
attributes[key] = value;
|
|
}
|
|
foreach (var (key, value) in AdditionalAttributes)
|
|
{
|
|
attributes[key] = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
@if (IsBody)
|
|
{
|
|
<tr @attributes="attributes"
|
|
data-row-key="@(RowData.RowIndex-1)"
|
|
class="ant-table-row ant-table-row-level-@RowData.Level @(RowData.Selected ? "ant-table-row-selected" : "") @RowClassName @Class @RowAttributes?.GetValueOrDefault("class")">
|
|
@ChildContent
|
|
</tr>
|
|
}
|
|
else if (IsHeader)
|
|
{
|
|
<tr @attributes="attributes" class="@Class @RowAttributes?.GetValueOrDefault("class")">
|
|
@ChildContent
|
|
@if (ScrollY != null)
|
|
{
|
|
<th class="ant-table-cell @(HasFixRight?"ant-table-cell-fix-right":"") ant-table-cell-scrollbar" style="@(HasFixRight?"position: sticky; right: 0px;":"")"></th>
|
|
}
|
|
</tr>
|
|
}
|
|
|
|
@code {
|
|
[Parameter]
|
|
public RenderFragment ChildContent { get; set; }
|
|
|
|
[CascadingParameter(Name = "IsHeader")]
|
|
public bool IsHeader { get; set; }
|
|
|
|
[CascadingParameter(Name = "IsBody")]
|
|
public bool IsBody { get; set; }
|
|
|
|
[CascadingParameter(Name = "RowData")]
|
|
public RowData RowData { get; set; }
|
|
|
|
[CascadingParameter(Name = "AntDesign.TableRow.RowAttributes")]
|
|
public Dictionary<string, object> RowAttributes { get; set; }
|
|
|
|
[CascadingParameter(Name = "AntDesign.TableRow.RowClassName")]
|
|
public string RowClassName { get; set; }
|
|
|
|
[CascadingParameter(Name = "AntDesign.TableRow.ScrollY")]
|
|
public string ScrollY { get; set; }
|
|
|
|
[CascadingParameter(Name = "AntDesign.TableRow.HasFixRight")]
|
|
public bool HasFixRight { get; set; }
|
|
|
|
[Parameter(CaptureUnmatchedValues = true)]
|
|
public Dictionary<string, object> AdditionalAttributes { get; set; }
|
|
}
|