Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
vnbaaij committed Jul 19, 2024
2 parents f72e289 + a62d9ce commit 47b8c62
Show file tree
Hide file tree
Showing 98 changed files with 942 additions and 370 deletions.
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ Please provide a summary of the tests affected by this work and any unique strat
<!--- Remove this section if not applicable. -->

- [ ] I have added a new component
- [ ] I have added [Unit Tests](https://github.com/Microsoft/fluentui-blazor/blob/master/unit-tests.md) for my new compontent
- [ ] I have added [Unit Tests](https://github.com/Microsoft/fluentui-blazor/blob/master/unit-tests.md) for my new component
- [ ] I have modified an existing component
- [ ] I have validated the [Unit Tests](https://github.com/Microsoft/fluentui-blazor/blob/master/unit-tests.md) for an existing component
- [ ] I have validated the [Unit Tests](https://github.com/Microsoft/fluentui-blazor/blob/master/unit-tests.md) for an existing component

## ⏭ Next Steps

Expand Down
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<SolutionDir>$(MSBuildThisFileDirectory)</SolutionDir>
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>

<VersionFile>4.9.1</VersionFile>
<VersionPrefix>4.9.1</VersionPrefix>
<VersionFile>4.9.2</VersionFile>
<VersionPrefix>4.9.2</VersionPrefix>
<VersionSuffix></VersionSuffix>
<AssemblyVersion>$(VersionFile)</AssemblyVersion>
<FileVersion>$(VersionFile)</FileVersion>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

## Introduction

The `Microsoft.FluentUI.AspNetCore.Components` package provides a set of [Blazor](https://blazor.net) components which are used to build applications that have a Fluent design (i.e. have the look and feel or modern Microsoft applications).
The `Microsoft.FluentUI.AspNetCore.Components` package provides a set of [Blazor](https://blazor.net) components which are used to build applications that have a Fluent design (i.e. have the look and feel of modern Microsoft applications).

Some of the components in the library are wrappers around Microsoft's official Fluent UI Web Components. Others are components that leverage the Fluent Design System or make it easier to work with Fluent UI. To get up and running with the library, see the **Getting Started** section below.

Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ variables:
# File and Package version
# dev branch: 1.2.4-Preview-23282-1' (PackageSuffix is always ignored in Dev branch)
# main branch: 1.2.4-RC.1' (PackageSuffix is ignored, if empty, in Main branch)
FileVersion: '4.9.1' # Set the next final version here.
FileVersion: '4.9.2' # Set the next final version here.
PackageSuffix: ''
2 changes: 1 addition & 1 deletion examples/Demo/Shared/Components/ApiDocumentation.razor
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
{
var id = Identifier.NewId();
<FluentStack Orientation="Orientation.Horizontal" HorizontalGap="0">
<div>Preview:</div>
<div>Preview:&nbsp;</div>
<FluentIcon Id="@id" Value="@context.Icon" Width="20px" />
<FluentTooltip Anchor="@id" Position="TooltipPosition.Right">
@context.Default
Expand Down
56 changes: 32 additions & 24 deletions examples/Demo/Shared/Components/ApiDocumentation.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ private class MemberDescription
public MemberTypes MemberType { get; set; } = MemberTypes.Property;
public string Name { get; set; } = "";
public string Type { get; set; } = "";
public string[] EnumValues { get; set; } = Array.Empty<string>();
public string[] Parameters { get; set; } = Array.Empty<string>();
public string[] EnumValues { get; set; } = [];
public string[] Parameters { get; set; } = [];
public string? Default { get; set; } = null;
public string Description { get; set; } = "";
public bool IsParameter { get; set; }
Expand All @@ -39,7 +39,7 @@ private class MemberDescription
/// Default for this parameter is 'typeof(string)'
/// </summary>
[Parameter]
public Type[] InstanceTypes { get; set; } = new[] { typeof(string) };
public Type[] InstanceTypes { get; set; } = [typeof(string)];

/// <summary>
/// Gets or sets the label used for displaying the type parameter.
Expand Down Expand Up @@ -70,29 +70,37 @@ private IEnumerable<MemberDescription> GetMembers(MemberTypes type)
{
List<MemberDescription>? members = [];

object? obj;
if (Component.IsGenericType)
object? obj = null;
var created = false;

object? GetObjectValue(string propertyName)
{
if (InstanceTypes is null)
if (!created)
{
throw new ArgumentNullException(nameof(InstanceTypes), "InstanceTypes must be specified when Component is a generic type");
}
if (Component.IsGenericType)
{
if (InstanceTypes is null)
{
throw new ArgumentNullException(nameof(InstanceTypes), "InstanceTypes must be specified when Component is a generic type");
}

// Supply the type to create the generic instance with (needs to be an array)
Type[] typeArgs = InstanceTypes;
Type constructed = Component.MakeGenericType(typeArgs);
// Supply the type to create the generic instance with (needs to be an array)
obj = Activator.CreateInstance(Component.MakeGenericType(InstanceTypes));
}
else
{
obj = Activator.CreateInstance(Component);
}
created = true;
}

obj = Activator.CreateInstance(constructed);
}
else
{
obj = Activator.CreateInstance(Component);
}
return obj?.GetType().GetProperty(propertyName)?.GetValue(obj);
};

IEnumerable<MemberInfo>? allProperties = Component.GetProperties().Select(i => (MemberInfo)i);
IEnumerable<MemberInfo>? allMethods = Component.GetMethods().Where(i => !i.IsSpecialName).Select(i => (MemberInfo)i);
var allProperties = Component.GetProperties().Select(i => (MemberInfo)i);
var allMethods = Component.GetMethods().Where(i => !i.IsSpecialName).Select(i => (MemberInfo)i);

foreach (MemberInfo memberInfo in allProperties.Union(allMethods).OrderBy(m => m.Name))
foreach (var memberInfo in allProperties.Union(allMethods).OrderBy(m => m.Name))
{
try
{
Expand All @@ -105,7 +113,7 @@ private IEnumerable<MemberDescription> GetMembers(MemberTypes type)
{
var isParameter = memberInfo.GetCustomAttribute<ParameterAttribute>() != null;

Type t = propertyInfo.PropertyType;
var t = propertyInfo.PropertyType;
var isEvent = t == typeof(EventCallback) || (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(EventCallback<>));

// Parameters/properties
Expand All @@ -115,11 +123,11 @@ private IEnumerable<MemberDescription> GetMembers(MemberTypes type)
var defaultVaue = "";
if (propertyInfo.PropertyType.IsValueType || propertyInfo.PropertyType == typeof(string))
{
defaultVaue = obj?.GetType().GetProperty(propertyInfo.Name)?.GetValue(obj)?.ToString();
defaultVaue = GetObjectValue(propertyInfo.Name)?.ToString();
}
else if (propertyInfo.PropertyType == typeof(Icon))
{
if (obj?.GetType().GetProperty(propertyInfo.Name)?.GetValue(obj) is Icon value)
if (GetObjectValue(propertyInfo.Name) is Icon value)
{
icon = value;
defaultVaue = $"{value.Variant}.{value.Size}.{value.Name}";
Expand Down Expand Up @@ -201,6 +209,6 @@ private static string[] GetEnumValues(PropertyInfo? propertyInfo)
}
}

return Array.Empty<string>();
return [];
}
}
Loading

0 comments on commit 47b8c62

Please sign in to comment.