Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Calendar) add AdditionalHeaders Parameter #4673 #4674

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/BootstrapBlazor/Components/Calendar/Calendar.razor
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@
<table cellspacing="0" cellpadding="0" class="calendar-table table-week">
<thead>
<tr>
@if (AdditionalHeaders != null)
{

Check warning on line 90 in src/BootstrapBlazor/Components/Calendar/Calendar.razor

View check run for this annotation

Codecov / codecov/patch

src/BootstrapBlazor/Components/Calendar/Calendar.razor#L90

Added line #L90 was not covered by tests
foreach (var item in AdditionalHeaders)
{

Check warning on line 92 in src/BootstrapBlazor/Components/Calendar/Calendar.razor

View check run for this annotation

Codecov / codecov/patch

src/BootstrapBlazor/Components/Calendar/Calendar.razor#L92

Added line #L92 was not covered by tests
@RenderAddHeader(item)
}
}

Check warning on line 95 in src/BootstrapBlazor/Components/Calendar/Calendar.razor

View check run for this annotation

Codecov / codecov/patch

src/BootstrapBlazor/Components/Calendar/Calendar.razor#L94-L95

Added lines #L94 - L95 were not covered by tests
@for (var index = 0; index < 7; index++)
{
@RenderWeekHeader(index)
Expand Down Expand Up @@ -115,4 +122,11 @@
<div>@GetWeekDayString(index)</div>
</div>
</th>;

RenderFragment<string> RenderAddHeader => name =>
@<th>
<div class="week-header">
<div><span class="d-none d-sm-inline-block">@name</span></div>
</div>
</th>;
}
6 changes: 6 additions & 0 deletions src/BootstrapBlazor/Components/Calendar/Calendar.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ protected int GetWeekCount()
[Parameter]
public RenderFragment? ChildContent { get; set; }

/// <summary>
/// 获得/设置 附加列
/// </summary>
[Parameter]
public string[]? AdditionalHeaders { get; set; }

/// <summary>
/// 获得/设置 单元格模板
/// </summary>
Expand Down