ant-design-blazor/components/list/AntList.razor

88 lines
2.4 KiB
C#
Raw Normal View History

@namespace AntDesign
2020-05-03 21:46:21 +08:00
@inherits AntDomComponentBase
2020-05-21 14:49:07 +08:00
@typeparam TItem
2020-05-03 21:46:21 +08:00
2020-05-21 14:49:07 +08:00
<div class="@ClassMapper.Class" style="@Style" Id="@Id">
2020-05-03 21:46:21 +08:00
2020-05-21 14:49:07 +08:00
@if (Header != null)
{
<div class="@PrefixName-header">
@Header
</div>
}
@if (DataSource != null && DataSource.Any())
{
<Spin Spinning="Loading">
@childrenContent(this)
</Spin>
}
else
{
<div style="min-height:53px" />
}
2020-05-03 21:46:21 +08:00
2020-05-21 14:49:07 +08:00
@if (Footer != null)
{
<div class="@PrefixName-footer">
@Footer
2020-05-03 21:46:21 +08:00
</div>
2020-05-21 14:49:07 +08:00
}
@if (LoadMore != null)
{
@LoadMore
}
2020-05-21 14:49:07 +08:00
</div>
2020-05-03 21:46:21 +08:00
2020-05-21 14:49:07 +08:00
@code{
RenderFragment<AntList<TItem>> childrenContent = content =>
@<Template>
2020-05-21 14:49:07 +08:00
@if (content.Grid != null)
{
<Row Gutter="content.Grid.Gutter">
2020-05-21 14:49:07 +08:00
@foreach (var item in content.DataSource)
{
@if (content.Extra != null)
{
<AntListItem ItemCount="content.DataSource.Count()" ItemLayout="content.ItemLayout" Grid="content.Grid" Actions="content.Actions" Extra="content.Extra">
@content.Item(item)
</AntListItem>
}
else
{
<AntListItem ItemCount="content.DataSource.Count()" ItemLayout="content.ItemLayout" Grid="content.Grid" Actions="content.Actions">
@content.Item(item)
</AntListItem>
}
2020-05-21 14:49:07 +08:00
}
</Row>
2020-05-21 14:49:07 +08:00
}
else
2020-05-03 21:46:21 +08:00
{
2020-05-21 14:49:07 +08:00
<ul class="ant-list-items">
@foreach (var item in content.DataSource)
{
@if (content.Extra != null)
{
<AntListItem ItemCount="content.DataSource.Count()" ItemLayout="content.ItemLayout" Actions="content.Actions" Extra="content.Extra">
@content.Item(item)
</AntListItem>
}
else
{
<AntListItem ItemCount="content.DataSource.Count()" ItemLayout="content.ItemLayout" Actions="content.Actions">
@content.Item(item)
</AntListItem>
}
2020-05-21 14:49:07 +08:00
}
</ul>
2020-05-03 21:46:21 +08:00
}
2020-05-21 14:49:07 +08:00
</Template>;
2020-05-21 14:49:07 +08:00
}