diff --git a/.github/workflows/build-core-lib.yml b/.github/workflows/build-core-lib.yml index e835091c21..8fb59cf4d2 100644 --- a/.github/workflows/build-core-lib.yml +++ b/.github/workflows/build-core-lib.yml @@ -134,7 +134,7 @@ jobs: - name: Report Generator uses: danielpalme/ReportGenerator-GitHub-Action@5.2.4 with: - reports: '**/coverage.cobertura.xml;**/coverage.net8.0.cobertura.xml;**/coverage.net9.0.cobertura.xml;**/coverage.net10.0.cobertura.xml' + reports: '**/coverage.cobertura.xml;**/coverage.*.cobertura.xml' targetdir: 'CoverageReports' title: 'Unit Tests Code Coverage' classfilters: '-Microsoft.FluentUI.AspNetCore.Components.DesignTokens.*' diff --git a/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml b/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml index 9ab262e217..dfd62c46d4 100644 --- a/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml +++ b/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml @@ -6298,6 +6298,11 @@ Called whenever the selection changed. + + + Gets or sets the title tooltip of this option. + + @@ -6481,6 +6486,12 @@ Gets or sets the function used to determine if an option is initially selected. + + + Gets or sets the function used to determine the option tooltip (title). + If null is returned, then no title is displayed. + + Gets or sets the used to determine if an option is already added to the internal list. @@ -6564,6 +6575,9 @@ + + + diff --git a/examples/Demo/Shared/Pages/List/Listbox/Examples/ListboxManual.razor b/examples/Demo/Shared/Pages/List/Listbox/Examples/ListboxManual.razor index 6c54702428..b5d214caec 100644 --- a/examples/Demo/Shared/Pages/List/Listbox/Examples/ListboxManual.razor +++ b/examples/Demo/Shared/Pages/List/Listbox/Examples/ListboxManual.razor @@ -1,5 +1,5 @@  - This option has no value + This option has no value This option is disabled This option has a value @@ -17,4 +17,4 @@ @code { string? listboxValue = "Item 4"; -} \ No newline at end of file +} diff --git a/examples/Demo/Shared/Pages/List/Select/Examples/SelectDefault.razor b/examples/Demo/Shared/Pages/List/Select/Examples/SelectDefault.razor index c8a1d1c232..45d84df5e5 100644 --- a/examples/Demo/Shared/Pages/List/Select/Examples/SelectDefault.razor +++ b/examples/Demo/Shared/Pages/List/Select/Examples/SelectDefault.razor @@ -8,6 +8,7 @@ Placeholder="Make a selection..." OptionValue="@(p => p.PersonId.ToString())" OptionText="@(p => p.LastName + ", " + p.FirstName)" + OptionTitle="@(p => p.LastName.Length + p.FirstName.Length > 20 ? p.LastName : null)" @bind-Value="@SelectedValue" @bind-SelectedOption="@SelectedPerson" /> diff --git a/src/Core/Components/List/FluentOption.razor b/src/Core/Components/List/FluentOption.razor index 31247caf51..fba3c7fd5a 100644 --- a/src/Core/Components/List/FluentOption.razor +++ b/src/Core/Components/List/FluentOption.razor @@ -7,6 +7,7 @@ style="@Style" disabled="@Disabled" value="@Value" + title="@Title" selected="@Selected" aria-selected="@(Selected ? "true" : "false")" @onclick="@OnClickHandlerAsync" diff --git a/src/Core/Components/List/FluentOption.razor.cs b/src/Core/Components/List/FluentOption.razor.cs index e4fa0b1815..06566a12bf 100644 --- a/src/Core/Components/List/FluentOption.razor.cs +++ b/src/Core/Components/List/FluentOption.razor.cs @@ -48,6 +48,12 @@ public partial class FluentOption : FluentComponentBase, IDisposable wh [Parameter] public EventCallback OnSelect { get; set; } + /// + /// Gets or sets the title tooltip of this option. + /// + [Parameter] + public string? Title { get; set; } + protected override Task OnInitializedAsync() { InternalListContext.Register(this); diff --git a/src/Core/Components/List/ListComponentBase.razor b/src/Core/Components/List/ListComponentBase.razor index a736ee2571..fed0a566d7 100644 --- a/src/Core/Components/List/ListComponentBase.razor +++ b/src/Core/Components/List/ListComponentBase.razor @@ -28,6 +28,7 @@ { ? OptionSelected { get; set; } + /// + /// Gets or sets the function used to determine the option tooltip (title). + /// If null is returned, then no title is displayed. + /// + [Parameter] + public virtual Func? OptionTitle { get; set; } + /// /// Gets or sets the used to determine if an option is already added to the internal list. /// ⚠️ Only available when Multiple = true. @@ -505,6 +512,19 @@ protected virtual bool GetOptionSelected(TOption item) } } + /// + protected virtual string? GetOptionTitle(TOption? item) + { + if (item != null && OptionTitle != null) + { + return OptionTitle.Invoke(item); + } + else + { + return null; + } + } + protected virtual bool? GetOptionDisabled(TOption? item) { if (item != null)