Skip to content

feat: add autocomplete and lookup field types for large datasets#92

Merged
phmatray merged 1 commit intomainfrom
feat/27-lookup-fields-interface
Feb 26, 2026
Merged

feat: add autocomplete and lookup field types for large datasets#92
phmatray merged 1 commit intomainfrom
feat/27-lookup-fields-interface

Conversation

@phmatray
Copy link
Owner

Summary

Adds two new field types for handling large datasets (100-10K+ rows) that are impractical with static dropdown lists.

Fixes #27

Changes

Core Abstractions (FormCraft/)

  • IOptionProvider<TModel, TValue> — async search-based option provider interface
  • LookupColumn<TItem> — column definition for lookup table dialogs
  • LookupQuery / LookupResult<TItem> — query/result models for server-side pagination
  • AsAutocomplete() extensions on FieldBuilder for searchable fields (supports both search functions and IOptionProvider)

Autocomplete Field (FormCraft.ForMudBlazor/)

  • MudBlazorAutocompleteFieldComponent — uses MudAutocomplete with server-side search, configurable debounce and min characters
  • MudBlazorAutocompleteFieldRenderer — renderer that activates when AutocompleteSearchFunc or AutocompleteOptionProvider attributes are present

Lookup Field (FormCraft.ForMudBlazor/)

  • MudBlazorLookupFieldComponent — text field with search icon that opens a MudDialog containing MudTable with pagination, sorting, and filtering
  • MudBlazorLookupDialog — reusable dialog component with server-side data, search bar, row selection
  • AsLookup() extension with column configuration, value/display selectors, and field mapping callback
  • MudBlazorLookupFieldRenderer — renderer that activates when LookupDataProvider attribute is present

Tests

  • 10 unit tests for AsAutocomplete() builder extensions (search func, option provider, debounce, min chars, toString, chaining)
  • 11 unit tests for AsLookup() builder extensions (data provider, selectors, columns, onItemSelected, defaults, chaining)

Testing

  • All 579 existing tests pass (0 failures)
  • 21 new unit tests verify builder extension configuration
  • Build succeeds with 0 warnings and 0 errors

Discovered Issues

  • Phase C (async cascading refresh for DependsOn) is not included — the current sync IFieldDependency interface would need an async variant. Recommend as follow-up issue.

Adds IOptionProvider abstraction for async data sources, MudAutocomplete-based
searchable field with debounce, and modal table lookup with MudDialog+MudTable
supporting pagination, sorting, filtering, and multi-field mapping.

Fixes #27
@phmatray phmatray merged commit 4ca7e77 into main Feb 26, 2026
1 check passed
@phmatray phmatray deleted the feat/27-lookup-fields-interface branch February 26, 2026 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request : Lookup fields interface over cascaded drop down (e.g country and city)

1 participant