Skip to content

Commit 1fc97ce

Browse files
committed
Merge branch 'main' into test
2 parents 5e5ca0b + 809ede2 commit 1fc97ce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+527
-339
lines changed

.github/pull_request_template.md

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
11
## Link issues
22
fixes #{issue number}
3-
<!--
4-
[Please fill in the relevant Issue number after the # above, such as #42]
5-
[请在上方 # 后面填写相关 Issue 编号,如 #42]
6-
-->
3+
4+
<!--[Please fill in the relevant Issue number after the # above, such as #42]-->
5+
<!--[请在上方 # 后面填写相关 Issue 编号,如 #42]-->
6+
77
## Summary By Copilot
88

99

1010
## Regression?
1111
- [ ] Yes
1212
- [ ] No
1313

14-
<!--
15-
[If yes, specify the version the behavior has regressed from]
16-
[是否影响老版本]
17-
-->
14+
<!--[If yes, specify the version the behavior has regressed from]-->
15+
<!--[是否影响老版本]-->
16+
1817
## Risk
1918
- [ ] High
2019
- [ ] Medium
2120
- [ ] Low
2221

23-
<!--
24-
[Justify the selection above]
25-
-->
22+
<!--[Justify the selection above]-->
23+
2624
## Verification
2725
- [ ] Manual (required)
2826
- [ ] Automated

src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<PackageReference Include="BootstrapBlazor.FontAwesome" Version="9.0.2" />
3939
<PackageReference Include="BootstrapBlazor.Gantt" Version="9.0.2" />
4040
<PackageReference Include="BootstrapBlazor.Holiday" Version="9.0.1" />
41-
<PackageReference Include="BootstrapBlazor.Html2Image" Version="9.0.0" />
41+
<PackageReference Include="BootstrapBlazor.Html2Image" Version="9.0.2" />
4242
<PackageReference Include="BootstrapBlazor.Html2Pdf" Version="9.0.2" />
4343
<PackageReference Include="BootstrapBlazor.IconPark" Version="9.0.3" />
4444
<PackageReference Include="BootstrapBlazor.ImageCropper" Version="9.0.0" />
@@ -47,9 +47,9 @@
4747
<PackageReference Include="BootstrapBlazor.Live2DDisplay" Version="9.0.1" />
4848
<PackageReference Include="BootstrapBlazor.Markdown" Version="9.0.1" />
4949
<PackageReference Include="BootstrapBlazor.MaterialDesign" Version="9.0.1" />
50-
<PackageReference Include="BootstrapBlazor.MeiliSearch" Version="9.1.7" />
50+
<PackageReference Include="BootstrapBlazor.MeiliSearch" Version="9.1.9" />
5151
<PackageReference Include="BootstrapBlazor.Mermaid" Version="9.0.3" />
52-
<PackageReference Include="BootstrapBlazor.MindMap" Version="9.1.3" />
52+
<PackageReference Include="BootstrapBlazor.MindMap" Version="9.1.6" />
5353
<PackageReference Include="BootstrapBlazor.MouseFollower" Version="9.0.1" />
5454
<PackageReference Include="BootstrapBlazor.OctIcon" Version="9.0.4" />
5555
<PackageReference Include="BootstrapBlazor.OnScreenKeyboard" Version="9.0.1" />
@@ -65,7 +65,7 @@
6565
<PackageReference Include="BootstrapBlazor.TableExport" Version="9.2.1" />
6666
<PackageReference Include="BootstrapBlazor.Topology" Version="9.0.0" />
6767
<PackageReference Include="BootstrapBlazor.UniverIcon" Version="9.0.1" />
68-
<PackageReference Include="BootstrapBlazor.UniverSheet" Version="9.0.0-beta05" />
68+
<PackageReference Include="BootstrapBlazor.UniverSheet" Version="9.0.0-beta07" />
6969
<PackageReference Include="BootstrapBlazor.VideoPlayer" Version="9.0.3" />
7070
<PackageReference Include="BootstrapBlazor.WinBox" Version="9.0.7" />
7171
</ItemGroup>

src/BootstrapBlazor.Server/Components/Components/Header.razor

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
<li class="nav-item">
2121
<a class="nav-link" href="tutorials">@TutorialsText</a>
2222
</li>
23-
@if (CultureInfo.CurrentUICulture.Name == "zh-CN")
23+
@* @if (CultureInfo.CurrentUICulture.Name == "zh-CN")
2424
{
2525
<li class="nav-item">
2626
<a class="nav-link" href="https://theme.blazor.zone">主题</a>
2727
</li>
28-
}
28+
} *@
2929
</ul>
3030
</div>
3131
<div class="d-flex flex-fill"></div>

src/BootstrapBlazor.Server/Components/Components/ThemeMode.razor.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getTheme, switchTheme } from "../../_content/BootstrapBlazor/modules/utility.js"
1+
import { getTheme, switchTheme, calcCenterPosition } from "../../_content/BootstrapBlazor/modules/utility.js"
22
import EventHandler from "../../_content/BootstrapBlazor/modules/event-handler.js"
33

44
export function init(id) {
@@ -12,7 +12,9 @@ export function init(id) {
1212
else {
1313
theme = 'dark';
1414
}
15-
switchTheme(theme, window.innerWidth, window.innerHeight);
15+
16+
const rect = calcCenterPosition(el);
17+
switchTheme(theme, rect.x, rect.y);
1618
});
1719
}
1820
}

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

+2
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@
66

77
main {
88
min-height: calc(100vh - var(--bs-header-height));
9+
position: relative;
10+
z-index: 10;
911
}

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

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
.main {
66
padding: var(--bb-main-pading);
7+
position: relative;
8+
z-index: 5;
79
}
810

911
.sidebar-title {

src/BootstrapBlazor.Server/Components/Layout/TutorialsNavMenu.razor.cs

+5
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ protected override async Task OnInitializedAsync()
110110
{
111111
Text = Localizer["OnlineSheet"],
112112
Url = "tutorials/online-sheet",
113+
},
114+
new()
115+
{
116+
Text = Localizer["MemorialMode"],
117+
Url = "tutorials/memorial",
113118
}
114119
]);
115120
}

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
<div class="coms-search">
55
<div class="row">
66
<div class="col-12">
7-
<Search @bind-Value="@SearchText" PlaceHolder="@Localizer["Search"]" OnSearch="@OnSearch" ShowClearButton="true"></Search>
7+
<Search @bind-Value="@SearchText" PlaceHolder="@Localizer["Search"]"
8+
OnSearch="@OnSearch" OnClear="OnClear" ShowClearButton="true"></Search>
89
</div>
910
</div>
1011
<div class="coms-search-filter">

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

+7
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,11 @@ public sealed partial class Coms
1919
SearchText = searchText;
2020
return Task.FromResult<IEnumerable<string?>>(ComponentItems.Where(i => i.Contains(searchText, StringComparison.OrdinalIgnoreCase)).ToList());
2121
}
22+
23+
private Task OnClear(string searchText)
24+
{
25+
SearchText = "";
26+
StateHasChanged();
27+
return Task.CompletedTask;
28+
}
2229
}

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

-24
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,4 @@
2424
<p class="code-label">@Localizer["P7"]</p>
2525
<Pre>dotnet new uninstall Bootstrap.Blazor.Templates</Pre>
2626

27-
<h4>@Localizer["SubTitle1"]</h4>
28-
29-
<p>@((MarkupString)Localizer["P8"].Value)</p>
30-
31-
<p class="code-label">1. @Localizer["P9"]</p>
32-
33-
<p>@Localizer["P10"] <b>Visual Studio @Localizer["P11"]</b> @Localizer["P12"] <b>@Localizer["P13"]</b> <a href="https://marketplace.visualstudio.com/items?itemName=Longbow.BootstrapBlazorUITemplate" target="_blank">[@Localizer["P14"]]</a> @Localizer["P15"] <a href="@TemplateUrl" target="_blank">[@Localizer["P16"]]</a></p>
34-
35-
<img src="@WebsiteOption.CurrentValue.GetAssetUrl("images/search-extensions.png")" style="width: 800px; border-radius: 6px;" class="d-none d-sm-block mb-3" />
36-
37-
<img src="@WebsiteOption.CurrentValue.GetAssetUrl("images/download-extensions.png")" style="width: 800px; border-radius: 6px;" class="d-none d-sm-block mb-3" />
38-
39-
<p class="code-label">2. @Localizer["P17"]</p>
40-
41-
<img src="@WebsiteOption.CurrentValue.GetAssetUrl("images/install-extensions.png")" style="width: auto; border-radius: 6px;" class="d-none d-sm-block mb-3" />
42-
43-
<img src="@WebsiteOption.CurrentValue.GetAssetUrl("images/install-finish.png")" style="width: auto; border-radius: 6px;" class="d-none d-sm-block mb-3" />
44-
45-
<p class="code-label">3. @Localizer["P18"]</p>
46-
47-
<img src="@WebsiteOption.CurrentValue.GetAssetUrl("images/create-project.png")" style="width: 800px; border-radius: 6px;" class="d-none d-sm-block mb-3" />
48-
49-
<img src="@WebsiteOption.CurrentValue.GetAssetUrl("images/project.png")" style="width: 400px; border-radius: 6px;" class="d-none d-sm-block mb-3" />
50-
5127
<Video Name="template" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@page "/tutorials/memorial"
2+
3+
<Button Text="切换哀悼模式" OnClick="OnToggle" class="mb-3"></Button>
4+
5+
<p class="code-label">1. 加载 <code>Utlity</code> 工具</p>
6+
<Pre>var module = await JSRuntime.LoadUtility();</Pre>
7+
8+
<p class="code-label">2. 设置哀悼模式</p>
9+
<Pre>await module.InvokeVoidAsync("SetMemorial", true);</Pre>
10+
11+
<p class="code-label">3. 全站默认设置追悼模式方法</p>
12+
<p>更新 <code>App.razor</code> 文档内容如下</p>
13+
<Pre>&lt;html lang="en" data-bs-theme='dark' data-bb-theme="memorial"&gt;</Pre>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the Apache 2.0 License
3+
// See the LICENSE file in the project root for more information.
4+
// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone
5+
6+
using Microsoft.JSInterop;
7+
8+
namespace BootstrapBlazor.Server.Components.Samples.Tutorials;
9+
10+
/// <summary>
11+
/// 追悼模式
12+
/// </summary>
13+
public partial class Memorial
14+
{
15+
[Inject, NotNull]
16+
private IJSRuntime? JSRuntime { get; set; }
17+
18+
private bool _isMemorial = false;
19+
20+
private async Task OnToggle()
21+
{
22+
var module = await JSRuntime.LoadUtility();
23+
24+
_isMemorial = !_isMemorial;
25+
await module.SetMemorialModeAsync(_isMemorial);
26+
}
27+
}

src/BootstrapBlazor.Server/Locales/en-US.json

+3-14
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"TranslateSummary": "Translate",
2323
"DrawingSummary": "Drawing",
2424
"AdminSummary": "Admin",
25-
"OnlineSheet": "UniverSheet"
25+
"OnlineSheet": "UniverSheet",
26+
"MemorialMode": "Memorial"
2627
},
2728
"BootstrapBlazor.Server.Components.Components.Pre": {
2829
"LoadingText": "Loading ...",
@@ -1153,19 +1154,7 @@
11531154
"P4": "After the project is created, the <code>BootstrapBlazorApp</code> solution will be generated in the current folder, and the <code>src</code> directory contains <code>Server-Side</code> <code>Wasm</code> Both types of projects can be run directly with <kbd>F5</kbd>",
11541155
"P5": "3. Update project template",
11551156
"P6": "The dotnet new update option checks if there are updates available for the template packages that are currently installed and installs them.",
1156-
"P7": "3. Uninstall project template",
1157-
"SubTitle1": "Bootstrap Blazor App Extension",
1158-
"P8": "In order to facilitate the use of the <code>Bootstrap Blazor</code> component library, the author has created the <b>Project Template (<code>Bootstrap Blazor Project Template</code>)</b> extension plug-in, which can be installed through <code >Visual Studio IDE</code> When creating a new project, select the <code>Bootstrap Blazor project template</code>, and the solution is built in two types: <code>Server-Side</code> and <code>wasm</code> project",
1159-
"P9": "Download Project template",
1160-
"P10": "able to pass",
1161-
"P11": "Built-in plugin extensions",
1162-
"P12": "or",
1163-
"P13": "Microsoft Plug-in Marketplace",
1164-
"P14": "portal",
1165-
"P15": "Direct download; domestic access to the Microsoft plug-in market is relatively slow, you can access the code cloud connection",
1166-
"P16": "portal",
1167-
"P17": "Install Project template",
1168-
"P18": "Create Project"
1157+
"P7": "3. Uninstall project template"
11691158
},
11701159
"BootstrapBlazor.Server.Components.Pages.Globalization": {
11711160
"Title": "Globalization",

src/BootstrapBlazor.Server/Locales/zh-CN.json

+3-14
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"TranslateSummary": "翻译工具 Translate",
2323
"DrawingSummary": "画图 Drawing",
2424
"AdminSummary": "中台 Admin",
25-
"OnlineSheet": "在线表格 UniverSheet"
25+
"OnlineSheet": "在线表格 UniverSheet",
26+
"MemorialMode": "追悼模式"
2627
},
2728
"BootstrapBlazor.Server.Components.Components.Pre": {
2829
"LoadingText": "正在加载 ...",
@@ -1153,19 +1154,7 @@
11531154
"P4": "创建工程后在当前文件夹内会生成 <code>BootstrapBlazorApp</code> 解决方案,<code>src</code> 目录内包含 <code>Server-Side</code> <code>Wasm</code> 两种类型的工程,均可以直接 <kbd>F5</kbd> 运行",
11541155
"P5": "3. 更新项目模板",
11551156
"P6": "注:此命令为检查是否有可用于当前安装的模板包的更新并安装这些更新。",
1156-
"P7": "4. 卸载项目模板",
1157-
"SubTitle1": "Bootstrap Blazor App Extension 扩展插件",
1158-
"P8": "为了方便使用 <code>Bootstrap Blazor</code> 组件库,作者制作了 <b>项目模板(<code>Bootstrap Blazor Project Template</code>)</b> 扩展插件,安装此插件可通过 <code>Visual Studio</code> 新建项目时选择 <code>Bootstrap Blazor 项目模板</code>,解决方案内置 <code>Server-Side</code> 与 <code>wasm</code> 两种类型工程",
1159-
"P9": "下载项目模板",
1160-
"P10": "可以通过",
1161-
"P11": "内置插件扩展",
1162-
"P12": "或者",
1163-
"P13": "微软插件扩展市场",
1164-
"P14": "传送门",
1165-
"P15": "直接下载; 国内访问微软插件市场速度比较慢,可以访问码云连接",
1166-
"P16": "传送门",
1167-
"P17": "安装项目模板",
1168-
"P18": "创建项目"
1157+
"P7": "4. 卸载项目模板"
11691158
},
11701159
"BootstrapBlazor.Server.Components.Pages.Globalization": {
11711160
"Title": "全球化",

src/BootstrapBlazor/BootstrapBlazor.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>9.4.8</Version>
4+
<Version>9.4.9-beta03</Version>
55
</PropertyGroup>
66

77
<ItemGroup>

src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor

+10-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,14 @@
1616
placeholder="@PlaceHolder" disabled="@Disabled" @ref="FocusElement"/>
1717
<span class="form-select-append"><i class="@Icon"></i></span>
1818
<span class="form-select-append ac-loading"><i class="@LoadingIcon"></i></span>
19-
<ul class="dropdown-menu">
19+
<RenderTemplate @ref="_dropdown">
20+
@RenderDropdown
21+
</RenderTemplate>
22+
</div>
23+
24+
@code {
25+
RenderFragment RenderDropdown =>
26+
@<ul class="dropdown-menu">
2027
@foreach (var item in Rows)
2128
{
2229
<li @key="item" class="dropdown-item" @onclick="() => OnClickItem(item)">
@@ -34,5 +41,5 @@
3441
{
3542
<li class="dropdown-item">@NoDataTip</li>
3643
}
37-
</ul>
38-
</div>
44+
</ul>;
45+
}

src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.cs

+19-19
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ public partial class AutoComplete
8989

9090
private List<string>? _filterItems;
9191

92+
[NotNull]
93+
private RenderTemplate? _dropdown = default;
94+
9295
/// <summary>
9396
/// <inheritdoc/>
9497
/// </summary>
@@ -114,12 +117,21 @@ protected override void OnParametersSet()
114117
Items ??= [];
115118
}
116119

120+
private bool _render = true;
121+
122+
/// <summary>
123+
/// <inheritdoc/>
124+
/// </summary>
125+
/// <returns></returns>
126+
protected override bool ShouldRender() => _render;
127+
117128
/// <summary>
118129
/// Callback method when a candidate item is clicked
119130
/// </summary>
120131
private async Task OnClickItem(string val)
121132
{
122133
CurrentValue = val;
134+
123135
if (OnSelectedItemChanged != null)
124136
{
125137
await OnSelectedItemChanged(val);
@@ -135,9 +147,6 @@ private async Task OnClickItem(string val)
135147
[JSInvokable]
136148
public override async Task TriggerFilter(string val)
137149
{
138-
// Store the current input value to prevent it from being overwritten
139-
var currentInputValue = val;
140-
141150
if (OnCustomFilter != null)
142151
{
143152
var items = await OnCustomFilter(val);
@@ -161,14 +170,7 @@ public override async Task TriggerFilter(string val)
161170
_filterItems = [.. _filterItems.Take(DisplayCount.Value)];
162171
}
163172

164-
// Use currentInputValue here instead of potentially stale val
165-
CurrentValue = currentInputValue;
166-
167-
// Only trigger StateHasChanged if no binding is present
168-
if (!ValueChanged.HasDelegate)
169-
{
170-
StateHasChanged();
171-
}
173+
await TriggerChange(val);
172174
}
173175

174176
/// <summary>
@@ -178,16 +180,14 @@ public override async Task TriggerFilter(string val)
178180
[JSInvokable]
179181
public override Task TriggerChange(string val)
180182
{
181-
// Only update CurrentValue if the value has actually changed
182-
// This prevents overwriting the user's input
183-
if (CurrentValue != val)
183+
_render = false;
184+
CurrentValue = val;
185+
if (!ValueChanged.HasDelegate)
184186
{
185-
CurrentValue = val;
186-
if (!ValueChanged.HasDelegate)
187-
{
188-
StateHasChanged();
189-
}
187+
StateHasChanged();
190188
}
189+
_render = true;
190+
_dropdown.Render();
191191
return Task.CompletedTask;
192192
}
193193
}

0 commit comments

Comments
 (0)