Skip to content

Commit 7c9cee0

Browse files
committed
refactor: 移动 _virtualizeElement 到基类
1 parent dc8186b commit 7c9cee0

File tree

5 files changed

+23
-8
lines changed

5 files changed

+23
-8
lines changed

src/BootstrapBlazor/Components/Select/MultiSelect.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@namespace BootstrapBlazor.Components
22
@using Microsoft.AspNetCore.Components.Web.Virtualization
33
@typeparam TValue
4-
@inherits SelectBase<TValue>
4+
@inherits SimpleSelectBase<TValue>
55
@attribute [BootstrapModuleAutoLoader("Select/MultiSelect.razor.js", JSObjectReference = true)]
66

77
@if (IsShowLabel)

src/BootstrapBlazor/Components/Select/MultiSelect.razor.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,6 @@ private List<SelectedItem> Rows
210210

211211
private string? ScrollIntoViewBehaviorString => ScrollIntoViewBehavior == ScrollIntoViewBehavior.Smooth ? null : ScrollIntoViewBehavior.ToDescriptionString();
212212

213-
[NotNull]
214-
private Virtualize<SelectedItem>? _virtualizeElement = default;
215-
216213
/// <summary>
217214
/// OnParametersSet 方法
218215
/// </summary>

src/BootstrapBlazor/Components/Select/Select.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@namespace BootstrapBlazor.Components
22
@using Microsoft.AspNetCore.Components.Web.Virtualization
33
@typeparam TValue
4-
@inherits SelectBase<TValue>
4+
@inherits SimpleSelectBase<TValue>
55
@attribute [BootstrapModuleAutoLoader(JSObjectReference = true)]
66

77
@if (IsShowLabel)

src/BootstrapBlazor/Components/Select/Select.razor.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,6 @@ public partial class Select<TValue> : ISelect, ILookup
176176
/// </summary>
177177
protected override string? RetrieveId() => InputId;
178178

179-
[NotNull]
180-
private Virtualize<SelectedItem>? _virtualizeElement = default;
181-
182179
private string? InputId => $"{Id}_input";
183180

184181
private string _lastSelectedValueString = string.Empty;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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([email protected]) Website: https://www.blazor.zone
5+
6+
using Microsoft.AspNetCore.Components.Web.Virtualization;
7+
8+
namespace BootstrapBlazor.Components;
9+
10+
/// <summary>
11+
/// SimpleSelectBase component base class
12+
/// </summary>
13+
/// <typeparam name="TValue"></typeparam>
14+
public class SimpleSelectBase<TValue> : SelectBase<TValue>
15+
{
16+
/// <summary>
17+
/// Gets virtualize component instrance
18+
/// </summary>
19+
[NotNull]
20+
protected Virtualize<SelectedItem>? _virtualizeElement = default;
21+
}

0 commit comments

Comments
 (0)