Skip to content

Commit 30997f9

Browse files
ArgoZhangAiYuZhen
andcommitted
Merge branch 'main' into Feat_RequiredValidator
# Conflicts: # src/BootstrapBlazor/BootstrapBlazor.csproj Co-Authored-By: AiZhen <[email protected]>
2 parents 7fdb501 + 8080408 commit 30997f9

32 files changed

+917
-1282
lines changed

src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
<PackageReference Include="BootstrapBlazor.Markdown" Version="9.0.0" />
4747
<PackageReference Include="BootstrapBlazor.MaterialDesign" Version="9.0.0" />
4848
<PackageReference Include="BootstrapBlazor.MaterialDesign.Extensions" Version="9.0.0" />
49-
<PackageReference Include="BootstrapBlazor.MeiliSearch" Version="9.1.3" />
49+
<PackageReference Include="BootstrapBlazor.MeiliSearch" Version="9.1.4" />
5050
<PackageReference Include="BootstrapBlazor.Mermaid" Version="9.0.3" />
5151
<PackageReference Include="BootstrapBlazor.MindMap" Version="9.0.0" />
5252
<PackageReference Include="BootstrapBlazor.MouseFollower" Version="9.0.1" />

src/BootstrapBlazor.Server/Components/Layout/BaseLayout.razor.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
box-shadow: var(--bb-layout-button-shadow);
44
transition: opacity .3s linear;
55
position: fixed;
6-
z-index: 45;
6+
z-index: 1001;
77
}
88

99
::deep .btn-fade:hover {

src/BootstrapBlazor.Server/Components/Pages/Coms.razor

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
<div class="coms-search">
55
<div class="row">
66
<div class="col-12">
7-
<Search PlaceHolder="@Localizer["Search"]" IsOnInputTrigger="true" IsAutoFocus="true"
8-
Items="@ComponentItems" IsLikeMatch="true" IgnoreCase="true" OnSearch="@OnSearch"></Search>
7+
<Search @bind-Value="@SearchText" PlaceHolder="@Localizer["Search"]" IsTriggerSearchByInput="true" IsAutoFocus="true" OnSearch="@OnSearch"></Search>
98
</div>
109
</div>
1110
<div class="coms-search-filter">

src/BootstrapBlazor.Server/Components/Pages/Coms.razor.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,17 @@
66
namespace BootstrapBlazor.Server.Components.Pages;
77

88
/// <summary>
9-
///
9+
/// Coms 组件
1010
/// </summary>
1111
public sealed partial class Coms
1212
{
1313
private List<string> ComponentItems { get; } = [];
1414

1515
private string? SearchText { get; set; }
1616

17-
private Task OnSearch(string searchText)
17+
private Task<IEnumerable<string?>> OnSearch(string searchText)
1818
{
1919
SearchText = searchText;
20-
21-
StateHasChanged();
22-
return Task.CompletedTask;
20+
return Task.FromResult<IEnumerable<string?>>(ComponentItems.Where(i => i.Contains(searchText, StringComparison.OrdinalIgnoreCase)).ToList());
2321
}
2422
}

src/BootstrapBlazor.Server/Components/Samples/AutoCompletes.razor

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,35 @@
66
<h4>@Localizer["Description"]</h4>
77

88
<DemoBlock Title="@Localizer["Block1Title"]" Introduction="@Localizer["Block1Intro"]" Name="Normal">
9-
<p>@Localizer["NormalDescription"]</p>
10-
9+
<section ignore>@Localizer["NormalDescription"]</section>
1110
<div style="width: 200px;">
1211
<AutoComplete Items="@StaticItems" IsSelectAllTextOnFocus="true" />
1312
</div>
1413
</DemoBlock>
1514

1615
<DemoBlock Title="@Localizer["Block2Title"]" Introduction="@Localizer["Block2Intro"]" Name="LikeMatch">
17-
<p>@Localizer["LikeMatchDescription"]</p>
18-
16+
<section ignore>@Localizer["LikeMatchDescription"]</section>
1917
<div style="width: 200px;">
2018
<AutoComplete Items="@StaticItems" IsLikeMatch="true" IgnoreCase="false" />
2119
</div>
2220
</DemoBlock>
2321

2422
<DemoBlock Title="@Localizer["Block3Title"]" Introduction="@Localizer["Block3Intro"]" Name="NoDataTip">
25-
<p>@((MarkupString)Localizer["NoDataTipDescription"].Value)</p>
26-
23+
<section ignore>@((MarkupString)Localizer["NoDataTipDescription"].Value)</section>
2724
<div style="width: 200px;">
2825
<AutoComplete Items="@StaticItems" NoDataTip="@Localizer["NoDataTip"]" />
2926
</div>
3027
</DemoBlock>
3128

3229
<DemoBlock Title="@Localizer["Block4Title"]" Introduction="@Localizer["Block4Intro"]" Name="ValueChanged">
33-
<p>@Localizer["ValueChangedDescription"]</p>
34-
30+
<section ignore>@Localizer["ValueChangedDescription"]</section>
3531
<div style="width: 200px;">
3632
<AutoComplete Items="@Items" ValueChanged="@OnValueChanged" />
3733
</div>
3834
</DemoBlock>
3935

4036
<DemoBlock Title="@Localizer["Block5Title"]" Introduction="@Localizer["Block5Intro"]" Name="ShowLabel">
41-
<p>@((MarkupString)Localizer["ShowLabelDescription"].Value)</p>
42-
37+
<section ignore>@((MarkupString)Localizer["ShowLabelDescription"].Value)</section>
4338
<Divider Text="@Localizer["Divider1Text"]" Alignment="Alignment.Left" style="margin: 2rem 0;"></Divider>
4439
<ValidateForm Model="@Model">
4540
<AutoComplete Items="@StaticItems" @bind-Value="@Model.Name" ShowLabel="true" />
@@ -51,15 +46,17 @@
5146
</DemoBlock>
5247

5348
<DemoBlock Title="@Localizer["DebounceTitle"]" Introduction="@Localizer["DebounceIntro"]" Name="Debounce">
54-
<p>@Localizer["DebounceDescription"]</p>
49+
<section ignore>@Localizer["DebounceDescription"]</section>
5550
<div style="width: 200px;">
5651
<AutoComplete Items="@Items" ValueChanged="@OnValueChanged" Debounce="500" />
5752
</div>
5853
</DemoBlock>
5954

6055
<DemoBlock Title="@Localizer["OnSelectedItemChangedTitle"]" Introduction="@Localizer["OnSelectedItemChangedIntro"]" Name="OnSelectedItemChanged">
6156
<AutoComplete Items="@StaticItems" OnSelectedItemChanged="OnSelectedItemChanged" Debounce="500"></AutoComplete>
62-
<ConsoleLogger @ref="Logger" />
57+
<section ignore>
58+
<ConsoleLogger @ref="Logger" />
59+
</section>
6360
</DemoBlock>
6461

6562
<DemoBlock Title="@Localizer["ItemTemplateTitle"]" Introduction="@Localizer["ItemTemplateIntro"]" Name="ItemTemplate">
@@ -98,4 +95,10 @@
9895
<ConsoleLogger @ref="GroupLogger" />
9996
</DemoBlock>
10097

98+
<DemoBlock Title="@Localizer["PopoverTitle"]"
99+
Introduction="@Localizer["PopoverIntro"]"
100+
Name="Popover">
101+
<AutoComplete Items="@StaticItems" IsPopover="true"></AutoComplete>
102+
</DemoBlock>
103+
101104
<AttributeTable Items="@GetAttributes()" />

src/BootstrapBlazor.Server/Components/Samples/AutoCompletes.razor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace BootstrapBlazor.Server.Components.Samples;
77

88
/// <summary>
9-
///
9+
/// AutoComplete 组件示例
1010
/// </summary>
1111
public sealed partial class AutoCompletes
1212
{

src/BootstrapBlazor.Server/Components/Samples/AutoFills.razor

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66
<h4>@Localizer["Description"]</h4>
77

88
<DemoBlock Title="@Localizer["NormalTitle"]" Introduction="@Localizer["NormalIntro"]" Name="Normal">
9-
<div class="mb-3">
9+
<section ignore>
1010
@((MarkupString)@Localizer["NormalDesc"].Value)
11-
</div>
12-
<AutoFill TValue="Foo" Value="Model" Items="Items" IsLikeMatch="true" OnSelectedItemChanged="OnSelectedItemChanged"
13-
OnGetDisplayText="OnGetDisplayText" class="mb-3" IsSelectAllTextOnFocus="true">
14-
<Template>
11+
</section>
12+
<AutoFill @bind-Value="Model1" Items="Items1" IsLikeMatch="true" OnGetDisplayText="OnGetDisplayText" class="mb-3" IsSelectAllTextOnFocus="true">
13+
<ItemTemplate>
1514
<div class="d-flex">
1615
<div>
1716
<img src="@WebsiteOption.CurrentValue.GetAvatarUrl(context.Id)" class="bb-avatar" />
@@ -21,17 +20,19 @@
2120
<div class="bb-sub">@Foo.GetTitle(context.Id)</div>
2221
</div>
2322
</div>
24-
</Template>
23+
</ItemTemplate>
2524
</AutoFill>
26-
<img src="@WebsiteOption.CurrentValue.GetAvatarUrl(Model.Id)" class="shadow" style="width: 140px; margin-bottom: 1rem; border-radius: 6px;" />
27-
<EditorForm Model="@Model" RowType="RowType.Inline" ItemsPerRow="2" />
25+
<section ignore>
26+
<img src="@WebsiteOption.CurrentValue.GetAvatarUrl(Model1.Id)" class="shadow" style="width: 140px; margin-bottom: 1rem; border-radius: 6px;" />
27+
<EditorForm Model="@Model1" RowType="RowType.Inline" ItemsPerRow="2" />
28+
</section>
2829
</DemoBlock>
2930

3031
<DemoBlock Title="@Localizer["CustomFilterTitle"]" Introduction="@Localizer["CustomFilterIntro"]" Name="CustomFilter">
31-
<div class="mb-3">@((MarkupString)Localizer["CustomFilterDesc"].Value)</div>
32-
<AutoFill TValue="Foo" Value="Model" Items="Items" OnCustomFilter="OnCustomFilter"
33-
OnSelectedItemChanged="OnSelectedItemChanged" OnGetDisplayText="OnGetDisplayText" class="mb-3">
34-
<Template>
32+
<section ignore>@((MarkupString)Localizer["CustomFilterDesc"].Value)</section>
33+
<AutoFill @bind-Value="Model2" Items="Items2" OnCustomFilter="OnCustomFilter"
34+
OnGetDisplayText="OnGetDisplayText" class="mb-3">
35+
<ItemTemplate>
3536
<div class="d-flex">
3637
<div>
3738
<img src="@WebsiteOption.CurrentValue.GetAvatarUrl(context.Id)" class="bb-avatar" />
@@ -41,18 +42,19 @@
4142
<div class="bb-sub">@Foo.GetTitle(context.Id)</div>
4243
</div>
4344
</div>
44-
</Template>
45+
</ItemTemplate>
4546
</AutoFill>
46-
<EditorForm Model="@Model" RowType="RowType.Inline" ItemsPerRow="2" />
47+
<section ignore>
48+
<EditorForm Model="@Model2" RowType="RowType.Inline" ItemsPerRow="2" />
49+
</section>
4750
</DemoBlock>
4851

4952
<DemoBlock Title="@Localizer["ShowDropdownListOnFocusTitle"]" Introduction="@Localizer["ShowDropdownListOnFocusIntro"]" Name="ShowDropdownListOnFocus">
50-
<div class="mb-3">
53+
<section ignore>
5154
@((MarkupString)@Localizer["ShowDropdownListOnFocusDesc"].Value)
52-
</div>
53-
<AutoFill TValue="Foo" Value="Model" Items="Items" ShowDropdownListOnFocus="false"
54-
OnGetDisplayText="OnGetDisplayText" class="mb-3">
55-
<Template>
55+
</section>
56+
<AutoFill @bind-Value="Model3" Items="Items3" ShowDropdownListOnFocus="false" OnGetDisplayText="OnGetDisplayText" class="mb-3">
57+
<ItemTemplate>
5658
<div class="d-flex">
5759
<div>
5860
<img src="@WebsiteOption.CurrentValue.GetAvatarUrl(context.Id)" class="bb-avatar" />
@@ -62,9 +64,11 @@
6264
<div class="bb-sub">@Foo.GetTitle(context.Id)</div>
6365
</div>
6466
</div>
65-
</Template>
67+
</ItemTemplate>
6668
</AutoFill>
67-
<EditorForm Model="@Model" RowType="RowType.Inline" ItemsPerRow="2" />
69+
<section ignore>
70+
<EditorForm Model="@Model3" RowType="RowType.Inline" ItemsPerRow="2" />
71+
</section>
6872
</DemoBlock>
6973

7074
<AttributeTable Items="@GetAttributes()" />

src/BootstrapBlazor.Server/Components/Samples/AutoFills.razor.cs

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,23 @@ namespace BootstrapBlazor.Server.Components.Samples;
1111
partial class AutoFills
1212
{
1313
[NotNull]
14-
private Foo Model { get; set; } = new();
14+
private Foo Model1 { get; set; } = new();
1515

16-
private Task OnSelectedItemChanged(Foo foo)
17-
{
18-
Model = Utility.Clone(foo);
19-
StateHasChanged();
20-
return Task.CompletedTask;
21-
}
16+
[NotNull]
17+
private Foo Model2 { get; set; } = new();
18+
[NotNull]
19+
private Foo Model3 { get; set; } = new();
2220

2321
private static string OnGetDisplayText(Foo foo) => foo.Name ?? "";
2422

2523
[NotNull]
26-
private IEnumerable<Foo>? Items { get; set; }
24+
private IEnumerable<Foo>? Items1 { get; set; }
25+
26+
[NotNull]
27+
private IEnumerable<Foo>? Items2 { get; set; }
28+
29+
[NotNull]
30+
private IEnumerable<Foo>? Items3 { get; set; }
2731

2832
[Inject]
2933
[NotNull]
@@ -34,13 +38,19 @@ protected override void OnInitialized()
3438
{
3539
base.OnInitialized();
3640

37-
Items = Foo.GenerateFoo(LocalizerFoo);
38-
Model = Items.First();
41+
Items1 = Foo.GenerateFoo(LocalizerFoo);
42+
Model1 = Items1.First();
43+
44+
Items2 = Foo.GenerateFoo(LocalizerFoo);
45+
Model2 = Items2.First();
46+
47+
Items3 = Foo.GenerateFoo(LocalizerFoo);
48+
Model3 = Items3.First();
3949
}
4050

4151
private Task<IEnumerable<Foo>> OnCustomFilter(string searchText)
4252
{
43-
var items = string.IsNullOrEmpty(searchText) ? Items : Items.Where(i => i.Count > 50 && i.Name!.Contains(searchText));
53+
var items = string.IsNullOrEmpty(searchText) ? Items2 : Items2.Where(i => i.Count > 50 && i.Name!.Contains(searchText));
4454
return Task.FromResult(items);
4555
}
4656

@@ -122,14 +132,14 @@ private AttributeItem[] GetAttributes() =>
122132
ValueList = " — ",
123133
DefaultValue = " — "
124134
},
125-
new()
126-
{
127-
Name = nameof(AutoFill<Foo>.ShowDropdownListOnFocus),
128-
Description = Localizer["Att10"],
129-
Type = "bool",
130-
ValueList = "true/false",
131-
DefaultValue = "true"
132-
},
135+
//new()
136+
//{
137+
// Name = nameof(AutoFill<Foo>.ShowDropdownListOnFocus),
138+
// Description = Localizer["Att10"],
139+
// Type = "bool",
140+
// ValueList = "true/false",
141+
// DefaultValue = "true"
142+
//},
133143
new()
134144
{
135145
Name = "Template",

src/BootstrapBlazor.Server/Components/Samples/InputGroups.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
<BootstrapInputGroup>
9090
<BootstrapInputGroupLabel DisplayText="AutoFill" />
9191
<AutoFill TValue="Foo" Items="AufoFillItems" IsLikeMatch="true" OnGetDisplayText="@(foo => foo.Name ?? "")">
92-
<Template>
92+
<ItemTemplate>
9393
<div class="d-flex">
9494
<div>
9595
<img src="@WebsiteOption.CurrentValue.GetAvatarUrl(context.Id)" class="bb-avatar" />
@@ -99,7 +99,7 @@
9999
<div class="bb-sub">@Foo.GetTitle(context.Id)</div>
100100
</div>
101101
</div>
102-
</Template>
102+
</ItemTemplate>
103103
</AutoFill>
104104
</BootstrapInputGroup>
105105
</div>

0 commit comments

Comments
 (0)