Skip to content

Commit c9e45d4

Browse files
authored
SelectExtended: Support MudGlobals and Fix Chip Nowrap (#537)
1 parent 87caf2a commit c9e45d4

File tree

8 files changed

+48
-6
lines changed

8 files changed

+48
-6
lines changed

CodeBeam.MudBlazor.Extensions.Docs.Wasm/wwwroot/CodeBeam.MudBlazor.Extensions.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CodeBeam.MudBlazor.Extensions/Base/MudBaseInputExtended.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ protected MudBaseInputExtended() : base(new DefaultConverter<T>()) { }
156156
/// </summary>
157157
[Parameter]
158158
[Category(CategoryTypes.FormComponent.Behavior)]
159-
public bool ShrinkLabel { get; set; }
159+
public bool ShrinkLabel { get; set; } = MudGlobal.InputDefaults.ShrinkLabel;
160160

161161
/// <summary>
162162
/// The color of the adornment if used. It supports the theme colors.
@@ -182,14 +182,14 @@ protected MudBaseInputExtended() : base(new DefaultConverter<T>()) { }
182182
/// </summary>
183183
[Parameter]
184184
[Category(CategoryTypes.FormComponent.Appearance)]
185-
public Variant Variant { get; set; } = Variant.Text;
185+
public Variant Variant { get; set; } = MudGlobal.InputDefaults.Variant;
186186

187187
/// <summary>
188188
/// Will adjust vertical spacing.
189189
/// </summary>
190190
[Parameter]
191191
[Category(CategoryTypes.FormComponent.Appearance)]
192-
public Margin Margin { get; set; } = Margin.None;
192+
public Margin Margin { get; set; } = MudGlobal.InputDefaults.Margin;
193193

194194
/// <summary>
195195
/// The short hint displayed in the input before the user enters a value.

CodeBeam.MudBlazor.Extensions/Components/SelectExtended/MudSelectExtended.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
{
5656
<MudText Typo="@Typo" Class="mud-text-secondary mud-placeholder-extended">@Placeholder</MudText>
5757
}
58-
<MudChipSet T="T" Class="d-flex flex-wrap mud-width-full" Style="row-gap: 4px" AllClosable="ChipCloseable" OnClose="ChipClosed">
58+
<MudChipSet T="T" Class="@InputChipClassname" AllClosable="ChipCloseable" OnClose="ChipClosed">
5959
@if (ItemCollection != null)
6060
{
6161
foreach (var item in ItemCollection.Where(x => SelectedValues?.Contains(x) == true))

CodeBeam.MudBlazor.Extensions/Components/SelectExtended/MudSelectExtended.razor.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ public MudSelectExtended()
7272
.AddClass(InputClass)
7373
.Build();
7474

75+
/// <summary>
76+
///
77+
/// </summary>
78+
protected string? InputChipClassname =>
79+
new CssBuilder("mud-select-input-chip-extended")
80+
.AddClass("mud-select-extended-nowrap mud-chip-scroll-container", NoWrap)
81+
.Build();
82+
7583
private string _elementId = "select_" + Guid.NewGuid().ToString().Substring(0, 8);
7684
private string _popoverId = "selectpopover_" + Guid.NewGuid().ToString().Substring(0, 8);
7785

CodeBeam.MudBlazor.Extensions/Styles/Components/_selectextended.scss

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,20 @@
9595
border-bottom: 1px solid lightgrey;
9696
padding-bottom: 18px;
9797
}
98+
99+
.mud-select-input-chip-extended {
100+
display: flex;
101+
flex-wrap: wrap;
102+
max-width: 100%;
103+
row-gap: 4px;
104+
105+
&.mud-select-extended-nowrap {
106+
flex-wrap: nowrap;
107+
overflow-x: hidden;
108+
}
109+
110+
.mud-chip {
111+
flex: 0 0 auto;
112+
white-space: nowrap;
113+
}
114+
}

CodeBeam.MudBlazor.Extensions/Styles/MudExtensions.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,18 @@
974974
border-bottom: 1px solid lightgrey;
975975
padding-bottom: 18px; }
976976

977+
.mud-select-input-chip-extended {
978+
display: flex;
979+
flex-wrap: wrap;
980+
max-width: 100%;
981+
row-gap: 4px; }
982+
.mud-select-input-chip-extended.mud-select-extended-nowrap {
983+
flex-wrap: nowrap;
984+
overflow-x: hidden; }
985+
.mud-select-input-chip-extended .mud-chip {
986+
flex: 0 0 auto;
987+
white-space: nowrap; }
988+
977989
/*@import '../abstracts/variables';*/
978990
.mud-placeholder-extended {
979991
line-height: unset; }

CodeBeam.MudBlazor.Extensions/Styles/MudExtensions.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CodeBeam.MudBlazor.Extensions/wwwroot/MudExtensions.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)