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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<MudGrid>
<MudItem xs="12" sm="8" Class="d-flex gap-4 align-center justify-center">
<MudComboBox @bind-Value="@_value" @bind-Text="@_text" @bind-SelectedValues="@_selectedValues" Variant="Variant.Filled" Label="Highlighted" Editable="true" MultiSelection="@_multiselection"
<MudComboBox @bind-Value="@_value" @bind-Text="@_text" @bind-SelectedValues="@_selectedValues" Variant="Variant.Filled" Label="Highlighted" Editable="true" MultiSelection="@_multiselection" Modal="@_modal"
autocomplete="new-password" Color="_color" Clearable="_clearable" Strict="_strict" Highlight="true" HighlightClass="@(_customHighlightClass ? "mud-theme-primary" : null)" EnableFilter="_enableFilter">
<MudComboBoxItem Value="@("Foo")">Foo</MudComboBoxItem>
<MudComboBoxItem Value="@("Bar")">Bar</MudComboBoxItem>
Expand All @@ -14,7 +14,7 @@
}
</MudComboBox>

<MudComboBox @bind-Value="@_value" @bind-Text="@_text" @bind-SelectedValues="@_selectedValues" Variant="Variant.Filled" Label="With NoItemsContent" Editable="true" MultiSelection="@_multiselection"
<MudComboBox @bind-Value="@_value" @bind-Text="@_text" @bind-SelectedValues="@_selectedValues" Variant="Variant.Filled" Label="With NoItemsContent" Editable="true" MultiSelection="@_multiselection" Modal="@_modal"
autocomplete="new-password" Color="_color" Clearable="_clearable" Strict="_strict" EnableFilter="_enableFilter">
<ChildContent>
<MudComboBoxItem Value="@("Foo")">Foo</MudComboBoxItem>
Expand All @@ -41,20 +41,22 @@
<MudSwitchM3 @bind-Value="@_clearable" Label="Clearable" Color="Color.Secondary" />
<MudSwitchM3 @bind-Value="@_customHighlightClass" Label="Custom Highlight" Color="Color.Secondary" />
<MudSwitchM3 @bind-Value="@_enableFilter" Label="Enable Filter" Color="Color.Secondary" />
<MudSwitchM3 @bind-Value="@_modal" Label="Modal" Color="Color.Secondary" />
</MudStack>
</MudItem>
</MudGrid>

@code {
string? _value;
string? _text;
IEnumerable<string>? _selectedValues;
Color _color = Color.Primary;
bool _multiselection;
bool _clearable;
bool _strict;
bool _customHighlightClass;
bool _enableFilter = true;
private string? _value;
private string? _text;
private IEnumerable<string>? _selectedValues;
private Color _color = Color.Primary;
private bool _multiselection;
private bool _clearable;
private bool _strict;
private bool _customHighlightClass;
private bool _enableFilter = true;
private bool _modal = true;

private string[] states =
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,29 @@
<MudGrid>
<MudItem xs="12" sm="8">
<MudStack>
<MudSelectExtended T="string" Label="RenderFragment Based" Disabled="_disabled">
<MudSelectExtended T="string" Label="RenderFragment Based" Disabled="_disabled" Modal="@_modal">
<MudSelectItemExtended Value="@("Foo")" Text="Foo" />
<MudSelectItemExtended Value="@("Bar")" Text="Bar" />
<MudSelectItemExtended Value="@("Fizz")" Text="Fizz" />
<MudSelectItemExtended Value="@("Buzz")" Text="Buzz" />
</MudSelectExtended>
<MudSelectExtended T="string" Label="Data Based" ItemCollection="_collection" Disabled="_disabled" />
<MudSelectExtended T="string" Label="Data Based" ItemCollection="_collection" Disabled="_disabled" AddNullItem="true" AddedNullItemText="@_nullItemText" />
<MudSelectExtended T="string" Label="Data Based" ItemCollection="_collection" Disabled="_disabled" Modal="@_modal" />
<MudSelectExtended T="string" Label="Data Based" ItemCollection="_collection" Disabled="_disabled" Modal="@_modal" AddNullItem="true" AddedNullItemText="@_nullItemText" />
</MudStack>
</MudItem>

<MudItem xs="12" sm="4">
<MudStack>
<MudSwitchM3 @bind-Value="_disabled" Color="Color.Secondary" Label="Disabled" />
<MudSwitchM3 @bind-Value="_modal" Color="Color.Secondary" Label="Modal" />
<MudTextField @bind-Value="_nullItemText" Label="Null Item Text" Variant="Variant.Outlined" />
</MudStack>
</MudItem>
</MudGrid>

@code {
private bool _disabled = false;
private bool _modal = true;
private string[] _collection = new string[] { "Foo", "Bar", "Fizz", "Buzz" };
private string? _nullItemText = "None";
}
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,4 @@

</CascadingValue>
<!-- mousedown instead of click needed to close the menu before OnLostFocus runs -->
<MudOverlay Visible="@_isOpen" @onmousedown="@CloseMenu" LockScroll="@LockScroll" />
<MudOverlay Visible="@_isOpen" @onmousedown="@CloseMenu" Modal="@GetModal()" AutoClose="@(!GetModal())" OnClosed="@(() => CloseMenu())" LockScroll="@LockScroll" />
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
{
#region Constructor, Injected Services, Parameters, Fields

[Inject]
private IPopoverService PopoverService { get; set; } = null!;

/// <summary>
/// Constructor for ComboBox
/// </summary>
Expand Down Expand Up @@ -325,6 +328,19 @@
[Category(CategoryTypes.FormComponent.ListBehavior)]
public bool SelectAll { get; set; }

/// <summary>
/// If true prevent background interaction when open. Default is true.
/// </summary>
[Parameter]
[Category(CategoryTypes.List.Selecting)]
public bool? Modal { get; set; } = true;

/// <summary>
///
/// </summary>
/// <returns></returns>
protected bool GetModal() => Modal ?? PopoverService.PopoverOptions.ModalOverlay;

/// <summary>
/// Sets position of the Select All checkbox
/// </summary>
Expand Down Expand Up @@ -555,7 +571,7 @@
return;
_comparer = value;
// Apply comparer and refresh selected values
_selectedValues = new HashSet<T?>(_selectedValues, _comparer);

Check warning on line 574 in src/CodeBeam.MudBlazor.Extensions/Components/ComboBox/MudComboBox.razor.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'collection' in 'HashSet<T?>.HashSet(IEnumerable<T?> collection, IEqualityComparer<T?>? comparer)'.

Check warning on line 574 in src/CodeBeam.MudBlazor.Extensions/Components/ComboBox/MudComboBox.razor.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'collection' in 'HashSet<T?>.HashSet(IEnumerable<T?> collection, IEqualityComparer<T?>? comparer)'.
SelectedValues = _selectedValues;
}
}
Expand Down Expand Up @@ -602,7 +618,7 @@

_selectedValues = new HashSet<T?>(set, _comparer);

SelectedValuesChanged.InvokeAsync(new HashSet<T?>(SelectedValues, _comparer)).CatchAndLog();

Check warning on line 621 in src/CodeBeam.MudBlazor.Extensions/Components/ComboBox/MudComboBox.razor.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'collection' in 'HashSet<T?>.HashSet(IEnumerable<T?> collection, IEqualityComparer<T?>? comparer)'.

Check warning on line 621 in src/CodeBeam.MudBlazor.Extensions/Components/ComboBox/MudComboBox.razor.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'collection' in 'HashSet<T?>.HashSet(IEnumerable<T?> collection, IEqualityComparer<T?>? comparer)'.
ForceUpdateItems().CatchAndLog();
//Console.WriteLine("SelectedValues setter ended");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,4 @@
</CascadingValue>

<!-- mousedown instead of click needed to close the menu before OnLostFocus runs -->
<MudOverlay Visible="_isOpen" @onmousedown="@(() => CloseMenu())" LockScroll="@LockScroll" />
<MudOverlay Visible="_isOpen" @onmousedown="@(() => CloseMenu())" Modal="@GetModal()" AutoClose="@(!GetModal())" OnClosed="@(() => CloseMenu())" LockScroll="@LockScroll" />
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
IconSize = Size.Medium;
}

[Inject] private IKeyInterceptorService KeyInterceptorService { get; set; } = null!;
[Inject]
private IKeyInterceptorService KeyInterceptorService { get; set; } = null!;

[Inject]
private IPopoverService PopoverService { get; set; } = null!;

private MudListExtended<T?>? _list;
private bool _dense;
Expand All @@ -42,11 +46,11 @@
/// <summary>
///
/// </summary>
protected Dictionary<T, MudSelectItemExtended<T?>> _valueLookup = new();

Check warning on line 49 in src/CodeBeam.MudBlazor.Extensions/Components/SelectExtended/MudSelectExtended.razor.cs

View workflow job for this annotation

GitHub Actions / build

The type 'T' cannot be used as type parameter 'TKey' in the generic type or method 'Dictionary<TKey, TValue>'. Nullability of type argument 'T' doesn't match 'notnull' constraint.

Check warning on line 49 in src/CodeBeam.MudBlazor.Extensions/Components/SelectExtended/MudSelectExtended.razor.cs

View workflow job for this annotation

GitHub Actions / build

The type 'T' cannot be used as type parameter 'TKey' in the generic type or method 'Dictionary<TKey, TValue>'. Nullability of type argument 'T' doesn't match 'notnull' constraint.
/// <summary>
///
/// </summary>
protected Dictionary<T, MudSelectItemExtended<T?>> _shadowLookup = new();

Check warning on line 53 in src/CodeBeam.MudBlazor.Extensions/Components/SelectExtended/MudSelectExtended.razor.cs

View workflow job for this annotation

GitHub Actions / build

The type 'T' cannot be used as type parameter 'TKey' in the generic type or method 'Dictionary<TKey, TValue>'. Nullability of type argument 'T' doesn't match 'notnull' constraint.

Check warning on line 53 in src/CodeBeam.MudBlazor.Extensions/Components/SelectExtended/MudSelectExtended.razor.cs

View workflow job for this annotation

GitHub Actions / build

The type 'T' cannot be used as type parameter 'TKey' in the generic type or method 'Dictionary<TKey, TValue>'. Nullability of type argument 'T' doesn't match 'notnull' constraint.
private MudInputExtended<string> _elementReference = new();
internal bool _isOpen;
/// <summary>
Expand Down Expand Up @@ -178,6 +182,19 @@
[Category(CategoryTypes.List.Selecting)]
public bool NoWrap { get; set; }

/// <summary>
/// If true prevent background interaction when open. Default is true.
/// </summary>
[Parameter]
[Category(CategoryTypes.List.Selecting)]
public bool? Modal { get; set; } = true;

/// <summary>
///
/// </summary>
/// <returns></returns>
protected bool GetModal() => Modal ?? PopoverService.PopoverOptions.ModalOverlay;

/// <summary>
/// User class names for the popover, separated by space
/// </summary>
Expand Down
Loading