Skip to content

Commit 5654794

Browse files
authored
feat(SelectCity): add ShowSearch parameter (#6933)
* feat: 增加 shownCallback 回调 * chore: 更新解决方案 * doc: 更新源代码片段 * doc: 增加示例 * doc: 更新多语言 * chore: bump version 9.0.4
1 parent 33a6a01 commit 5654794

File tree

7 files changed

+46
-19
lines changed

7 files changed

+46
-19
lines changed

src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
<PackageReference Include="BootstrapBlazor.PdfViewer" Version="9.0.6" />
6767
<PackageReference Include="BootstrapBlazor.Player" Version="9.0.2" />
6868
<PackageReference Include="BootstrapBlazor.RDKit" Version="9.0.2" />
69-
<PackageReference Include="BootstrapBlazor.Region" Version="9.0.3" />
69+
<PackageReference Include="BootstrapBlazor.Region" Version="9.0.4" />
7070
<PackageReference Include="BootstrapBlazor.SignaturePad" Version="9.0.1" />
7171
<PackageReference Include="BootstrapBlazor.SmilesDrawer" Version="9.0.2" />
7272
<PackageReference Include="BootstrapBlazor.Sortable" Version="9.0.3" />

src/BootstrapBlazor.Server/Components/Samples/OtpInputs.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<DemoBlock Title="@Localizer["OtpInputsNormalTitle"]"
3232
Introduction="@Localizer["OtpInputsNormalIntro"]"
3333
Name="Normal">
34-
<div class="row g-3 mb-3">
34+
<section ignore class="row g-3 mb-3">
3535
<div class="col-12 col-sm-6">
3636
<BootstrapInputGroup>
3737
<BootstrapInputGroupLabel DisplayText="Type"></BootstrapInputGroupLabel>
@@ -56,7 +56,7 @@
5656
<Switch @bind-Value="@_disabled"></Switch>
5757
</BootstrapInputGroup>
5858
</div>
59-
</div>
59+
</section>
6060
<OtpInput Value="@_value" Type="_otpInputType" PlaceHolder="@_placeHolder" IsReadonly="_readonly" IsDisabled="_disabled"></OtpInput>
6161
</DemoBlock>
6262

src/BootstrapBlazor.Server/Components/Samples/SelectCities.razor

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,31 @@
1010
<DemoBlock Title="@Localizer["CityNormalTitle"]"
1111
Introduction="@Localizer["CityNormalIntro"]"
1212
Name="Normal">
13-
<SelectCity Value="@_value"></SelectCity>
14-
</DemoBlock>
15-
16-
<DemoBlock Title="@Localizer["CityMultipleTitle"]"
17-
Introduction="@Localizer["CityMultipleIntro"]"
18-
Name="IsMultiple">
19-
<SelectCity IsMultiple="true" Value="@_multipleValues"></SelectCity>
13+
<div class="row g-3 mb-3">
14+
<div class="col-12 col-sm-6">
15+
<BootstrapInputGroup>
16+
<BootstrapInputGroupLabel DisplayText="ShowSearch"></BootstrapInputGroupLabel>
17+
<Switch @bind-Value="_showSearch"></Switch>
18+
</BootstrapInputGroup>
19+
</div>
20+
<div class="col-12 col-sm-6">
21+
<BootstrapInputGroup>
22+
<BootstrapInputGroupLabel DisplayText="AutoClose"></BootstrapInputGroupLabel>
23+
<Switch @bind-Value="_autoClose"></Switch>
24+
</BootstrapInputGroup>
25+
</div>
26+
<div class="col-12 col-sm-6">
27+
<BootstrapInputGroup>
28+
<BootstrapInputGroupLabel DisplayText="IsMultiple"></BootstrapInputGroupLabel>
29+
<Switch @bind-Value="@_isMultiple"></Switch>
30+
</BootstrapInputGroup>
31+
</div>
32+
<div class="col-12 col-sm-6">
33+
<BootstrapInputGroup>
34+
<BootstrapInputGroupLabel DisplayText="IsDisabled"></BootstrapInputGroupLabel>
35+
<Switch @bind-Value="@_isDisabled"></Switch>
36+
</BootstrapInputGroup>
37+
</div>
38+
</div>
39+
<SelectCity Value="@_value" ShowSearch="_showSearch" IsMultiple="_isMultiple" IsDisabled="_isDisabled" AutoClose="_autoClose"></SelectCity>
2040
</DemoBlock>

src/BootstrapBlazor.Server/Components/Samples/SelectCities.razor.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,11 @@ public partial class SelectCities
1212
{
1313
private string? _value = null;
1414

15-
private string? _multipleValues = null;
15+
private bool _showSearch = true;
16+
17+
private bool _isMultiple = false;
18+
19+
private bool _isDisabled = false;
20+
21+
private bool _autoClose = true;
1622
}

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7234,9 +7234,7 @@
72347234
"CityTitle": "City Selector",
72357235
"CityDescription": "Provides a city selector classified by province",
72367236
"CityNormalTitle": "Basic usage",
7237-
"CityNormalIntro": "Select a city from the drop-down box",
7238-
"CityMultipleTitle": "Multiple",
7239-
"CityMultipleIntro": "Enable multiple selection mode by setting <code>IsMultiple</code> , and all cities will be automatically selected when clicking a province in the pop-up window."
7237+
"CityNormalIntro": "Select a city from the drop-down box"
72407238
},
72417239
"BootstrapBlazor.Server.Components.Samples.SelectProvinces": {
72427240
"ProvinceTitle": "Province Selector",

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7234,9 +7234,7 @@
72347234
"CityTitle": "SelectCity 城市选择器",
72357235
"CityDescription": "提供以省分类的城市选择器",
72367236
"CityNormalTitle": "基本用法",
7237-
"CityNormalIntro": "通过下拉框的形式选择城市",
7238-
"CityMultipleTitle": "多选",
7239-
"CityMultipleIntro": "通过设置 <code>IsMultiple</code> 开启多选模式,点击弹窗中省份时自动选中所有城市"
7237+
"CityNormalIntro": "通过下拉框的形式选择城市"
72407238
},
72417239
"BootstrapBlazor.Server.Components.Samples.SelectProvinces": {
72427240
"ProvinceTitle": "SelectProvince 省选择器",

src/BootstrapBlazor/wwwroot/modules/base-popover.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ const Popover = {
1515
return isDisabled(el) || isDisabled(el.parentNode) || isDisabled(el.querySelector('.form-control'))
1616
},
1717
initCallback: null,
18-
hideCallback: null
18+
hideCallback: null,
19+
shownCallback: null
1920
},
2021
...(config || {})
2122
}
@@ -105,7 +106,11 @@ const Popover = {
105106
popover.hasDisplayNone = true;
106107
content.classList.remove("d-none")
107108
}
108-
body.append(content)
109+
body.append(content);
110+
111+
if (popover.shownCallback != null) {
112+
popover.shownCallback();
113+
}
109114
}
110115
}
111116

0 commit comments

Comments
 (0)