Skip to content

Commit b79bf37

Browse files
authored
feat(BootstrapBlazorOptions): add IsPopover parameter (#6862)
* feat: 增加 IsPopover 属性 * chore: 增加配置 * feat: 支持全局配置 IsPopover 参数 * doc: 更正单词拼写错误 * chore: 更新配置 * chore: bump version 9.11.2-beta02
1 parent b1ba61f commit b79bf37

File tree

7 files changed

+25
-2
lines changed

7 files changed

+25
-2
lines changed

src/BootstrapBlazor.Server/appsettings.Development.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
]
4646
},
4747
"BootstrapBlazorOptions": {
48+
"IsPopover": false,
4849
"ToastDelay": 4000,
4950
"MessageDelay": 4000,
5051
"SwalDelay": 4000,

src/BootstrapBlazor.Server/appsettings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"EnableLocalStorage": false
2424
},
2525
"BootstrapBlazorOptions": {
26+
"IsPopover": false,
2627
"ToastDelay": 4000,
2728
"MessageDelay": 4000,
2829
"SwalDelay": 4000,

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.11.2-beta01</Version>
4+
<Version>9.11.2-beta02</Version>
55
</PropertyGroup>
66

77
<ItemGroup>

src/BootstrapBlazor/Components/AutoComplete/PopoverCompleteBase.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ public abstract class PopoverCompleteBase<TValue> : BootstrapInputBase<TValue>,
104104
[NotNull]
105105
public string? ClearIcon { get; set; }
106106

107+
/// <summary>
108+
/// <see cref="BootstrapBlazorOptions"/> 配置类实例
109+
/// </summary>
110+
[Inject]
111+
[NotNull]
112+
protected IOptions<BootstrapBlazorOptions>? BootstrapBlazorOptions { get; set; }
113+
107114
/// <summary>
108115
/// 获得 是否跳过 ESC 按键字符串
109116
/// </summary>
@@ -171,6 +178,7 @@ protected override void OnParametersSet()
171178
ClearIcon ??= IconTheme.GetIconByKey(ComponentIcons.InputClearIcon);
172179

173180
Offset ??= "[0, 6]";
181+
IsPopover |= BootstrapBlazorOptions.Value.IsPopover;
174182
}
175183

176184
/// <summary>

src/BootstrapBlazor/Components/Select/PopoverSelectBase.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ public abstract class PopoverSelectBase<TValue> : PopoverDropdownBase<TValue>
2323
[Parameter]
2424
public string? Offset { get; set; }
2525

26+
/// <summary>
27+
/// <see cref="BootstrapBlazorOptions"/> 配置类实例
28+
/// </summary>
29+
[Inject]
30+
[NotNull]
31+
protected IOptions<BootstrapBlazorOptions>? BootstrapBlazorOptions { get; set; }
32+
2633
/// <summary>
2734
/// data-bs-toggle 值
2835
/// </summary>
@@ -41,5 +48,6 @@ protected override void OnParametersSet()
4148
base.OnParametersSet();
4249

4350
Offset ??= "[0, 10]";
51+
IsPopover |= BootstrapBlazorOptions.Value.IsPopover;
4452
}
4553
}

src/BootstrapBlazor/Components/Select/SimpleSelectBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace BootstrapBlazor.Components;
1414
public abstract class SimpleSelectBase<TValue> : SelectBase<TValue>
1515
{
1616
/// <summary>
17-
/// Gets virtualize component instrance
17+
/// Gets virtualize component instance
1818
/// </summary>
1919
[NotNull]
2020
protected Virtualize<SelectedItem>? _virtualizeElement = default;

src/BootstrapBlazor/Options/BootstrapBlazorOptions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ public class BootstrapBlazorOptions : IOptions<BootstrapBlazorOptions>
146146
/// </summary>
147147
public bool IsMemorialMode { get; set; }
148148

149+
/// <summary>
150+
/// 获得/设置 <see cref="Select{TValue}"/> 等组件是否将 <see cref="IsPopover"/> 参数默认值更改为 true 默认 false
151+
/// </summary>
152+
public bool IsPopover { get; set; }
153+
149154
BootstrapBlazorOptions IOptions<BootstrapBlazorOptions>.Value => this;
150155

151156
/// <summary>

0 commit comments

Comments
 (0)