Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public partial class DateTimePicker<TValue>
/// </summary>
private string? InputClassName => CssBuilder.Default("dropdown-toggle form-control datetime-picker-input")
.AddClass("has-icon", ShowIcon)
.AddClass($"border-{Color.ToDescriptionString()}", Color != Color.None && !IsDisabled && !IsValid.HasValue)
.AddClass(ValidCss)
.Build();

Expand Down Expand Up @@ -105,6 +106,12 @@ public string? Format
[Parameter]
public bool ShowIcon { get; set; } = true;

/// <summary>
/// 获得/设置 控件边框颜色样式 默认为 None 显示
/// </summary>
[Parameter]
public Color Color { get; set; } = Color.None;

/// <summary>
/// 获得/设置 组件显示模式 默认为显示年月日模式
/// </summary>
Expand Down
12 changes: 12 additions & 0 deletions test/UnitTest/Components/DateTimePickerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ namespace UnitTest.Components;
public class DateTimePickerTest : BootstrapBlazorTestBase
{
#region DateTimePicker
[Fact]
public void Color_Ok()
{
var cut = Context.RenderComponent<DateTimePicker<DateTime>>(pb =>
{
pb.Add(a => a.AutoToday, true);
pb.Add(a => a.Value, DateTime.MinValue);
pb.Add(a => a.Color, Color.Primary);
});
cut.Contains("border-primary");
}

[Fact]
public void AutoToday_DateTime()
{
Expand Down
Loading