Skip to content

Commit

Permalink
SelectExtended: Add the ability to display additional content (#455)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jneufferrpm authored Sep 6, 2024
1 parent 55fa821 commit 53e990f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,20 @@
}
}
</div>

</DataVisualiser>

<ChildContent>

</ChildContent>
</MudInputExtended>

<MudPopover Open="@_isOpen" MaxHeight="@MaxHeight" AnchorOrigin="@AnchorOrigin" TransformOrigin="@TransformOrigin" Class="@PopoverClass" RelativeWidth="@RelativeWidth">
<MudPopover Open="@_isOpen" MaxHeight="@MaxHeight" AnchorOrigin="@AnchorOrigin" TransformOrigin="@TransformOrigin" Class="@PopoverClass" RelativeWidth="@RelativeWidth">
@if (StaticContent != null && !ShowStaticContentAtEnd)
{
@StaticContent(this)
}

<CascadingValue Value="@this" IsFixed="true">
<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"
Clickable="true" Color="@Color" Dense="@Dense" ItemCollection="@ItemCollection" Virtualize="@Virtualize" Padding="@EnablePopoverPadding" DisableSelectedItemStyle="@EnableSelectedItemStyle"
Expand All @@ -113,6 +118,11 @@
@ChildContent
</MudListExtended>
</CascadingValue>

@if (StaticContent != null && ShowStaticContentAtEnd)
{
@StaticContent(this)
}
</MudPopover>
</InputContent>
</MudInputControl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,20 @@ public MudSelectExtended()
[Category(CategoryTypes.FormComponent.ListBehavior)]
public RenderFragment? ChildContent { get; set; }

/// <summary>
/// Optional additional content to display above the list within the popover.
/// </summary>
[Parameter]
[Category(CategoryTypes.FormComponent.Appearance)]
public RenderFragment<MudSelectExtended<T>>? StaticContent { get; set; }

/// <summary>
/// Whether to show <see cref="StaticContent"/> at the bottom of the popover.
/// </summary>
[Parameter]
[Category(CategoryTypes.FormComponent.Appearance)]
public bool ShowStaticContentAtEnd { get; set; }

/// <summary>
/// Optional presentation template for items
/// </summary>
Expand Down

0 comments on commit 53e990f

Please sign in to comment.