-
-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Calendar): add HeaderTemplate parameter (#4674)
* (Calendar) add AdditionalHeaders Parameter #4673 * feat: 增加 HeaderTemplate 模板 * feat: 增加 BodyTemplateContext 上下文类 * doc: 增加注释信息 * doc: 更新示例 * test: 更新单元测试 --------- Co-Authored-By: Argo Zhang <[email protected]>
- Loading branch information
1 parent
6f491d7
commit cd12a60
Showing
14 changed files
with
289 additions
and
22 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
src/BootstrapBlazor.Server/Components/Components/CalendarBodyTemplate.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<td> | ||
<div class="calendar-day text-center"> | ||
总结 | ||
</div> | ||
</td> | ||
@foreach (var value in Context.Values) | ||
{ | ||
<td class="@value.DefaultCss"> | ||
<div class="calendar-day"> | ||
<span>@value.CellValue.Day</span> | ||
</div> | ||
</td> | ||
} | ||
<td> | ||
<div class="calendar-day text-center"> | ||
结算 | ||
</div> | ||
</td> |
20 changes: 20 additions & 0 deletions
20
src/BootstrapBlazor.Server/Components/Components/CalendarBodyTemplate.razor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the Apache 2.0 License | ||
// See the LICENSE file in the project root for more information. | ||
// Maintainer: Argo Zhang([email protected]) Website: https://www.blazor.zone | ||
|
||
namespace BootstrapBlazor.Server.Components.Components; | ||
|
||
/// <summary> | ||
/// 日历 BodyTemplate 组件 | ||
/// </summary> | ||
public partial class CalendarBodyTemplate | ||
{ | ||
/// <summary> | ||
/// 获得/设置 月视图 BodyTempalte 上下文 | ||
/// </summary> | ||
[Parameter] | ||
[EditorRequired] | ||
[NotNull] | ||
public BodyTemplateContext? Context { get; set; } | ||
} |
48 changes: 48 additions & 0 deletions
48
src/BootstrapBlazor.Server/Components/Components/CalendarChildContent.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<tr> | ||
<td>09:00</td> | ||
@for (var index = 0; index < 7; index++) | ||
{ | ||
<td></td> | ||
} | ||
</tr> | ||
<tr> | ||
<td>10:00</td> | ||
@for (var index = 0; index < 7; index++) | ||
{ | ||
<td></td> | ||
} | ||
</tr> | ||
<tr> | ||
<td>11:00</td> | ||
@for (var index = 0; index < 7; index++) | ||
{ | ||
<td></td> | ||
} | ||
</tr> | ||
<tr> | ||
<td colspan="8" class="bg-success">茶歇</td> | ||
</tr> | ||
<tr> | ||
<td>14:00</td> | ||
@for (var index = 0; index < 7; index++) | ||
{ | ||
<td></td> | ||
} | ||
</tr> | ||
<tr> | ||
<td>15:00</td> | ||
@for (var index = 0; index < 7; index++) | ||
{ | ||
<td></td> | ||
} | ||
</tr> | ||
<tr> | ||
<td>16:00</td> | ||
@for (var index = 0; index < 7; index++) | ||
{ | ||
<td></td> | ||
} | ||
</tr> | ||
<tr> | ||
<td colspan="8" style="background-color: #f8f9fa;">晚宴</td> | ||
</tr> |
14 changes: 14 additions & 0 deletions
14
src/BootstrapBlazor.Server/Components/Components/CalendarChildContent.razor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the Apache 2.0 License | ||
// See the LICENSE file in the project root for more information. | ||
// Maintainer: Argo Zhang([email protected]) Website: https://www.blazor.zone | ||
|
||
namespace BootstrapBlazor.Server.Components.Components; | ||
|
||
/// <summary> | ||
/// 日历 ChildContent 组件 | ||
/// </summary> | ||
public partial class CalendarChildContent | ||
{ | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
src/BootstrapBlazor.Server/Components/Components/CalendarHeaderTemplate.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
@if (ViewMode == CalendarViewMode.Month) | ||
{ | ||
<tr> | ||
<th>月总结</th> | ||
<th>星期日</th> | ||
<th>星期一</th> | ||
<th>星期二</th> | ||
<th>星期三</th> | ||
<th>星期四</th> | ||
<th>星期五</th> | ||
<th>星期六</th> | ||
<th>合计</th> | ||
</tr> | ||
} | ||
else | ||
{ | ||
<tr> | ||
<th>时间</th> | ||
<th>星期日</th> | ||
<th>星期一</th> | ||
<th>星期二</th> | ||
<th>星期三</th> | ||
<th>星期四</th> | ||
<th>星期五</th> | ||
<th>星期六</th> | ||
</tr> | ||
} |
18 changes: 18 additions & 0 deletions
18
src/BootstrapBlazor.Server/Components/Components/CalendarHeaderTemplate.razor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the Apache 2.0 License | ||
// See the LICENSE file in the project root for more information. | ||
// Maintainer: Argo Zhang([email protected]) Website: https://www.blazor.zone | ||
|
||
namespace BootstrapBlazor.Server.Components.Components; | ||
|
||
/// <summary> | ||
/// 日历 HeaderTemplate 组件 | ||
/// </summary> | ||
public partial class CalendarHeaderTemplate | ||
{ | ||
/// <summary> | ||
/// 获得/设置 是否显示周视图 默认为 CalendarVieModel.Month 月视图 | ||
/// </summary> | ||
[Parameter] | ||
public CalendarViewMode ViewMode { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/BootstrapBlazor/Components/Calendar/BodyTemplateContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the Apache 2.0 License | ||
// See the LICENSE file in the project root for more information. | ||
// Maintainer: Argo Zhang([email protected]) Website: https://www.blazor.zone | ||
|
||
namespace BootstrapBlazor.Components; | ||
|
||
/// <summary> | ||
/// BodyTemplateContext 上下文类 | ||
/// </summary> | ||
public class BodyTemplateContext | ||
{ | ||
/// <summary> | ||
/// 获得/设置 当前星期日数据集合 | ||
/// </summary> | ||
public List<CalendarCellValue> Values { get; } = []; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters