diff --git a/.idea/.idea.HopFrame/.idea/workspace.xml b/.idea/.idea.HopFrame/.idea/workspace.xml
index 7332fc3..d483158 100644
--- a/.idea/.idea.HopFrame/.idea/workspace.xml
+++ b/.idea/.idea.HopFrame/.idea/workspace.xml
@@ -12,19 +12,9 @@
-
-
-
-
-
-
-
-
+
-
-
-
-
+
@@ -279,15 +269,7 @@
-
-
-
-
- 1736970238802
-
-
-
- 1736970238802
+
@@ -673,7 +655,15 @@
1744971440348
-
+
+
+ 1751721064458
+
+
+
+ 1751721064458
+
+
@@ -703,7 +693,6 @@
-
@@ -728,7 +717,8 @@
-
+
+
diff --git a/src/HopFrame.Core/Config/TableConfig.cs b/src/HopFrame.Core/Config/TableConfig.cs
index 2de5648..668cc77 100644
--- a/src/HopFrame.Core/Config/TableConfig.cs
+++ b/src/HopFrame.Core/Config/TableConfig.cs
@@ -15,6 +15,7 @@ public class TableConfig {
public bool Ignored { get; set; }
public int Order { get; set; }
internal bool Seeded { get; set; }
+ public bool ShowSearchSuggestions { get; set; } = true;
public string? ViewPolicy { get; set; }
public string? CreatePolicy { get; set; }
@@ -66,6 +67,13 @@ public sealed class TableConfigurator(TableConfig config) {
InnerConfig.Ignored = ignore;
return this;
}
+ ///
+ /// Determines if search suggestions should be displayed in the ui (Advanced Search)
+ ///
+ public TableConfigurator ShowSearchSuggestions(bool show = true) {
+ InnerConfig.ShowSearchSuggestions = show;
+ return this;
+ }
///
/// Configures the property of the table
diff --git a/src/HopFrame.Web/Components/Pages/HopFrameTablePage.razor b/src/HopFrame.Web/Components/Pages/HopFrameTablePage.razor
index 84f19c3..f649f7e 100644
--- a/src/HopFrame.Web/Components/Pages/HopFrameTablePage.razor
+++ b/src/HopFrame.Web/Components/Pages/HopFrameTablePage.razor
@@ -314,7 +314,7 @@
}
private void UpdateSearchSuggestions() {
- if (_config is null) return;
+ if (_config is null || !_config.ShowSearchSuggestions) return;
_searchSuggestions = SearchSuggestions.GenerateSearchSuggestions(_config, _searchTerm ?? string.Empty).ToList();
}
diff --git a/src/HopFrame.Web/Services/Implementation/SearchSuggestionProvider.cs b/src/HopFrame.Web/Services/Implementation/SearchSuggestionProvider.cs
index e65f347..4ade985 100644
--- a/src/HopFrame.Web/Services/Implementation/SearchSuggestionProvider.cs
+++ b/src/HopFrame.Web/Services/Implementation/SearchSuggestionProvider.cs
@@ -7,8 +7,6 @@ namespace HopFrame.Web.Services.Implementation;
public sealed class SearchSuggestionProvider : ISearchSuggestionProvider {
public IEnumerable GenerateSearchSuggestions(TableConfig table, string searchText) {
- if (table.ContextConfig is not DbContextConfig) return [];
-
var searchParts = searchText.Trim().Split(' ');
if (searchParts.Length != 0 && searchParts.Last().EndsWith('=') && !searchText.EndsWith(' ')) {
var part = searchParts.Last()[..^1];
diff --git a/testing/HopFrame.Testing/Program.cs b/testing/HopFrame.Testing/Program.cs
index 2edbd41..320b1c8 100644
--- a/testing/HopFrame.Testing/Program.cs
+++ b/testing/HopFrame.Testing/Program.cs
@@ -51,6 +51,9 @@ builder.Services.AddHopFrame(options => {
.FormatEach((post, _) => post.Caption);
});
+ context.Table()
+ .ShowSearchSuggestions(false);
+
context.Table()
.Property(p => p.Author)
//.Format((user, _) => $"{user.FirstName} {user.LastName}")