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
6 changes: 6 additions & 0 deletions src/BootstrapBlazor.Server/Components/Samples/Radios.razor
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
<ConsoleLogger @ref="Logger" />
</DemoBlock>

<DemoBlock Title="@Localizer["RadiosAutoSelectFirstWhenValueIsNullTitle"]"
Introduction="@Localizer["RadiosAutoSelectFirstWhenValueIsNullIntro"]"
Name="AutoSelectFirstWhenValueIsNull">
<RadioList TValue="string" Items="@AutoSelectValues" AutoSelectFirstWhenValueIsNull="false" />
</DemoBlock>

<DemoBlock Title="@Localizer["RadiosDisableTitle"]"
Introduction='@Localizer["RadiosDisableIntro"]'
Name="Disable">
Expand Down
17 changes: 17 additions & 0 deletions src/BootstrapBlazor.Server/Components/Samples/Radios.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ public sealed partial class Radios
[NotNull]
private IEnumerable<SelectedItem>? DemoValues { get; set; }

[NotNull]
private IEnumerable<SelectedItem>? AutoSelectValues { get; set; }

[NotNull]
private IEnumerable<SelectedItem>? DisableValues { get; set; }

Expand Down Expand Up @@ -70,6 +73,12 @@ protected override void OnInitialized()
new("2", Localizer["RadiosItem2"])
};

AutoSelectValues = new List<SelectedItem>(2)
{
new("1", Localizer["RadiosItem1"]),
new("2", Localizer["RadiosItem2"])
};

DisableValues = new List<SelectedItem>(2)
{
new("1", Localizer["RadiosItem1"]),
Expand Down Expand Up @@ -177,6 +186,14 @@ private AttributeItem[] GetAttributes() =>
Type = "IEnumerable<TItem>",
ValueList = " — ",
DefaultValue = "—"
},
new()
{
Name = "AutoSelectFirstWhenValueIsNull",
Description = Localizer["RadiosAutoSelectFirstWhenValueIsNull"],
Type = "bool",
ValueList = "true|false",
DefaultValue = "true"
}
];

Expand Down
5 changes: 4 additions & 1 deletion src/BootstrapBlazor.Server/Locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -3056,7 +3056,10 @@
"RadiosAdd1": "Beijing",
"RadiosAdd2": "Shanghai",
"RadioListGenericTitle": "Generic List",
"RadioListGenericIntro": "Enable generic support by using the <code>RadioListGeneric</code> component with <code>SelectedItem&lt;TValue&gt;</code>"
"RadioListGenericIntro": "Enable generic support by using the <code>RadioListGeneric</code> component with <code>SelectedItem&lt;TValue&gt;</code>",
"RadiosAutoSelectFirstWhenValueIsNullTitle": "AutoSelectFirst",
"RadiosAutoSelectFirstWhenValueIsNullIntro": "The selection of <code>RadioList</code> candidates can be controlled by setting the <code>AutoSelectFirstWhenValueIsNull</code> parameter. The default value of the parameter is <b>true</b>, which means that if the current value of the component is inconsistent with the value in the candidate, the first candidate is automatically selected. If it is set to <b>false</b>, all candidates will be unselected.",
"RadiosAutoSelectFirstWhenValueIsNull": "Whether to select the first candidate by default when the value is not null"
},
"BootstrapBlazor.Server.Components.Samples.Rates": {
"RatesTitle": "Rate",
Expand Down
5 changes: 4 additions & 1 deletion src/BootstrapBlazor.Server/Locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -3056,7 +3056,10 @@
"RadiosAdd1": "北京",
"RadiosAdd2": "上海",
"RadioListGenericTitle": "泛型支持",
"RadioListGenericIntro": "通过使用 <code>RadioListGeneric</code> 组件配合 <code>SelectedItem&lt;TValue&gt;</code> 开启泛型支持"
"RadioListGenericIntro": "通过使用 <code>RadioListGeneric</code> 组件配合 <code>SelectedItem&lt;TValue&gt;</code> 开启泛型支持",
"RadiosAutoSelectFirstWhenValueIsNullTitle": "自动选择第一候选项",
"RadiosAutoSelectFirstWhenValueIsNullIntro": "通过设置 <code>AutoSelectFirstWhenValueIsNull</code> 参数控制 <code>RadioList</code> 候选项选中情况,参数默认值为 <b>true</b>,即如果组件当前值与候选项中值无一致值时,自动选中第一个候选项,设置为 <b>false</b> 后,候选项将全部为未选中状态。",
"RadiosAutoSelectFirstWhenValueIsNull": "值未 null 时是否默认选中第一个候选项"
},
"BootstrapBlazor.Server.Components.Samples.Rates": {
"RatesTitle": "Rate 评分",
Expand Down