Skip to content

Commit 6832424

Browse files
A5196060ArgoZhangj4587698tiansfather
authored
doc(Safari): add theme color for safari on mac (#4909)
* doc: 增加主题色 * refactor: 更新颜色 * refactor: 更新位置 * refactor: 变量名变更 * refactor: 重构代码 * refactor: 调整可为空 --------- Signed-off-by: A5196060 <166673003+A5196060@users.noreply.github.com> Co-authored-by: A5196060 <166673003+A5196060@users.noreply.github.com> Co-authored-by: Argo-AsicoTech <argo@live.ca> Co-authored-by: j4587698 <zhuce@jvxiang.com> Co-authored-by: Mr Lu <ghi.ghi@163.com>
1 parent eac7530 commit 6832424

File tree

8 files changed

+19
-19
lines changed

8 files changed

+19
-19
lines changed

src/BootstrapBlazor.Server/Components/App.razor

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
<html lang="en" data-bs-theme='light'>
77

88
<head>
9-
<meta name="theme-color" content="#712cf9">
109
<meta charset="utf-8" />
1110
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
1211
<meta http-equiv="X-UA-Compatible" content="IE=edge">
1312
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
1413
<meta name="keywords" content="bootstrapblazor,bootstrap,blazor,wasm,webassembly,UI,netcore,web,assembly">
1514
<meta name="description" content="基于 Bootstrap 风格的 Blazor UI 组件库,用于研发企业级中后台产品。">
1615
<meta name="author" content="argo (argo@live.ca)">
16+
<meta name="theme-color" content="#712cf9">
1717
<title>@Localizer["SiteTitle"]</title>
1818
<base href="/" />
1919
<link rel="icon" href="favicon.ico" type="image/x-icon">

src/BootstrapBlazor/Components/Checkbox/CheckboxListGeneric.razor

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@namespace BootstrapBlazor.Components
22
@typeparam TValue
3-
@inherits ValidateBase<List<TValue?>>
3+
@inherits ValidateBase<List<TValue>>
44

55
@if (IsShowLabel)
66
{
@@ -29,7 +29,7 @@ else
2929
<Checkbox TValue="bool" IsDisabled="GetDisabledState(item)"
3030
ShowAfterLabel="true" ShowLabel="false" ShowLabelTooltip="ShowLabelTooltip"
3131
DisplayText="@item.Text" OnBeforeStateChanged="_onBeforeStateChangedCallback!"
32-
Value="@item.Active" OnStateChanged="@((state, v) => OnStateChanged(item, v))"></Checkbox>
32+
Value="@item.Active" OnStateChanged="@((_, v) => OnStateChanged(item, v))"></Checkbox>
3333
</div>
3434
}
3535
</div>

src/BootstrapBlazor/Components/Checkbox/CheckboxListGeneric.razor.cs

+8-8
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public partial class CheckboxListGeneric<TValue> : IModelEqualityComparer<TValue
2525
/// <summary>
2626
/// 获得 组件内部 Checkbox 项目样式
2727
/// </summary>
28-
protected string? CheckboxItemClassString => CssBuilder.Default("checkbox-item")
28+
private string? CheckboxItemClassString => CssBuilder.Default("checkbox-item")
2929
.AddClass(CheckboxItemClass)
3030
.Build();
3131

@@ -97,7 +97,7 @@ public partial class CheckboxListGeneric<TValue> : IModelEqualityComparer<TValue
9797
/// 获得/设置 SelectedItemChanged 方法
9898
/// </summary>
9999
[Parameter]
100-
public Func<IEnumerable<SelectedItem<TValue>>, List<TValue?>, Task>? OnSelectedChanged { get; set; }
100+
public Func<IEnumerable<SelectedItem<TValue>>, List<TValue>, Task>? OnSelectedChanged { get; set; }
101101

102102
/// <summary>
103103
/// 获得/设置 最多选中数量
@@ -204,23 +204,23 @@ private async Task<bool> OnBeforeStateChanged(CheckboxState state)
204204
private async Task OnStateChanged(SelectedItem<TValue> item, bool v)
205205
{
206206
item.Active = v;
207-
var vals = new List<TValue?>();
207+
var items = new List<TValue>();
208208
if (Value != null)
209209
{
210-
vals.AddRange(Value);
210+
items.AddRange(Value);
211211
}
212212

213-
var val = vals.Find(i => IsEquals(item.Value));
213+
var val = items.Find(i => Equals(item.Value, i));
214214
if (v && val == null)
215215
{
216-
vals.Add(item.Value);
216+
items.Add(item.Value);
217217
}
218218
else
219219
{
220-
vals.Remove(val);
220+
items.Remove(val!);
221221
}
222222

223-
CurrentValue = vals;
223+
CurrentValue = items;
224224

225225
if (OnSelectedChanged != null)
226226
{

src/BootstrapBlazor/Components/Radio/RadioListGeneric.razor.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ protected override void OnParametersSet()
120120
var t = NullableUnderlyingType ?? typeof(TValue);
121121
if (t.IsEnum && Items == null)
122122
{
123-
Items = t.ToSelectList<TValue>((NullableUnderlyingType != null && IsAutoAddNullItem) ? new SelectedItem<TValue>(default, NullItemText) : null);
123+
Items = t.ToSelectList<TValue>((NullableUnderlyingType != null && IsAutoAddNullItem) ? new SelectedItem<TValue>(default!, NullItemText) : null);
124124
}
125125

126126
Items ??= [];

src/BootstrapBlazor/Components/SelectGeneric/SelectGeneric.razor.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ private async Task OnChange(ChangeEventArgs args)
566566

567567
if (item == null)
568568
{
569-
TValue? val = default;
569+
TValue val = default!;
570570
if (TextConvertToValueCallback != null)
571571
{
572572
val = await TextConvertToValueCallback(v);

src/BootstrapBlazor/Components/SelectGeneric/SelectOptionGeneric.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ protected override void OnInitialized()
5858
Container?.Add(ToSelectedItem());
5959
}
6060

61-
private SelectedItem<TValue> ToSelectedItem() => new(Value, Text ?? "")
61+
private SelectedItem<TValue> ToSelectedItem() => new(Value!, Text ?? "")
6262
{
6363
Active = Active,
6464
GroupName = GroupName ?? "",

src/BootstrapBlazor/Misc/SelectedItemOfT.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ public class SelectedItem<T>
1313
/// <summary>
1414
/// 构造函数
1515
/// </summary>
16-
public SelectedItem() { }
16+
public SelectedItem() { Value = default!; }
1717

1818
/// <summary>
1919
/// 构造函数
2020
/// </summary>
2121
/// <param name="value"></param>
2222
/// <param name="text"></param>
23-
public SelectedItem(T? value, string text)
23+
public SelectedItem(T value, string text)
2424
{
2525
Value = value;
2626
Text = text;
@@ -34,7 +34,7 @@ public SelectedItem(T? value, string text)
3434
/// <summary>
3535
/// 获得/设置 选项值
3636
/// </summary>
37-
public T? Value { get; set; }
37+
public T Value { get; set; }
3838

3939
/// <summary>
4040
/// 获得/设置 是否选中

test/UnitTest/Components/CheckboxListGenericTest.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ public void IsVertical_Ok()
7878
[Fact]
7979
public async Task NullItem_Ok()
8080
{
81-
var items = new List<SelectedItem<Foo>>()
81+
var items = new List<SelectedItem<Foo?>>()
8282
{
8383
new(null, "Select ..."),
8484
new(new Foo() { Id = 2, Name = "Test2" }, "Test 2")
8585
};
86-
var cut = Context.RenderComponent<CheckboxListGeneric<Foo>>(pb =>
86+
var cut = Context.RenderComponent<CheckboxListGeneric<Foo?>>(pb =>
8787
{
8888
pb.Add(a => a.Items, items);
8989
});

0 commit comments

Comments
 (0)