Skip to content

doc(Select): update bind enum data type sample code #5044

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 6, 2025
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
18 changes: 11 additions & 7 deletions src/BootstrapBlazor.Server/Components/Samples/Selects.razor
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<DemoBlock Title="@Localizer["SelectsNormalTitle"]"
Introduction="@Localizer["SelectsNormalIntro"]"
Name="Normal">
<p>@((MarkupString)Localizer["SelectsNormalDescription"].Value)</p>
<section ignore>@((MarkupString)Localizer["SelectsNormalDescription"].Value)</section>
<div class="row g-3">
<div class="col-12 col-sm-6">
<Select Items="Items" OnSelectedItemChanged="OnItemChanged" @bind-Value="Model.Name"></Select>
Expand Down Expand Up @@ -215,13 +215,15 @@
</Select>
</div>
</div>
</DemoBlock>
</DemoBlock>

<DemoBlock Title="@Localizer["SelectsEnumTitle"]"
Introduction="@Localizer["SelectsEnumIntro"]"
Name="Enum">
<p>@((MarkupString)Localizer["SelectsEnumDescription1"].Value)</p>
<p>@((MarkupString)Localizer["SelectsEnumDescription2"].Value)</p>
<section ignore>
<p>@((MarkupString)Localizer["SelectsEnumDescription1"].Value)</p>
<div>@((MarkupString)Localizer["SelectsEnumDescription2"].Value)</div>
</section>
<div class="row g-3">
<div class="col-12 col-sm-6">
<Select @bind-Value="SelectedEnumItem1" PlaceHolder="@Localizer["SelectsPlaceHolder"]" ShowLabel="true" DisplayText="@Localizer["SelectsEnumSelectText1"]">
Expand All @@ -244,7 +246,7 @@
<DemoBlock Title="@Localizer["SelectsNullableTitle"]"
Introduction="@Localizer["SelectsNullableIntro"]"
Name="Nullable">
<p>@((MarkupString)Localizer["SelectsNullableDescription"].Value)</p>
<section ignore>@((MarkupString)Localizer["SelectsNullableDescription"].Value)</section>
<div class="row g-3">
<div class="col-12 col-sm-6">
<Select Items="NullableIntItems" @bind-Value="NullableSelectedIntItem">
Expand All @@ -259,8 +261,10 @@
<DemoBlock Title="@Localizer["SelectsNullableBooleanTitle"]"
Introduction="@Localizer["SelectsNullableBooleanIntro"]"
Name="NullableBoolean">
<p>@((MarkupString)Localizer["SelectsNullableBooleanDescription1"].Value)</p>
<p>@((MarkupString)Localizer["SelectsNullableBooleanDescription2"].Value)</p>
<section ignore>
<p>@((MarkupString)Localizer["SelectsNullableBooleanDescription1"].Value)</p>
<div>@((MarkupString)Localizer["SelectsNullableBooleanDescription2"].Value)</div>
</section>
<div class="row g-3">
<div class="col-12 col-sm-6">
<Select Items="NullableBoolItems" @bind-Value="SelectedBoolItem">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ private string GetSelectedBoolItemString()
private IEnumerable<SelectedItem> NullableBoolItems { get; set; } = new SelectedItem[]
{
new() { Text = "空值", Value = "" },
new() { Text = "True 值", Value = "true" },
new() { Text = "False 值", Value = "false" }
new() { Text = "True 值", Value = "True" },
new() { Text = "False 值", Value = "False" }
};

private readonly SelectedItem[] StringItems =
Expand Down
147 changes: 72 additions & 75 deletions src/BootstrapBlazor.Server/Components/Samples/Sliders.razor
Original file line number Diff line number Diff line change
Expand Up @@ -7,78 +7,81 @@
<h4>@Localizer["SlidersDescription"]</h4>

<DemoBlock Title="@Localizer["SlidersNormalTitle"]" Introduction="@Localizer["SlidersNormalIntro"]" Name="Normal">
<div class="row g-3">
<div class="col-12 col-md-6 col-lg-4 xl-3">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="CurrentValue" />
<BootstrapInput @bind-Value="@CurrentValue" />
</BootstrapInputGroup>
</div>
<div class="col-12 col-md-6 col-lg-4 xl-3">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="MinValue" />
<BootstrapInput @bind-Value="@MinValue" />
</BootstrapInputGroup>
</div>
<div class="col-12 col-md-6 col-lg-4 xl-3">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="MaxValue" />
<BootstrapInput @bind-Value="@MaxValue" />
</BootstrapInputGroup>
</div>
<div class="col-12 col-md-6 col-lg-4 xl-3">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="DisplayText" />
<BootstrapInput @bind-Value="@DisplayText" />
</BootstrapInputGroup>
</div>
<div class="col-12 col-md-6 col-lg-4 xl-3">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="Step" />
<BootstrapInput @bind-Value="@Step" />
</BootstrapInputGroup>
</div>
<div class="col-12 col-md-6 col-lg-4 xl-3">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="IsDisabled" />
<Checkbox @bind-Value="@IsDisabled" />
</BootstrapInputGroup>
</div>
<div class="col-12 col-md-6 col-lg-4 xl-3">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="UseInput" />
<Checkbox @bind-Value="@UseInput" />
</BootstrapInputGroup>
</div>
<div class="col-12 col-md-6 col-lg-4 xl-3">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="ShowLabel" />
<Checkbox @bind-Value="@ShowLabel" />
</BootstrapInputGroup>
</div>
<div class="col-12 col-md-6 col-lg-4 xl-3">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="UseGroup" />
<Checkbox @bind-Value="@UseGroup" />
</BootstrapInputGroup>
</div>
<div class="col-12">
@if (UseGroup)
{
<section ignore>
<div class="row g-3">
<div class="col-12 col-md-6 col-lg-4 xl-3">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="@DisplayText" />
@RenderSlider
<BootstrapInputGroupLabel DisplayText="CurrentValue" />
<BootstrapInput @bind-Value="@CurrentValue" />
</BootstrapInputGroup>
}
else
{
@RenderSlider
}
</div>
<div class="col-12">
<ConsoleLogger @ref="Logger" />
</div>
<div class="col-12 col-md-6 col-lg-4 xl-3">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="MinValue" />
<BootstrapInput @bind-Value="@MinValue" />
</BootstrapInputGroup>
</div>
<div class="col-12 col-md-6 col-lg-4 xl-3">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="MaxValue" />
<BootstrapInput @bind-Value="@MaxValue" />
</BootstrapInputGroup>
</div>
<div class="col-12 col-md-6 col-lg-4 xl-3">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="DisplayText" />
<BootstrapInput @bind-Value="@DisplayText" />
</BootstrapInputGroup>
</div>
<div class="col-12 col-md-6 col-lg-4 xl-3">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="Step" />
<BootstrapInput @bind-Value="@Step" />
</BootstrapInputGroup>
</div>
<div class="col-12 col-md-6 col-lg-4 xl-3">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="IsDisabled" />
<Checkbox @bind-Value="@IsDisabled" />
</BootstrapInputGroup>
</div>
<div class="col-12 col-md-6 col-lg-4 xl-3">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="UseInput" />
<Checkbox @bind-Value="@UseInput" />
</BootstrapInputGroup>
</div>
<div class="col-12 col-md-6 col-lg-4 xl-3">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="ShowLabel" />
<Checkbox @bind-Value="@ShowLabel" />
</BootstrapInputGroup>
</div>
<div class="col-12 col-md-6 col-lg-4 xl-3">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="UseGroup" />
<Checkbox @bind-Value="@UseGroup" />
</BootstrapInputGroup>
</div>
</div>
</div>
</section>
@if (UseGroup)
{
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="@DisplayText" />
<Slider @bind-Value="@CurrentValue" Max="MaxValue" Min="MinValue" Step="Step" UseInputEvent="UseInput"
DisplayText="@DisplayText" ShowLabel="ShowLabel" IsDisabled="IsDisabled" OnValueChanged="OnRangeSliderValueChanged" />

</BootstrapInputGroup>
}
else
{
<Slider @bind-Value="@CurrentValue" Max="MaxValue" Min="MinValue" Step="Step" UseInputEvent="UseInput"
DisplayText="@DisplayText" ShowLabel="ShowLabel" IsDisabled="IsDisabled" OnValueChanged="OnRangeSliderValueChanged" />
}
<section ignore>
<ConsoleLogger @ref="Logger" />
</section>
</DemoBlock>

<DemoBlock Title="@Localizer["SlidersRangeTitle"]" Introduction="@Localizer["SlidersRangeIntro"]" Name="Range">
Expand All @@ -103,9 +106,3 @@
<AttributeTable Items="@GetAttributes()" />

<EventTable Items="@GetEvents()" />

@code {
RenderFragment RenderSlider =>
@<Slider @bind-Value="@CurrentValue" Max="MaxValue" Min="MinValue" Step="Step" UseInputEvent="UseInput"
DisplayText="@DisplayText" ShowLabel="ShowLabel" IsDisabled="IsDisabled" OnValueChanged="OnRangeSliderValueChanged" />;
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
border-bottom-right-radius: 0;
}
}

> .form-label {
display: none;
}
}

.input-group-xs {
Expand Down
Loading