-
Notifications
You must be signed in to change notification settings - Fork 9.8k
/
ColumnBase.razor
54 lines (50 loc) · 1.88 KB
/
ColumnBase.razor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
@using Microsoft.AspNetCore.Components.Rendering
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Components.Web.Virtualization
@namespace Microsoft.AspNetCore.Components.QuickGrid
@typeparam TGridItem
@{
InternalGridContext.Grid.AddColumn(this, InitialSortDirection, IsDefaultSortColumn);
}
@code
{
private void RenderDefaultHeaderContent(RenderTreeBuilder __builder)
{
@if (HeaderTemplate is not null)
{
@HeaderTemplate(this)
}
else
{
@if (ColumnOptions is not null && (Align != Align.Right && Align != Align.End))
{
<button class="col-options-button" type="button" @onclick="@(() => Grid.ShowColumnOptionsAsync(this))"></button>
}
if (Sortable.HasValue ? Sortable.Value : IsSortableByDefault())
{
<button class="col-title" type="button" @onclick="@(() => Grid.SortByColumnAsync(this))">
<div class="col-title-text">@Title</div>
<div class="sort-indicator" aria-hidden="true"></div>
</button>
}
else
{
<div class="col-title">
<div class="col-title-text">@Title</div>
</div>
}
@if (ColumnOptions is not null && (Align == Align.Right || Align == Align.End))
{
<button class="col-options-button" type="button" @onclick="@(() => Grid.ShowColumnOptionsAsync(this))"></button>
}
}
}
internal void RenderPlaceholderContent(RenderTreeBuilder __builder, PlaceholderContext placeholderContext)
{
// Blank if no placeholder template was supplied, as it's enough to style with CSS by default
if (PlaceholderTemplate is not null)
{
@PlaceholderTemplate(placeholderContext)
}
}
}