Skip to content

Commit

Permalink
Merge branch 'dev' into users/vnbaaij/update-icons-1.1.259
Browse files Browse the repository at this point in the history
  • Loading branch information
vnbaaij authored Oct 9, 2024
2 parents 98b48a6 + 567215f commit 8b1719d
Show file tree
Hide file tree
Showing 35 changed files with 240 additions and 106 deletions.
4 changes: 4 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="$(EfCoreVersion8)" />
<PackageVersion Include="System.Text.Encodings.Web" Version="$(RuntimeVersion8)" />
<PackageVersion Include="System.Text.Json" Version="8.0.4" />

<PackageVersion Include="Microsoft.NET.ILLink.Task" Version="8.0.100-1.23067.1"/>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net9.0'">
<!-- Build dependencies -->
Expand All @@ -64,5 +66,7 @@
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="$(EfCoreVersion9)" />
<PackageVersion Include="System.Text.Encodings.Web" Version="$(RuntimeVersion9)" />
<PackageVersion Include="System.Text.Json" Version="$(RuntimeVersion9)" />

<PackageVersion Include="Microsoft.NET.ILLink.Task" Version="9.0.0-rc.1.24431.7"/>
</ItemGroup>
</Project>
2 changes: 2 additions & 0 deletions examples/Demo/DocGenerator/CodeCommentsGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ private static string CleanupParamName(string value)
value = regex.Replace(value, "");
regex = new("[P,T,M,F]:FluentUI\\.Demo\\.Shared\\.");
value = regex.Replace(value, "");
regex = new("\\(.*\\)$");
value = regex.Replace(value, "");

return value;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/Demo/Server/FluentUI.Demo.Server.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net8.0; net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
Expand Down
4 changes: 4 additions & 0 deletions examples/Demo/Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@

app.UseHttpsRedirection();

#if NET8_0
app.UseStaticFiles();
#else
app.MapStaticAssets();
#endif

app.UseRouting();

Expand Down
47 changes: 40 additions & 7 deletions examples/Demo/Shared/Components/ApiDocumentation.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private IEnumerable<MemberDescription> GetMembers(MemberTypes type)
Type = propertyInfo.ToTypeNameString(),
EnumValues = GetEnumValues(propertyInfo),
Default = defaultVaue,
Description = GetMembersDescription(Component, propertyInfo),
Description = GetDescription(Component, propertyInfo),
IsParameter = isParameter,
Icon = icon
});
Expand All @@ -156,7 +156,7 @@ private IEnumerable<MemberDescription> GetMembers(MemberTypes type)
MemberType = MemberTypes.Event,
Name = propertyInfo.Name,
Type = propertyInfo.ToTypeNameString(),
Description = GetMembersDescription(Component, propertyInfo)
Description = GetDescription(Component, propertyInfo)
});
}
}
Expand All @@ -176,7 +176,7 @@ private IEnumerable<MemberDescription> GetMembers(MemberTypes type)
Name = methodInfo.Name + genericArguments,
Parameters = methodInfo.GetParameters().Select(i => $"{i.ToTypeNameString()} {i.Name}").ToArray(),
Type = methodInfo.ToTypeNameString(),
Description = GetMembersDescription(Component, methodInfo)
Description = GetDescription(Component, methodInfo)
});
}
}
Expand All @@ -195,19 +195,52 @@ private IEnumerable<MemberDescription> GetMembers(MemberTypes type)
}

/// <summary>
/// Gets member description. If none provided, base member description is returned.
/// Gets member description for generic MemberInfo.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="component"></param>
/// <param name="memberInfo"></param>
/// <returns>member description</returns>
private static string GetMembersDescription<T>(Type component, T memberInfo) where T : MemberInfo
private static string GetDescription<T>(Type component, T memberInfo) where T : MemberInfo
{
var description = CodeComments.GetSummary(component.Name + "." + memberInfo.Name);
return DescriptionFromCodeComments(component, memberInfo.Name);
}

/// <summary>
/// Gets description
/// </summary>
/// <param name="component"></param>
/// <param name="methodInfo"></param>
/// <returns></returns>
/// <remarks>
/// see the following about name mangling when dealing with generics
/// https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/xmldoc/#id-strings
/// </remarks>
private static string GetDescription(Type component, MethodInfo methodInfo)
{
var genericArgumentCount = methodInfo.GetGenericArguments().Length;
var mangledName = methodInfo.Name + (genericArgumentCount == 0 ? "" : $"``{genericArgumentCount}");

var description = DescriptionFromCodeComments(component, mangledName);

return description;
}

/// <summary>
/// Gets member description from source generated class of component
/// descriptions. If none found, component base member description
/// is returned.
/// </summary>
/// <param name="component"></param>
/// <param name="name">name of property, method, or event</param>
/// <returns></returns>
private static string DescriptionFromCodeComments(Type component, string name)
{
var description = CodeComments.GetSummary(component.Name + "." + name);

if (description == null && component.BaseType != null)
{
description = GetMembersDescription(component.BaseType, memberInfo);
description = DescriptionFromCodeComments(component.BaseType, name);
}

return description ?? string.Empty;
Expand Down
4 changes: 2 additions & 2 deletions examples/Demo/Shared/FluentUI.Demo.Shared.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFrameworks>net8.0; net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
Expand Down Expand Up @@ -39,7 +39,7 @@
<ItemGroup>
<PackageReference Include="Markdig.Signed" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" />
<PackageReference Include="Microsoft.FluentUI.AspNetCore.Components.Icons" />
<PackageReference Include="Microsoft.FluentUI.AspNetCore.Components.Icons" />
<PackageReference Include="Microsoft.FluentUI.AspNetCore.Components.Emoji" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,12 @@
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.ColumnBase`1.TooltipText">
<summary>
Gets or sets the value to be used as the tooltip and aria-label in this column's cells
Gets or sets the function that defines the value to be used as the tooltip and aria-label in this column's cells
</summary>
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.ColumnBase`1.HeaderTooltip">
<summary>
Gets or sets the tooltip text for the column header.
</summary>
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.ColumnBase`1.HeaderCellItemTemplate">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@inject NavigationManager NavManager

<div style="height: 434px; overflow:auto;" tabindex="-1">
<FluentDataGrid Loading="@(numResults == 0)" ItemsProvider="foodRecallProvider" OnRowDoubleClick="@(()=>DemoLogger.WriteLine("Row double clicked!"))" Virtualize="true" ItemSize="46" GenerateHeader="GenerateHeaderOption.Sticky" TGridItem="FoodRecall" >
<FluentDataGrid style="height: 100%;" Loading="@(numResults == null)" ItemsProvider="foodRecallProvider" OnRowDoubleClick="@(()=>DemoLogger.WriteLine("Row double clicked!"))" Virtualize="true" ItemSize="46" GenerateHeader="GenerateHeaderOption.Sticky" TGridItem="FoodRecall" >
<PropertyColumn Title="ID" Property="@(c => c!.Event_Id)" />
<PropertyColumn Property="@(c => c!.State)" Style="color: #af5f00 ;" />
<PropertyColumn Property="@(c => c!.City)" />
Expand All @@ -21,7 +21,7 @@

@code {
GridItemsProvider<FoodRecall> foodRecallProvider = default!;
int numResults;
int? numResults;

protected override async Task OnInitializedAsync()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
HeaderCellAsButtonWithMenu="true"
Style="height: 405px;overflow:auto;"
ColumnResizeLabels="@customLabels">
<TemplateColumn Tooltip="true" TooltipText="@(c => "Flag of " + c.Name)" Title="Rank" SortBy="@rankSort" Align="Align.Center" InitialSortDirection="SortDirection.Ascending" IsDefaultSortColumn=true>
<TemplateColumn Tooltip="true" HeaderTooltip="Flag of each team" TooltipText="@(c => "Flag of " + c.Name)" Title="Rank" SortBy="@rankSort" Align="Align.Center" InitialSortDirection="SortDirection.Ascending" IsDefaultSortColumn=true>
<img class="flag" src="_content/FluentUI.Demo.Shared/flags/@(context.Code).svg" alt="Flag of @(context.Code)" />
</TemplateColumn>
<PropertyColumn Property="@(c => c.Name)" Sortable="true" Filtered="!string.IsNullOrWhiteSpace(nameFilter)" Tooltip="true" Title="Name of the country">
Expand Down
1 change: 0 additions & 1 deletion examples/Demo/Shared/Pages/Grid/Examples/GridDefault.razor
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@

void OnBreakpointEnterHandler(GridItemSize size)
{
Console.WriteLine($"Page Size: {size}");
DemoLogger.WriteLine($"Page Size: {size}");
}
}
3 changes: 1 addition & 2 deletions examples/Demo/Shared/Pages/Lab/IssueTester.razor
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
@page "/issue-tester"


11 changes: 11 additions & 0 deletions examples/Demo/Shared/Pages/Lab/IssueTesterPage.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@page "/issue-tester"
<PageTitle>@App.PageTitle("Lab Overview")</PageTitle>

<h1><FluentIcon Value="@(new Icons.Regular.Size24.WrenchScrewdriver())" />Issue Tester</h1>


<DemoSection Component="typeof(IssueTester)" Title="Testbed for issues reported on GH" />

@code {

}
7 changes: 3 additions & 4 deletions examples/Demo/Shared/Pages/Lab/LabOverviewPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
them to your project in an easy way. Some might even end up in the trashcan.
</p>
<p>
As these components are not part of the official library, they are not included in the NuGet package. Also, please note that we only
As these components are not part of the official library, they are not included in the NuGet package. Same as with the rest of the library, we only
offer support for these specific components through the <a href="https://github.com/microsoft/fluentui-blazor/">GitHub repository</a> on a best effort base.
<br />
We hope you will help us test-drive the components, both here in the demo environment but also in your own projects, and give us
Expand All @@ -34,14 +34,13 @@
<ul>
<li>MarkdownSection depends on external package <code>Markdig</code>. We do not intend to add components to the library that have external dependencies</li>
<li>
TableOfContents needs to be refreshed if other components (like for example a <code>MarkdownSection</code>) add headings into the DOM. This is possible
but requires a fair ammount of steps we can not automate. We thefore choose to make a sample implementation available in the lab.
TableOfContents needs to be refreshed if other components (like for example a <code>MarkdownSection</code>) add headings into the DOM. This is
possible but requires a fair ammount of steps we can not automate. We therefore choose to make a sample implementation available in the lab.
The TableOfContents page explains and shows the steps needed to make this work.
</li>
</ul>
</p>

<DemoSection Component="typeof(IssueTester)" Title="Testbed for issues reported on GH" />

@code {
[Parameter]
Expand Down
2 changes: 1 addition & 1 deletion examples/Demo/Shared/Pages/TemplatesPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

<blockquote>
<strong>IMPORTANT!!</strong>
<p>Just as with the standard Blazor Web App template, Blazor will use SSR by default. If you want to have interactive components, make sure you add a rendermode to the app, page or component.!</p>
<p>Just as with the standard Blazor Web App template, Blazor will use SSR by default. If you want to have interactive components, make sure you add a rendermode to the app, page or component!</p>
</blockquote>

<h2 id="installation">Installation</h2>
Expand Down
10 changes: 8 additions & 2 deletions examples/Demo/Shared/ReflectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,12 @@ public static string ToTypeNameString(this ParameterInfo parameterInfo, Func<Typ
public static string ToTypeNameString(this MethodInfo methodInfo, Func<Type, Queue<string>, string> typeNameConverter = null,
bool invokeTypeNameConverterForGenericType = false)
{
bool isNullableType = !methodInfo.ReturnType.IsValueType
&& (new NullabilityInfoContext().Create(methodInfo.ReturnParameter).ReadState is NullabilityState.Nullable);

return methodInfo.ReturnType.ToNameStringWithValueTupleNames(
methodInfo.ReturnParameter?.GetCustomAttribute<TupleElementNamesAttribute>()?.TransformNames, typeNameConverter,
invokeTypeNameConverterForGenericType);
invokeTypeNameConverterForGenericType) + (isNullableType ? "?" : "");
}

/// <summary>
Expand All @@ -206,9 +209,12 @@ public static string ToTypeNameString(this MethodInfo methodInfo, Func<Type, Que
public static string ToTypeNameString(this PropertyInfo propertyInfo, Func<Type, Queue<string>, string> typeNameConverter = null,
bool invokeTypeNameConverterForGenericType = false)
{
bool isNullableType = !propertyInfo.PropertyType.IsValueType
&& (new NullabilityInfoContext().Create(propertyInfo).WriteState is NullabilityState.Nullable);

return propertyInfo.PropertyType.ToNameStringWithValueTupleNames(
propertyInfo.GetCustomAttribute<TupleElementNamesAttribute>()?.TransformNames, typeNameConverter,
invokeTypeNameConverterForGenericType);
invokeTypeNameConverterForGenericType) + (isNullableType ? "?" : "");
}

/// <summary>
Expand Down
6 changes: 5 additions & 1 deletion examples/Demo/Shared/Shared/DemoNavProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,11 @@ public DemoNavProvider()
icon: new Icons.Regular.Size20.DocumentTextLink(),
title: "TableOfContents"
),

new NavLink(
href: "/issue-tester",
icon: new Icons.Regular.Size20.WrenchScrewdriver(),
title: "Issue Tester"
),
]
)
];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.VisualStudio.JavaScript.Sdk/1.0.1635611">
<Project Sdk="Microsoft.VisualStudio.JavaScript.Sdk/1.0.1751888">
<PropertyGroup>
<DebugAssetsDirectory>dist\</DebugAssetsDirectory>
<StaticWebAssetSourceId>Microsoft.FluentUI.AspNetCore.Components</StaticWebAssetSourceId>
Expand Down
4 changes: 2 additions & 2 deletions src/Core/Components/DataGrid/Columns/ColumnBase.razor
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
else if (Grid.HeaderCellAsButtonWithMenu)
{
string? tooltip = Tooltip ? Title : null;
string? tooltip = Tooltip ? (HeaderTooltip ?? Title) : null;

<FluentKeyCode Only="new [] { KeyCode.Ctrl, KeyCode.Enter}" OnKeyDown="HandleKeyDown" class="keycapture">
<span class="col-sort-container" @oncontextmenu="@(() => Grid.RemoveSortByColumnAsync(this))" @oncontextmenu:preventDefault>
Expand Down Expand Up @@ -62,7 +62,7 @@
}
else
{
string? tooltip = Tooltip ? Title : null;
string? tooltip = Tooltip ? (HeaderTooltip ?? Title) : null;

@if (Align == Align.Start || Align == Align.Center)
{
Expand Down
8 changes: 7 additions & 1 deletion src/Core/Components/DataGrid/Columns/ColumnBase.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,17 @@ public abstract partial class ColumnBase<TGridItem>
public bool Tooltip { get; set; } = false;

/// <summary>
/// Gets or sets the value to be used as the tooltip and aria-label in this column's cells
/// Gets or sets the function that defines the value to be used as the tooltip and aria-label in this column's cells
/// </summary>
[Parameter]
public Func<TGridItem, string?>? TooltipText { get; set; }

/// <summary>
/// Gets or sets the tooltip text for the column header.
/// </summary>
[Parameter]
public string? HeaderTooltip { get; set; }

/// <summary>
/// Gets or sets an optional template for this column's header cell.
/// If not specified, the default header template includes the <see cref="Title" /> along with any applicable sort indicators and options buttons.
Expand Down
2 changes: 0 additions & 2 deletions src/Core/Components/DataGrid/FluentDataGrid.razor
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
var rowIndex = initialRowIndex;
if (_internalGridContext.Items.Any())
{
Loading = false;
foreach (var item in _internalGridContext.Items)
{
RenderRow(__builder, rowIndex++, item);
Expand All @@ -97,7 +96,6 @@
{
var rowClass = RowClass?.Invoke(item) ?? null;
var rowStyle = RowStyle?.Invoke(item) ?? null;
Loading = false;
<FluentDataGridRow @key="@(ItemKey(item))" GridTemplateColumns=@_internalGridTemplateColumns aria-rowindex="@rowIndex" Class="@rowClass" Style="@rowStyle" TGridItem="TGridItem" Item="@item">
@for (var colIndex = 0; colIndex < _columns.Count; colIndex++)
{
Expand Down
2 changes: 0 additions & 2 deletions src/Core/Components/DataGrid/FluentDataGrid.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -728,8 +728,6 @@ private async ValueTask<GridItemsProviderResult<TGridItem>> ResolveItemsRequestA
{
// No-op; we canceled the operation, so it's fine to suppress this exception.
}

Loading = false;
return GridItemsProviderResult.From(Array.Empty<TGridItem>(), 0);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ internal static class AsyncQueryExecutorSupplier
{
if (queryable is not null)
{
var executor = services.GetService<IAsyncQueryExecutor>();
var executors = services.GetServices<IAsyncQueryExecutor>();

if (executor is null)
if (executors is null)
{
// It's useful to detect if the developer is unaware that they should be using the EF adapter, otherwise
// they will likely never notice and simply deploy an inefficient app that blocks threads on each query.
Expand All @@ -37,9 +37,15 @@ internal static class AsyncQueryExecutorSupplier
throw new InvalidOperationException($"The supplied {nameof(IQueryable)} is provided by Entity Framework. To query it efficiently, see https://github.com/microsoft/fluentui-blazor#use-the-datagrid-component-with-ef-core for the needed steps.");
}
}
else if (executor.IsSupported(queryable))
else
{
return executor;
foreach (var executor in executors)
{
if (executor.IsSupported(queryable))
{
return executor;
}
}
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/Core/Components/List/FluentAutocomplete.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,6 @@ protected override async Task InputHandlerAsync(ChangeEventArgs e)
await OnOptionsSearch.InvokeAsync(args);
}

Console.WriteLine($"args.Items: {args.Items?.Count()}");

Items = args.Items?.Take(MaximumOptionsSearch);

SelectableItem = Items != null
Expand Down
Loading

0 comments on commit 8b1719d

Please sign in to comment.