Skip to content

Commit 53e990f

Browse files
authored
SelectExtended: Add the ability to display additional content (#455)
* SelectExtended: Add the ability to display additional content within the popover above the list * SelectExtended: rename AdditionalContent to StaticContent * SelectExtended: add an option to show the StaticContent at the bottom of the list
1 parent 55fa821 commit 53e990f

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,20 @@
9494
}
9595
}
9696
</div>
97-
97+
9898
</DataVisualiser>
9999

100100
<ChildContent>
101-
101+
102102
</ChildContent>
103103
</MudInputExtended>
104104

105-
<MudPopover Open="@_isOpen" MaxHeight="@MaxHeight" AnchorOrigin="@AnchorOrigin" TransformOrigin="@TransformOrigin" Class="@PopoverClass" RelativeWidth="@RelativeWidth">
105+
<MudPopover Open="@_isOpen" MaxHeight="@MaxHeight" AnchorOrigin="@AnchorOrigin" TransformOrigin="@TransformOrigin" Class="@PopoverClass" RelativeWidth="@RelativeWidth">
106+
@if (StaticContent != null && !ShowStaticContentAtEnd)
107+
{
108+
@StaticContent(this)
109+
}
110+
106111
<CascadingValue Value="@this" IsFixed="true">
107112
<MudListExtended @ref="@_list" T="T" @bind-SelectedValue="@Value" Style="@($"overflow-y:auto; max-height: {MaxHeight}px")" @bind-SelectedValues="@SelectedValues" @bind-SelectedItem="@SelectedListItem" @bind-SelectedItems="@SelectedListItems"
108113
Clickable="true" Color="@Color" Dense="@Dense" ItemCollection="@ItemCollection" Virtualize="@Virtualize" Padding="@EnablePopoverPadding" DisableSelectedItemStyle="@EnableSelectedItemStyle"
@@ -113,6 +118,11 @@
113118
@ChildContent
114119
</MudListExtended>
115120
</CascadingValue>
121+
122+
@if (StaticContent != null && ShowStaticContentAtEnd)
123+
{
124+
@StaticContent(this)
125+
}
116126
</MudPopover>
117127
</InputContent>
118128
</MudInputControl>

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,20 @@ public MudSelectExtended()
107107
[Category(CategoryTypes.FormComponent.ListBehavior)]
108108
public RenderFragment? ChildContent { get; set; }
109109

110+
/// <summary>
111+
/// Optional additional content to display above the list within the popover.
112+
/// </summary>
113+
[Parameter]
114+
[Category(CategoryTypes.FormComponent.Appearance)]
115+
public RenderFragment<MudSelectExtended<T>>? StaticContent { get; set; }
116+
117+
/// <summary>
118+
/// Whether to show <see cref="StaticContent"/> at the bottom of the popover.
119+
/// </summary>
120+
[Parameter]
121+
[Category(CategoryTypes.FormComponent.Appearance)]
122+
public bool ShowStaticContentAtEnd { get; set; }
123+
110124
/// <summary>
111125
/// Optional presentation template for items
112126
/// </summary>

0 commit comments

Comments
 (0)