From 949c7f58ec6babb51ee464739418e867816dcd7b Mon Sep 17 00:00:00 2001 From: mckaragoz <78308169+mckaragoz@users.noreply.github.com> Date: Sat, 12 Aug 2023 17:34:25 +0300 Subject: [PATCH] ComboBoxDisableFilter --- .../Components/ComboBox/MudComboBox.razor.cs | 6 ++++++ .../Components/ComboBox/MudComboBoxItem.razor.cs | 2 +- ComponentViewer.Docs/Pages/Examples/ComboboxExample7.razor | 6 ++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CodeBeam.MudBlazor.Extensions/Components/ComboBox/MudComboBox.razor.cs b/CodeBeam.MudBlazor.Extensions/Components/ComboBox/MudComboBox.razor.cs index c5b44659..0ec8855c 100644 --- a/CodeBeam.MudBlazor.Extensions/Components/ComboBox/MudComboBox.razor.cs +++ b/CodeBeam.MudBlazor.Extensions/Components/ComboBox/MudComboBox.razor.cs @@ -70,6 +70,12 @@ public MudComboBox() [Category(CategoryTypes.FormComponent.Appearance)] [Parameter] public bool Editable { get; set; } + /// + /// If true, all items are eligible regarding what user search in textfield. Default is false. + /// + [Category(CategoryTypes.FormComponent.Appearance)] + [Parameter] public bool DisableFilter { get; set; } = false; + /// /// If true, searched text has highlight. /// diff --git a/CodeBeam.MudBlazor.Extensions/Components/ComboBox/MudComboBoxItem.razor.cs b/CodeBeam.MudBlazor.Extensions/Components/ComboBox/MudComboBoxItem.razor.cs index ef549cf5..1cce1371 100644 --- a/CodeBeam.MudBlazor.Extensions/Components/ComboBox/MudComboBoxItem.razor.cs +++ b/CodeBeam.MudBlazor.Extensions/Components/ComboBox/MudComboBoxItem.razor.cs @@ -153,7 +153,7 @@ protected internal void CheckEligible() protected bool IsEligible() { - if (MudComboBox == null || MudComboBox.Editable == false) + if (MudComboBox == null || MudComboBox.Editable == false || MudComboBox.DisableFilter == true) { return true; } diff --git a/ComponentViewer.Docs/Pages/Examples/ComboboxExample7.razor b/ComponentViewer.Docs/Pages/Examples/ComboboxExample7.razor index d6481969..362aba00 100644 --- a/ComponentViewer.Docs/Pages/Examples/ComboboxExample7.razor +++ b/ComponentViewer.Docs/Pages/Examples/ComboboxExample7.razor @@ -4,7 +4,7 @@ + autocomplete="new-password" Color="_color" Clearable="_clearable" Strict="_strict" Highlight="true" HighlightClass="@(_customHighlightClass ? "mud-theme-primary" : null)" DisableFilter="_disableFilter"> Foo Bar Fizz @@ -16,7 +16,7 @@ + autocomplete="new-password" Color="_color" Clearable="_clearable" Strict="_strict" DisableFilter="_disableFilter"> Foo Bar @@ -41,6 +41,7 @@ + @@ -56,6 +57,7 @@ bool _clearable; bool _strict; bool _customHighlightClass; + bool _disableFilter = false; private string[] states = {