Skip to content

Commit 40abd18

Browse files
committed
feat: 支持全局配置 IsPopover 参数
1 parent c875516 commit 40abd18

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

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
}

0 commit comments

Comments
 (0)