diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d6e290f1..73dfe620 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Login to GitHub Container Registry uses: docker/login-action@v3 diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 782f843d..e040e875 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -13,20 +13,21 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - name: Setup .NET - uses: actions/setup-dotnet@v4 + uses: actions/setup-dotnet@v6 with: dotnet-version: | 8.0.x 9.0.x 10.0.x + 11.0.x - name: Restore dependencies run: dotnet restore - name: Build run: dotnet build --no-restore - name: Test - run: dotnet test --configuration Release -f net10.0 --collect:"XPlat Code Coverage" + run: dotnet test --configuration Release -f net11.0 --collect:"XPlat Code Coverage" - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v5 with: diff --git a/.github/workflows/virtualization-benchmark-probe.yml b/.github/workflows/virtualization-benchmark-probe.yml index 5045d38b..37d4e118 100644 --- a/.github/workflows/virtualization-benchmark-probe.yml +++ b/.github/workflows/virtualization-benchmark-probe.yml @@ -17,15 +17,25 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 with: fetch-depth: 0 ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} + - name: Fetch benchmark commits + shell: bash + run: | + git fetch --no-tags origin \ + 7b5faf7ebb7666558d13c447313e9b09c92a110d \ + e7020d49a824a371ab3f3450255f10d9cfad8783 + + git cat-file -e "7b5faf7ebb7666558d13c447313e9b09c92a110d^{commit}" + git cat-file -e "e7020d49a824a371ab3f3450255f10d9cfad8783^{commit}" + - name: Setup .NET - uses: actions/setup-dotnet@v4 + uses: actions/setup-dotnet@v6 with: - dotnet-version: 10.0.x + dotnet-version: 11.0.x - name: Run upstream-to-PR1 structural probe shell: pwsh diff --git a/Dockerfile b/Dockerfile index edaf1a3f..c03a5ba4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:11.0 AS build WORKDIR /src ENV CI=true diff --git a/benchmarks/CodeBeam.MudBlazor.Extensions.Benchmarks/CodeBeam.MudBlazor.Extensions.Benchmarks.csproj b/benchmarks/CodeBeam.MudBlazor.Extensions.Benchmarks/CodeBeam.MudBlazor.Extensions.Benchmarks.csproj index a05ca6ce..1a4b502d 100644 --- a/benchmarks/CodeBeam.MudBlazor.Extensions.Benchmarks/CodeBeam.MudBlazor.Extensions.Benchmarks.csproj +++ b/benchmarks/CodeBeam.MudBlazor.Extensions.Benchmarks/CodeBeam.MudBlazor.Extensions.Benchmarks.csproj @@ -2,7 +2,7 @@ Exe - net10.0 + net11.0 enable enable false diff --git a/docs/CodeBeam.MudBlazor.Extensions.Docs.Server/CodeBeam.MudBlazor.Extensions.Docs.Server.csproj b/docs/CodeBeam.MudBlazor.Extensions.Docs.Server/CodeBeam.MudBlazor.Extensions.Docs.Server.csproj index da9df78f..ba3e67fd 100644 --- a/docs/CodeBeam.MudBlazor.Extensions.Docs.Server/CodeBeam.MudBlazor.Extensions.Docs.Server.csproj +++ b/docs/CodeBeam.MudBlazor.Extensions.Docs.Server/CodeBeam.MudBlazor.Extensions.Docs.Server.csproj @@ -1,7 +1,7 @@  - net10.0 + net11.0 enable enable MudExtensions.Docs.Server diff --git a/docs/CodeBeam.MudBlazor.Extensions.Docs.Wasm/CodeBeam.MudBlazor.Extensions.Docs.Wasm.csproj b/docs/CodeBeam.MudBlazor.Extensions.Docs.Wasm/CodeBeam.MudBlazor.Extensions.Docs.Wasm.csproj index 68dc3144..b942c728 100644 --- a/docs/CodeBeam.MudBlazor.Extensions.Docs.Wasm/CodeBeam.MudBlazor.Extensions.Docs.Wasm.csproj +++ b/docs/CodeBeam.MudBlazor.Extensions.Docs.Wasm/CodeBeam.MudBlazor.Extensions.Docs.Wasm.csproj @@ -1,15 +1,15 @@  - net10.0 + net11.0 enable enable MudExtensions.Docs.Wasm - - + + diff --git a/docs/CodeBeam.MudBlazor.Extensions.Docs.Wasm/wwwroot/CodeBeam.MudBlazor.Extensions.xml b/docs/CodeBeam.MudBlazor.Extensions.Docs.Wasm/wwwroot/CodeBeam.MudBlazor.Extensions.xml index 80e23972..de0c2abd 100644 --- a/docs/CodeBeam.MudBlazor.Extensions.Docs.Wasm/wwwroot/CodeBeam.MudBlazor.Extensions.xml +++ b/docs/CodeBeam.MudBlazor.Extensions.Docs.Wasm/wwwroot/CodeBeam.MudBlazor.Extensions.xml @@ -2351,53 +2351,289 @@ - + A font picker based on MudAutocomplete. - Selected font. + The selected font. + + + + + Occurs when the selected font changes. - Fonts will show in popover. Default is Google latin font list. + The available fonts. - The css import url for adding custom fonts. Default is google font url. Ex. 'https://font.something.com' + The root URL used to import fonts. - If true, the input's label and text always use the theme font instead of font picker's value. + Uses the theme font for the input text. - + - Fires on font changed. + The label displayed for the input. - + - Import selected font automatically. + The placeholder text displayed when the input is empty. - - - + - Clears selected font. + Additional CSS classes applied to the autocomplete popover. - - + - + The visual variant of the input. + + + + + The spacing around the input. + + + + + Reduces the vertical spacing of the input when enabled. + + + + + Requires a value to be selected. + + + + + The validation message displayed when a required value is missing. + + + + + Prevents user interaction when enabled. + + + + + Prevents the user from modifying the selected value. + + + + + Expands the input to fill the available width. + + + + + Automatically focuses the input after its initial render. + + + + + Updates the input value immediately as the user types. + + + + + Displays the input underline when enabled. + + + + + Helper text displayed below the input. + + + + + Displays helper text only while the input has focus. + + + + + Displays a character counter when specified. + + + + + The maximum number of characters allowed in the input. + + + + + The maximum number of suggestions displayed in the dropdown. + + + + + The minimum number of characters required before searching. + + + + + The delay, in milliseconds, before searching after the input changes. + + + + + The position of the input adornment. + + + + + The accessible label for the input adornment. + + + + + The color of the input adornment. + + + + + The icon displayed in the input adornment. + + + + + The text displayed in the input adornment. + + + + + The size of the adornment icon. + + + + + Occurs when the input adornment is clicked. + + + + + Selects the current input text when the input is activated. + + + + + Resets the selected value when the input text is cleared. + + + + + Displays a button for clearing the selected value. + + + + + Selects the highlighted suggestion when the Tab key is pressed. + + + + + Performs validation only after the input value has been modified. + + + + + Indicates whether the input is in an error state. + + + + + The ID of the element containing the validation error message. + + + + + The validation error message displayed below the input. + + + + + The origin point used to anchor the autocomplete popover. + + + + + The origin point used to position the autocomplete popover relative to its anchor. + + + + + The model property used for form validation. + + + + + The validation rules applied to the selected font. + + + + + Controls whether the autocomplete selection is restricted to + the available suggestions. + + + + + Opens the suggestions popover when the input receives focus. + + + + + Additional CSS classes applied to the autocomplete's outer container. + + + + + Additional CSS classes applied to the autocomplete input. + + + + + Occurs when the input loses focus. + + + + + Occurs when a key is pressed in the input. + + + + + Occurs when a key is released in the input. + + + + + Sets focus to the font picker input. + + + + + Clears the autocomplete selection and input text. + + + + + Returns the CSS import declaration for the specified font. + + + + + Clears the selected font. - - @@ -4104,12 +4340,12 @@ - Number of columns. Default is 4. + Number of columns. Default is 1. - Number of rows. Default is 4. + Number of rows. Default is 1. diff --git a/docs/CodeBeam.MudBlazor.Extensions.Docs/CodeBeam.MudBlazor.Extensions.Docs.csproj b/docs/CodeBeam.MudBlazor.Extensions.Docs/CodeBeam.MudBlazor.Extensions.Docs.csproj index 0eb74754..e9919916 100644 --- a/docs/CodeBeam.MudBlazor.Extensions.Docs/CodeBeam.MudBlazor.Extensions.Docs.csproj +++ b/docs/CodeBeam.MudBlazor.Extensions.Docs/CodeBeam.MudBlazor.Extensions.Docs.csproj @@ -1,7 +1,7 @@  - net10.0 + net11.0 enable enable MudExtensions.Docs @@ -13,8 +13,8 @@ - - + + diff --git a/docs/CodeBeam.MudBlazor.Extensions.Docs/Shared/MainLayout.razor b/docs/CodeBeam.MudBlazor.Extensions.Docs/Shared/MainLayout.razor index 20006ef6..0ed2848c 100644 --- a/docs/CodeBeam.MudBlazor.Extensions.Docs/Shared/MainLayout.razor +++ b/docs/CodeBeam.MudBlazor.Extensions.Docs/Shared/MainLayout.razor @@ -49,7 +49,7 @@ @if (_showFontPicker) {
- +
} @Body @@ -132,7 +132,6 @@ }, } }; - StateHasChanged(); } private void ToggleOpen() diff --git a/src/CodeBeam.MudBlazor.Extensions.Code/CodeBeam.MudBlazor.Extensions.Code.csproj b/src/CodeBeam.MudBlazor.Extensions.Code/CodeBeam.MudBlazor.Extensions.Code.csproj index d20ba647..a5c43d3e 100644 --- a/src/CodeBeam.MudBlazor.Extensions.Code/CodeBeam.MudBlazor.Extensions.Code.csproj +++ b/src/CodeBeam.MudBlazor.Extensions.Code/CodeBeam.MudBlazor.Extensions.Code.csproj @@ -1,11 +1,11 @@  - net8.0;net9.0;net10.0 + net8.0;net9.0;net10.0;net11.0 enable enable MIT - 9.1.1 + 9.14.0 CodeBeam.MudBlazor.Extensions.Code CodeBeam CodeBeam @@ -30,7 +30,7 @@ https://www.nuget.org/packages/CodeBeam.MudBlazor.Extensions - + diff --git a/src/CodeBeam.MudBlazor.Extensions.CsvMapper/CodeBeam.MudBlazor.Extensions.CsvMapper.csproj b/src/CodeBeam.MudBlazor.Extensions.CsvMapper/CodeBeam.MudBlazor.Extensions.CsvMapper.csproj index a3cecf88..fab61d81 100644 --- a/src/CodeBeam.MudBlazor.Extensions.CsvMapper/CodeBeam.MudBlazor.Extensions.CsvMapper.csproj +++ b/src/CodeBeam.MudBlazor.Extensions.CsvMapper/CodeBeam.MudBlazor.Extensions.CsvMapper.csproj @@ -1,11 +1,11 @@  - net8.0;net9.0;net10.0 + net8.0;net9.0;net10.0;net11.0 enable enable MIT - 9.1.2 + 9.14.0 CodeBeam.MudBlazor.Extensions.Csv CodeBeam CodeBeam diff --git a/src/CodeBeam.MudBlazor.Extensions.Qr/CodeBeam.MudBlazor.Extensions.Qr.csproj b/src/CodeBeam.MudBlazor.Extensions.Qr/CodeBeam.MudBlazor.Extensions.Qr.csproj index 7291cda3..e2d746fc 100644 --- a/src/CodeBeam.MudBlazor.Extensions.Qr/CodeBeam.MudBlazor.Extensions.Qr.csproj +++ b/src/CodeBeam.MudBlazor.Extensions.Qr/CodeBeam.MudBlazor.Extensions.Qr.csproj @@ -1,11 +1,11 @@  - net8.0;net9.0;net10.0 + net8.0;net9.0;net10.0;net11.0 enable enable MIT - 9.1.0 + 9.14.0 CodeBeam.MudBlazor.Extensions.Qr CodeBeam CodeBeam @@ -30,7 +30,7 @@ - + diff --git a/src/CodeBeam.MudBlazor.Extensions/CodeBeam.MudBlazor.Extensions.csproj b/src/CodeBeam.MudBlazor.Extensions/CodeBeam.MudBlazor.Extensions.csproj index 57395a84..9b791c85 100644 --- a/src/CodeBeam.MudBlazor.Extensions/CodeBeam.MudBlazor.Extensions.csproj +++ b/src/CodeBeam.MudBlazor.Extensions/CodeBeam.MudBlazor.Extensions.csproj @@ -1,12 +1,12 @@  - net8.0;net9.0;net10.0 + net8.0;net9.0;net10.0;net11.0 enable enable MIT README.md - 9.3.1 + 9.14.0 CodeBeam.MudBlazor.Extensions CodeBeam.MudBlazor.Extensions CodeBeam @@ -41,10 +41,10 @@ - + - + diff --git a/src/CodeBeam.MudBlazor.Extensions/Components/FontPicker/MudFontPicker.razor b/src/CodeBeam.MudBlazor.Extensions/Components/FontPicker/MudFontPicker.razor index b4893ca2..e1885fd7 100644 --- a/src/CodeBeam.MudBlazor.Extensions/Components/FontPicker/MudFontPicker.razor +++ b/src/CodeBeam.MudBlazor.Extensions/Components/FontPicker/MudFontPicker.razor @@ -1,17 +1,69 @@ @namespace MudExtensions -@inherits MudAutocomplete +@inherits MudComponentBase - - - + + + - @context + @font diff --git a/src/CodeBeam.MudBlazor.Extensions/Components/FontPicker/MudFontPicker.razor.cs b/src/CodeBeam.MudBlazor.Extensions/Components/FontPicker/MudFontPicker.razor.cs index 9a46dc4a..467941ec 100644 --- a/src/CodeBeam.MudBlazor.Extensions/Components/FontPicker/MudFontPicker.razor.cs +++ b/src/CodeBeam.MudBlazor.Extensions/Components/FontPicker/MudFontPicker.razor.cs @@ -1,97 +1,361 @@ using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Web; using MudBlazor; using MudExtensions.Utilities; +using System.Linq.Expressions; -namespace MudExtensions +namespace MudExtensions; + +/// +/// A font picker based on MudAutocomplete. +/// +public partial class MudFontPicker : MudComponentBase { - /// - /// - /// - public partial class MudFontPicker : MudAutocomplete - { - /// - /// Selected font. - /// - [Parameter] - public string? Font { get; set; } - - /// - /// Fonts will show in popover. Default is Google latin font list. - /// - [Parameter] - public List FontCollection { get; set; } = GoogleFonts.FontListLatin; - - /// - /// The css import url for adding custom fonts. Default is google font url. Ex. 'https://font.something.com' - /// - [Parameter] - public string? RootImportUrl { get; set; } - - /// - /// If true, the input's label and text always use the theme font instead of font picker's value. - /// - [Parameter] - public bool StaticInputText { get; set; } - - /// - /// Fires on font changed. - /// - [Parameter] - public EventCallback FontChanged { get; set; } - - /// - /// Import selected font automatically. - /// - /// - /// - public string ImportFontStyleText(string? font) - { - if (!string.IsNullOrEmpty(RootImportUrl)) - { - return $"@import url('{RootImportUrl}{font?.Replace(" ", "+")}')"; - } - else - { - return $"@import url('https://fonts.googleapis.com/css2?family={font?.Replace(" ", "+")}')"; - } - } - - /// - /// Clears selected font. - /// - /// - public async Task ClearFont() - { - Font = null; - await SetFontValue(null); - } - - /// - /// - /// - /// - /// - protected async Task SetFontValue(string? font) - { - if (font == Font) - { - return; - } - - Font = font; - await FontChanged.InvokeAsync(font); - StateHasChanged(); - } - - private async Task?> SearchFonts(string? searchText, CancellationToken cancellationToken) - { - if (FontCollection == null) - { - return null; - } - await Task.Delay(1); - if (string.IsNullOrEmpty(searchText)) return FontCollection; - return FontCollection.Where(c => c.ToLowerInvariant().Trim().StartsWith(searchText.ToLower().Trim())).ToList(); - } - } + /// + /// The selected font. + /// + [Parameter] + public string? Font { get; set; } + + /// + /// Occurs when the selected font changes. + /// + [Parameter] + public EventCallback FontChanged { get; set; } + + /// + /// The available fonts. + /// + [Parameter] + public List FontCollection { get; set; } = GoogleFonts.FontListLatin; + + /// + /// The root URL used to import fonts. + /// + [Parameter] + public string? RootImportUrl { get; set; } + + /// + /// Uses the theme font for the input text. + /// + [Parameter] + public bool StaticInputText { get; set; } + + /// + /// The label displayed for the input. + /// + [Parameter] public string? Label { get; set; } + + /// + /// The placeholder text displayed when the input is empty. + /// + [Parameter] public string? Placeholder { get; set; } + + /// + /// Additional CSS classes applied to the autocomplete popover. + /// + [Parameter] public string? PopoverClass { get; set; } + + /// + /// The visual variant of the input. + /// + [Parameter] public Variant Variant { get; set; } = Variant.Text; + + /// + /// The spacing around the input. + /// + [Parameter] public Margin Margin { get; set; } = Margin.None; + + /// + /// Reduces the vertical spacing of the input when enabled. + /// + [Parameter] public bool Dense { get; set; } + + /// + /// Requires a value to be selected. + /// + [Parameter] public bool Required { get; set; } + + /// + /// The validation message displayed when a required value is missing. + /// + [Parameter] public string RequiredError { get; set; } = "Required"; + + /// + /// Prevents user interaction when enabled. + /// + [Parameter] public bool Disabled { get; set; } + + /// + /// Prevents the user from modifying the selected value. + /// + [Parameter] public bool ReadOnly { get; set; } + + /// + /// Expands the input to fill the available width. + /// + [Parameter] public bool FullWidth { get; set; } + + /// + /// Automatically focuses the input after its initial render. + /// + [Parameter] public bool AutoFocus { get; set; } + + /// + /// Updates the input value immediately as the user types. + /// + [Parameter] public bool Immediate { get; set; } + + /// + /// Displays the input underline when enabled. + /// + [Parameter] public bool Underline { get; set; } = true; + + /// + /// Helper text displayed below the input. + /// + [Parameter] public string? HelperText { get; set; } + + /// + /// Displays helper text only while the input has focus. + /// + [Parameter] public bool HelperTextOnFocus { get; set; } + + /// + /// Displays a character counter when specified. + /// + [Parameter] public int? Counter { get; set; } + + /// + /// The maximum number of characters allowed in the input. + /// + [Parameter] public int MaxLength { get; set; } = 524288; + + /// + /// The maximum number of suggestions displayed in the dropdown. + /// + [Parameter] public int? MaxItems { get; set; } = 10; + + /// + /// The minimum number of characters required before searching. + /// + [Parameter] public int MinCharacters { get; set; } + + /// + /// The delay, in milliseconds, before searching after the input changes. + /// + [Parameter] public int DebounceInterval { get; set; } = 100; + + /// + /// The position of the input adornment. + /// + [Parameter] public Adornment Adornment { get; set; } = Adornment.None; + + /// + /// The accessible label for the input adornment. + /// + [Parameter] public string? AdornmentAriaLabel { get; set; } + + /// + /// The color of the input adornment. + /// + [Parameter] public Color AdornmentColor { get; set; } = Color.Default; + + /// + /// The icon displayed in the input adornment. + /// + [Parameter] public string? AdornmentIcon { get; set; } + + /// + /// The text displayed in the input adornment. + /// + [Parameter] public string? AdornmentText { get; set; } + + /// + /// The size of the adornment icon. + /// + [Parameter] public Size IconSize { get; set; } = Size.Medium; + + /// + /// Occurs when the input adornment is clicked. + /// + [Parameter] public EventCallback OnAdornmentClick { get; set; } + + /// + /// Selects the current input text when the input is activated. + /// + [Parameter] public bool SelectOnActivation { get; set; } = true; + + /// + /// Resets the selected value when the input text is cleared. + /// + [Parameter] public bool ResetValueOnEmptyText { get; set; } + + /// + /// Displays a button for clearing the selected value. + /// + [Parameter] public bool Clearable { get; set; } + + /// + /// Selects the highlighted suggestion when the Tab key is pressed. + /// + [Parameter] public bool SelectValueOnTab { get; set; } + + /// + /// Performs validation only after the input value has been modified. + /// + [Parameter] public bool OnlyValidateIfDirty { get; set; } + + /// + /// Indicates whether the input is in an error state. + /// + [Parameter] public bool Error { get; set; } + + /// + /// The ID of the element containing the validation error message. + /// + [Parameter] public string? ErrorId { get; set; } + + /// + /// The validation error message displayed below the input. + /// + [Parameter] public string? ErrorText { get; set; } + + /// + /// The origin point used to anchor the autocomplete popover. + /// + [Parameter] public Origin AnchorOrigin { get; set; } = Origin.BottomCenter; + + /// + /// The origin point used to position the autocomplete popover relative to its anchor. + /// + [Parameter] public Origin TransformOrigin { get; set; } = Origin.TopCenter; + + /// + /// The model property used for form validation. + /// + [Parameter] + public Expression>? For { get; set; } + + /// + /// The validation rules applied to the selected font. + /// + [Parameter] + public object? Validation { get; set; } + + /// + /// Controls whether the autocomplete selection is restricted to + /// the available suggestions. + /// + [Parameter] + public bool Strict { get; set; } = true; + + /// + /// Opens the suggestions popover when the input receives focus. + /// + [Parameter] + public bool OpenOnFocus { get; set; } = true; + + /// + /// Additional CSS classes applied to the autocomplete's outer container. + /// + [Parameter] + public string? OuterClass { get; set; } + + /// + /// Additional CSS classes applied to the autocomplete input. + /// + [Parameter] + public string? InputClass { get; set; } + + /// + /// Occurs when the input loses focus. + /// + [Parameter] + public EventCallback OnBlur { get; set; } + + /// + /// Occurs when a key is pressed in the input. + /// + [Parameter] + public EventCallback OnKeyDown { get; set; } + + /// + /// Occurs when a key is released in the input. + /// + [Parameter] + public EventCallback OnKeyUp { get; set; } + + private MudAutocomplete? _autocomplete; + + /// + /// Sets focus to the font picker input. + /// + public ValueTask FocusAsync() + { + return _autocomplete?.FocusAsync() ?? ValueTask.CompletedTask; + } + + /// + /// Clears the autocomplete selection and input text. + /// + public async Task ClearAsync() + { + if (_autocomplete is not null) + await _autocomplete.ClearAsync(); + else + await SetFontValue(null); + } + + private string? InputStyle => + StaticInputText || string.IsNullOrWhiteSpace(Font) + ? Style + : $"{Style};font-family:\"{Font}\" !important"; + + /// + /// Returns the CSS import declaration for the specified font. + /// + public string ImportFontStyleText(string? font) + { + var fontName = font?.Replace(" ", "+"); + + var url = string.IsNullOrEmpty(RootImportUrl) + ? $"https://fonts.googleapis.com/css2?family={fontName}" + : $"{RootImportUrl}{fontName}"; + + return $"@import url('{url}')"; + } + + /// + /// Clears the selected font. + /// + public Task ClearFont() => ClearAsync(); + + private async Task SetFontValue(string? font) + { + if (Font == font) + return; + + Font = font; + await FontChanged.InvokeAsync(font); + } + + private Task?> SearchFonts( + string? searchText, + CancellationToken cancellationToken) + { + cancellationToken.ThrowIfCancellationRequested(); + + IEnumerable fonts = FontCollection ?? []; + + if (!string.IsNullOrWhiteSpace(searchText)) + { + fonts = fonts.Where(font => + font.StartsWith( + searchText.Trim(), + StringComparison.OrdinalIgnoreCase)); + } + + return Task.FromResult?>(fonts); + } } diff --git a/src/CodeBeam.MudBlazor.Extensions/Components/Page/MudPage.razor.cs b/src/CodeBeam.MudBlazor.Extensions/Components/Page/MudPage.razor.cs index 7622a5d9..82822e3e 100644 --- a/src/CodeBeam.MudBlazor.Extensions/Components/Page/MudPage.razor.cs +++ b/src/CodeBeam.MudBlazor.Extensions/Components/Page/MudPage.razor.cs @@ -5,7 +5,6 @@ using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; using MudBlazor; -using MudBlazor.Extensions; using MudBlazor.Utilities; namespace MudExtensions @@ -43,18 +42,18 @@ public partial class MudPage : MudComponentBase public RenderFragment? ChildContent { get; set; } /// - /// Number of columns. Default is 4. + /// Number of columns. Default is 1. /// [Parameter] [Category(CategoryTypes.Item.Appearance)] - public int Column { get; set; } = 4; + public int Column { get; set; } = 1; /// - /// Number of rows. Default is 4. + /// Number of rows. Default is 1. /// [Parameter] [Category(CategoryTypes.Item.Appearance)] - public int Row { get; set; } = 4; + public int Row { get; set; } = 1; /// /// Determines MudPage's height. diff --git a/tests/CodeBeam.MudBlazor.Extensions.UnitTests.Viewer/CodeBeam.MudBlazor.Extensions.UnitTests.Viewer.csproj b/tests/CodeBeam.MudBlazor.Extensions.UnitTests.Viewer/CodeBeam.MudBlazor.Extensions.UnitTests.Viewer.csproj index e78b966f..24307b1a 100644 --- a/tests/CodeBeam.MudBlazor.Extensions.UnitTests.Viewer/CodeBeam.MudBlazor.Extensions.UnitTests.Viewer.csproj +++ b/tests/CodeBeam.MudBlazor.Extensions.UnitTests.Viewer/CodeBeam.MudBlazor.Extensions.UnitTests.Viewer.csproj @@ -1,7 +1,7 @@  - net10.0 + net11.0 enable enable MudExtensions.UnitTests.Viewer @@ -12,8 +12,8 @@ - - + + diff --git a/tests/CodeBeam.MudBlazor.Extensions.UnitTests.Viewer/TestComponents/SelectExtended/StepperTest1.razor b/tests/CodeBeam.MudBlazor.Extensions.UnitTests.Viewer/TestComponents/SelectExtended/StepperTest1.razor index 711d459f..48bbdeea 100644 --- a/tests/CodeBeam.MudBlazor.Extensions.UnitTests.Viewer/TestComponents/SelectExtended/StepperTest1.razor +++ b/tests/CodeBeam.MudBlazor.Extensions.UnitTests.Viewer/TestComponents/SelectExtended/StepperTest1.razor @@ -69,7 +69,7 @@ - + @@ -140,7 +140,7 @@ _loading = true; StateHasChanged(); await Task.Delay(1000); - await _form.Validate(); + await _form.ValidateAsync(); _loading = false; StateHasChanged(); return !_form.IsValid; @@ -150,7 +150,7 @@ _loading = true; StateHasChanged(); await Task.Delay(1000); - await _form2.Validate(); + await _form2.ValidateAsync(); _loading = false; StateHasChanged(); return !_form2.IsValid; diff --git a/tests/CodeBeam.MudBlazor.Extensions.UnitTests/CodeBeam.MudBlazor.Extensions.UnitTests.csproj b/tests/CodeBeam.MudBlazor.Extensions.UnitTests/CodeBeam.MudBlazor.Extensions.UnitTests.csproj index 37039fb5..ae11d52f 100644 --- a/tests/CodeBeam.MudBlazor.Extensions.UnitTests/CodeBeam.MudBlazor.Extensions.UnitTests.csproj +++ b/tests/CodeBeam.MudBlazor.Extensions.UnitTests/CodeBeam.MudBlazor.Extensions.UnitTests.csproj @@ -1,7 +1,7 @@  - net10.0 + net11.0 enable enable MudExtensions.UnitTests @@ -12,7 +12,7 @@ - + diff --git a/tests/CodeBeam.MudBlazor.Extensions.UnitTests/Components/RenderTests.cs b/tests/CodeBeam.MudBlazor.Extensions.UnitTests/Components/RenderTests.cs index cca05c05..0bac1b38 100644 --- a/tests/CodeBeam.MudBlazor.Extensions.UnitTests/Components/RenderTests.cs +++ b/tests/CodeBeam.MudBlazor.Extensions.UnitTests/Components/RenderTests.cs @@ -48,7 +48,7 @@ public void Component_Should_Render(Type componentType) catch (Exception ex) { Assert.Fail( - $"Component render FAILED: {componentType.FullName}\n" + + $"Component render FAILED: {componentType.FullName}\n{ex}" + $"Exception: {ex.GetType().Name}\n" + $"Message: {ex.Message}" ); diff --git a/tests/CodeBeam.MudBlazor.Extensions.UnitTests/Components/SelectExtendedTests.cs b/tests/CodeBeam.MudBlazor.Extensions.UnitTests/Components/SelectExtendedTests.cs index 735456cc..70bf4880 100644 --- a/tests/CodeBeam.MudBlazor.Extensions.UnitTests/Components/SelectExtendedTests.cs +++ b/tests/CodeBeam.MudBlazor.Extensions.UnitTests/Components/SelectExtendedTests.cs @@ -379,7 +379,7 @@ public void Select_Should_FireTextChangedWithNewValue() //Console.WriteLine(comp.Markup); var select = comp.FindComponent>(); string? text = null; - select.SetParametersAndRenderAsync(parameters => parameters.Add(s => s.TextChanged, (Action)(x => text = x))); + select.SetParametersAndRenderAsync(parameters => parameters.Add(s => s.TextChanged, (Action)(x => text = x))); var menu = comp.Find("div.mud-popover"); var input = comp.Find("div.mud-input-control"); // check initial state @@ -425,12 +425,12 @@ public void SingleSelect_Should_FireTextChangedBeforeSelectedValuesChanged() var eventCounter = 0; var textChangedCount = 0; var selectedValuesChangedCount = 0; - select.SetParametersAndRenderAsync(parameters => parameters.Add(s => s.TextChanged, (Action)(x => + select.SetParametersAndRenderAsync(parameters => parameters.Add(s => s.TextChanged, (Action)(x => { textChangedCount = eventCounter++; text = x; }))); - select.SetParametersAndRenderAsync(parameters => parameters.Add(s => s.SelectedValuesChanged, (Action>)(x => + select.SetParametersAndRenderAsync(parameters => parameters.Add(s => s.SelectedValuesChanged, (Action?>)(x => { selectedValuesChangedCount = eventCounter++; selectedValues = x; @@ -487,12 +487,12 @@ public void MultiSelect_Should_FireTextChangedBeforeSelectedValuesChanged() var textChangedCount = 0; var selectedValuesChangedCount = 0; select.Render(p => p.Add(x => x.MultiSelection, true)); - select.SetParametersAndRenderAsync(parameters => parameters.Add(s => s.TextChanged, (Action)(x => + select.SetParametersAndRenderAsync(parameters => parameters.Add(s => s.TextChanged, (Action)(x => { textChangedCount = eventCounter++; text = x; }))); - select.SetParametersAndRenderAsync(parameters => parameters.Add(s => s.SelectedValuesChanged, (Action>)(x => + select.SetParametersAndRenderAsync(parameters => parameters.Add(s => s.SelectedValuesChanged, (Action?>)(x => { selectedValuesChangedCount = eventCounter++; selectedValues = x;