Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
</ItemGroup>

<ItemGroup>
<Using Include="Microsoft.AspNetCore.Components" />
<Using Include="Microsoft.JSInterop" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@namespace BootstrapBlazor.Components
@inherits PopoverSelectBase<string>
@attribute [JSModuleAutoLoader("./_content/BootstrapBlazor.Region/Components/SelectRegion.razor.js", JSObjectReference = true)]
@attribute [JSModuleAutoLoader("./_content/BootstrapBlazor.Region/Components/SelectRegion.razor.js")]

@if (IsShowLabel)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Website: https://www.blazor.zone or https://argozhang.github.io/

using Microsoft.AspNetCore.Components;

namespace BootstrapBlazor.Components;

/// <summary>
Expand Down Expand Up @@ -177,11 +175,11 @@ private void ResetValue()

private async Task OnClearValue()
{
_provinceValue = "";
_cityValue = "";
_provinceValue = null;
_cityValue = null;
_countyValue = new();
_detailValue = "";
CurrentValue = "";
_detailValue = null;
CurrentValue = null;

_currentViewMode = RegionViewMode.Province;

Expand Down Expand Up @@ -226,6 +224,9 @@ private HashSet<string> GetDetails()
private void OnClickProvince(string value)
{
_provinceValue = value;
_cityValue = null;
_countyValue = new();
_detailValue = null;
_currentViewMode = RegionViewMode.City;

CurrentValue = _provinceValue;
Expand All @@ -234,6 +235,8 @@ private void OnClickProvince(string value)
private void OnClickCity(string value)
{
_cityValue = value;
_countyValue = new();
_detailValue = null;
_currentViewMode = RegionViewMode.County;

CurrentValue = $"{_provinceValue}-{_cityValue}";
Expand All @@ -242,6 +245,7 @@ private void OnClickCity(string value)
private void OnClickCounty(CountyItem item)
{
_countyValue = item;
_detailValue = null;
_currentViewMode = RegionViewMode.Detail;

CurrentValue = $"{_provinceValue}-{_cityValue}-{_countyValue.Name}";
Expand All @@ -259,22 +263,16 @@ private async Task OnClickDetail(string value)
private void OnSwitchProvinceView()
{
_currentViewMode = RegionViewMode.Province;
_cityValue = "";
_countyValue = new();
_detailValue = "";
}

private void OnSwitchCityView()
{
_currentViewMode = RegionViewMode.City;
_countyValue = new();
_detailValue = "";
}

private void OnSwitchCountyView()
{
_currentViewMode = RegionViewMode.County;
_detailValue = "";
}

private void OnSwitchDetailView()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@
color: #777;
}

.bb-region-body ul li.active {
background-color: #e3e3e3;
.bb-region-body ul li:hover {
background-color: #e9ecef;
color: #000;
}

.bb-region-body ul li:hover {
.bb-region-body ul li.active {
background-color: #e3e3e3;
color: #000;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ export function dispose(id) {

const { popover } = region;
if (popover) {
Popover.dispose(select.popover);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): Corrected Popover.dispose argument to use the correct variable.

Please verify that disposal now works as expected and no new issues have been introduced.

Popover.dispose(popover);
}
}