mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-05 13:37:35 +08:00
698ae84ab1
* feat(module: checkbox): support generic value * fix tests * fix test * fix name * fix tests * fix tests
47 lines
1.7 KiB
C#
47 lines
1.7 KiB
C#
@namespace AntDesign
|
|
@typeparam TValue
|
|
@inherits AntInputComponentBase<TValue[]>
|
|
@using AntDesign.Internal;
|
|
|
|
<CascadingValue Value="null" Name="FormItem" TValue="IFormItem" IsFixed="@true">
|
|
<CascadingValue Value="this" IsFixed="@true">
|
|
<div class="@ClassMapper.Class" style="@Style" id="@Id" @ref="Ref">
|
|
@if (MixedMode == CheckboxGroupMixedMode.ChildContentFirst)
|
|
@ChildContent
|
|
|
|
@if (Options.Value != null)
|
|
{
|
|
if (Options.IsT0)
|
|
{
|
|
@foreach (var option in Options.AsT0)
|
|
{
|
|
<CascadingValue Value="option.Value" Name="ItemValue">
|
|
<Checkbox Disabled="option.Disabled || Disabled"
|
|
Checked="@option.Checked"
|
|
Label="@option.Label">
|
|
@option.Label
|
|
</Checkbox>
|
|
</CascadingValue>
|
|
}
|
|
}
|
|
else
|
|
{
|
|
@foreach (var option in Options.AsT1)
|
|
{
|
|
<CascadingValue Value="option" Name="ItemValue">
|
|
<Checkbox Disabled="Disabled"
|
|
Checked="@option.IsIn(_selectedValues)"
|
|
Label="@option.ToString()">
|
|
@option
|
|
</Checkbox>
|
|
</CascadingValue>
|
|
}
|
|
}
|
|
}
|
|
@if (MixedMode == CheckboxGroupMixedMode.OptionsFirst)
|
|
@ChildContent
|
|
|
|
</div>
|
|
</CascadingValue>
|
|
</CascadingValue>
|