Skip to content

Commit e6d3a6a

Browse files
authored
feat(TreeView): add OverscanCount parameter (#5673)
* test: 更新单元测试 * feat(TreeView): 增加 OverscanCount 支持 * doc: 更新默认值 * chore: bump version 9.4.10
1 parent acb3c9e commit e6d3a6a

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

src/BootstrapBlazor/BootstrapBlazor.csproj

Lines changed: 1 addition & 1 deletion
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.5.0-beta09</Version>
4+
<Version>9.4.10</Version>
55
</PropertyGroup>
66

77
<ItemGroup>

src/BootstrapBlazor/Components/TreeView/TreeView.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ else
4747
@if (IsVirtualize)
4848
{
4949
<div class="tree-root scroll is-virtual" tabindex="0">
50-
<Virtualize ItemSize="RowHeight" OverscanCount="10" Items="@Rows">
50+
<Virtualize ItemSize="RowHeight" OverscanCount="OverscanCount" Items="@Rows">
5151
@RenderRow(context)
5252
</Virtualize>
5353
</div>

src/BootstrapBlazor/Components/TreeView/TreeView.razor.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,18 @@ public partial class TreeView<TItem> : IModelEqualityComparer<TItem>
218218
public bool IsVirtualize { get; set; }
219219

220220
/// <summary>
221-
/// Gets or sets the row height for virtual scrolling. Default is 38.
221+
/// Gets or sets the row height for virtual scrolling. Default is 29f.
222222
/// </summary>
223-
/// <remarks>Effective when <see cref="ScrollMode"/> is set to Virtual.</remarks>
223+
/// <remarks>Effective when <see cref="IsVirtualize"/> is set to true.</remarks>
224224
[Parameter]
225-
public float RowHeight { get; set; } = 38f;
225+
public float RowHeight { get; set; } = 29f;
226+
227+
/// <summary>
228+
/// Gets or sets the overscan count for virtual scrolling. Default is 10.
229+
/// </summary>
230+
/// <remarks>Effective when <see cref="IsVirtualize"/> is set to true.</remarks>
231+
[Parameter]
232+
public int OverscanCount { get; set; } = 10;
226233

227234
/// <summary>
228235
/// Gets or sets the toolbar content template. Default is null.

test/UnitTest/Components/TimerTest.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,12 @@ public async Task OnCancel_Ok()
132132
var downs = cut.FindAll(".time-spinner-arrow.fa-angle-down");
133133
await cut.InvokeAsync(() => downs[0].Click());
134134
await cut.InvokeAsync(() => cut.Find(".time-panel-btn.confirm").Click());
135-
await Task.Delay(1000);
136-
var buttons = cut.FindAll(".timer-buttons button");
135+
137136
// pause
137+
var buttons = cut.FindAll(".timer-buttons button");
138138
Assert.True(buttons[1].ClassList.Contains("btn-warning"));
139139
Assert.Equal("暂停", buttons[1].GetInnerText());
140140
await cut.InvokeAsync(() => buttons[1].Click());
141-
await Task.Delay(500);
142141

143142
// resume
144143
buttons = cut.FindAll(".timer-buttons button");
@@ -156,6 +155,5 @@ public async Task OnCancel_Ok()
156155
downs = cut.FindAll(".time-spinner-arrow.fa-angle-down");
157156
await cut.InvokeAsync(() => downs[0].Click());
158157
await cut.InvokeAsync(() => cut.Find(".time-panel-btn.confirm").Click());
159-
await Task.Delay(1000);
160158
}
161159
}

0 commit comments

Comments
 (0)