Skip to content

Commit 453e98d

Browse files
authored
feat(SelectCity): add SelectCity component (#6909)
* doc: 增加示例 * doc: 更正源码映射配置 * feat: 增加 Region 工程引用 * doc: 增加 SelectCity 菜单 * doc: 增加源码映射 * doc: 更新多语言 * revert: 移除项目依赖 * doc: 增加示例文档 * refactor: 增加多选变量 * refactor: 使用 null 代替空字符串
1 parent 6b16966 commit 453e98d

File tree

7 files changed

+72
-12
lines changed

7 files changed

+72
-12
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.0" />
69+
<PackageReference Include="BootstrapBlazor.Region" Version="9.0.1" />
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" />
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@page "/select-city"
2+
@inject IStringLocalizer<SelectCities> Localizer
3+
4+
<h3>@Localizer["CityTitle"]</h3>
5+
6+
<h4>@Localizer["CityDescription"]</h4>
7+
8+
<PackageTips Name="BootstrapBlazor.Region" />
9+
10+
<DemoBlock Title="@Localizer["CityNormalTitle"]"
11+
Introduction="@Localizer["CityNormalIntro"]"
12+
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>
20+
</DemoBlock>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
namespace BootstrapBlazor.Server.Components.Samples;
7+
8+
/// <summary>
9+
/// 城市选择器示例
10+
/// </summary>
11+
public partial class SelectCities
12+
{
13+
private string? _value = null;
14+
15+
private string? _multipleValues = null;
16+
}

src/BootstrapBlazor.Server/Extensions/MenusLocalizerExtensions.cs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// See the LICENSE file in the project root for more information.
44
// Maintainer: Argo Zhang([email protected]) Website: https://www.blazor.zone
55

6-
using Longbow.SerialPorts;
76
using Microsoft.AspNetCore.Components.Routing;
87

98
namespace BootstrapBlazor.Server.Extensions;
@@ -451,12 +450,6 @@ void AddForm(DemoMenuItem item)
451450
Url = "floating-label"
452451
},
453452
new()
454-
{
455-
IsNew = true,
456-
Text = Localizer["SelectRegion"],
457-
Url = "select-region"
458-
},
459-
new()
460453
{
461454
Text = Localizer["ListGroup"],
462455
Url = "list-group"
@@ -529,6 +522,18 @@ void AddForm(DemoMenuItem item)
529522
Url = "select"
530523
},
531524
new()
525+
{
526+
IsNew = true,
527+
Text = Localizer["SelectCity"],
528+
Url = "select-city"
529+
},
530+
new()
531+
{
532+
IsNew = true,
533+
Text = Localizer["SelectRegion"],
534+
Url = "select-region"
535+
},
536+
new()
532537
{
533538
Text = Localizer["SelectObject"],
534539
Url = "select-object"

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4873,7 +4873,8 @@
48734873
"Navbar": "Navbar",
48744874
"TaskDashBoard": "TaskDashBoard",
48754875
"Dom2ImageService": "IDom2HtmlService",
4876-
"SelectRegion": "Region Selector"
4876+
"SelectRegion": "Region Selector",
4877+
"SelectCity": "City Selector"
48774878
},
48784879
"BootstrapBlazor.Server.Components.Samples.Table.TablesHeader": {
48794880
"TablesHeaderTitle": "Header grouping function",
@@ -7227,5 +7228,13 @@
72277228
"RegionDescription": "A simple region cascade selector, provide 4 levels Chinese administrative division data",
72287229
"RegionNormalTitle": "Basic usage",
72297230
"RegionNormalIntro": "Use grouping to switch the selection mode for displaying administrative areas"
7231+
},
7232+
"BootstrapBlazor.Server.Components.Samples.SelectCities": {
7233+
"CityTitle": "City Selector",
7234+
"CityDescription": "Provides a city selector classified by province",
7235+
"CityNormalTitle": "Basic usage",
7236+
"CityNormalIntro": "Select a city from the drop-down box",
7237+
"CityMultipleTitle": "Multiple",
7238+
"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."
72307239
}
72317240
}

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4873,7 +4873,8 @@
48734873
"Navbar": "导航栏 Navbar",
48744874
"TaskDashBoard": "任务管理器 TaskDashBoard",
48754875
"Dom2ImageService": "节点转图片服务 IDom2HtmlService",
4876-
"SelectRegion": "行政区域选择器 SelectRegion"
4876+
"SelectRegion": "行政区域选择器 SelectRegion",
4877+
"SelectCity": "城市选择器 SelectCity"
48774878
},
48784879
"BootstrapBlazor.Server.Components.Samples.Table.TablesHeader": {
48794880
"TablesHeaderTitle": "表头分组功能",
@@ -7223,9 +7224,17 @@
72237224
"Dom2ImageFullText": "长截图"
72247225
},
72257226
"BootstrapBlazor.Server.Components.Samples.SelectRegions": {
7226-
"RegionTitle": "Region 行政区域选择器",
7227+
"RegionTitle": "SelectRegion 行政区域选择器",
72277228
"RegionDescription": "提供 4 级行政区划选择器",
72287229
"RegionNormalTitle": "基本用法",
72297230
"RegionNormalIntro": "使用分组切换显示行政区域的选择模式"
7231+
},
7232+
"BootstrapBlazor.Server.Components.Samples.SelectCities": {
7233+
"CityTitle": "SelectCity 城市选择器",
7234+
"CityDescription": "提供以省分类的城市选择器",
7235+
"CityNormalTitle": "基本用法",
7236+
"CityNormalIntro": "通过下拉框的形式选择城市",
7237+
"CityMultipleTitle": "多选",
7238+
"CityMultipleIntro": "通过设置 <code>IsMultiple</code> 开启多选模式,点击弹窗中省份时自动选中所有城市"
72307239
}
72317240
}

src/BootstrapBlazor.Server/docs.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,8 @@
256256
"task-board": "TaskBoard",
257257
"modbus-factory": "Modbus\\ModbusFactories",
258258
"serial-port-factory": "SerialPorts\\SerialPortFactories",
259-
"select-region": "Regions"
259+
"select-region": "SelectRegions",
260+
"select-city": "SelectCities"
260261
},
261262
"video": {
262263
"table": "BV1ap4y1x7Qn?p=1",

0 commit comments

Comments
 (0)