mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-11-30 02:58:13 +08:00
fix(module: checkbox): value binding for checkbox group (#2173)
* fix(module: checkbox): value binding for checkbox group
This commit is contained in:
parent
f45e8f7b56
commit
6fcdbb9ad5
8
.github/workflows/pull-request.yml
vendored
8
.github/workflows/pull-request.yml
vendored
@ -17,7 +17,7 @@ jobs:
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: 3.1.300
|
||||
|
||||
|
||||
- name: Setup .NET 5
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
@ -26,7 +26,7 @@ jobs:
|
||||
- name: Setup .NET 6.0
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: 6.0.100
|
||||
dotnet-version: 6.0.101
|
||||
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
@ -46,8 +46,8 @@ jobs:
|
||||
npm --prefix ./tests/AntDesign.Tests.Js run test-cov
|
||||
find ./coverage ./tests -name "*coverage*.xml" -type f -exec cp {} ./ \;
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v2
|
||||
with:
|
||||
files: ./coverage.cobertura.xml,./cobertura-coverage.xml
|
||||
fail_ci_if_error: false
|
||||
fail_ci_if_error: false
|
||||
|
@ -147,6 +147,26 @@ namespace AntDesign
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
var invokeChange = false;
|
||||
|
||||
_checkboxItems.ForEach(x =>
|
||||
{
|
||||
var checkBoxValue = x.Label.IsIn(value);
|
||||
if (checkBoxValue != x.Value)
|
||||
{
|
||||
invokeChange = true;
|
||||
x.SetValue(checkBoxValue);
|
||||
OnCheckboxChange(x, false);
|
||||
}
|
||||
});
|
||||
|
||||
if (invokeChange)
|
||||
{
|
||||
InvokeValueChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
@ -198,8 +218,9 @@ namespace AntDesign
|
||||
/// Called when [checkbox change].
|
||||
/// </summary>
|
||||
/// <param name="checkbox">The checkbox.</param>
|
||||
/// <param name="invokeOnChange">Flag for whether or not to depart for a change event.</param>
|
||||
/// <returns></returns>
|
||||
internal void OnCheckboxChange(Checkbox checkbox)
|
||||
internal void OnCheckboxChange(Checkbox checkbox, bool invokeOnChange = true)
|
||||
{
|
||||
var index = _checkboxItems.IndexOf(checkbox);
|
||||
int indexOffset;
|
||||
@ -234,7 +255,16 @@ namespace AntDesign
|
||||
}
|
||||
});
|
||||
|
||||
CurrentValue = _currentValue();
|
||||
if (invokeOnChange)
|
||||
{
|
||||
CurrentValue = _currentValue();
|
||||
|
||||
InvokeValueChange();
|
||||
}
|
||||
}
|
||||
|
||||
private void InvokeValueChange()
|
||||
{
|
||||
if (OnChange.HasDelegate)
|
||||
{
|
||||
OnChange.InvokeAsync(CurrentValue);
|
||||
|
@ -1,14 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
|
||||
|
||||
<PropertyGroup Condition="$(EnableAOT) == 'true'">
|
||||
<TargetFrameworks>net5;net6</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="$(EnableAOT) != 'true'">
|
||||
<TargetFramework>net5</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net5;net6</TargetFrameworks>
|
||||
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
|
||||
<BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData>
|
||||
</PropertyGroup>
|
||||
|
Loading…
Reference in New Issue
Block a user