Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Bit.BlazorUI.Extras project linker-friendly (#8439) #8440

Merged
merged 4 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>Bit.BlazorUI</RootNamespace>
<IsTrimmable>false</IsTrimmable>
<IsTrimmable>true</IsTrimmable>
<WarningLevel>0</WarningLevel>
<ResolveStaticWebAssetsInputsDependsOn Condition="'$(TargetFramework)' == 'net8.0'">
BeforeBuildTasks;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// a fork from https://github.com/mariusmuntean/ChartJs.Blazor

using System.Diagnostics.CodeAnalysis;

namespace Bit.BlazorUI;

/// <summary>
Expand All @@ -9,8 +11,6 @@ public partial class BitChart : IAsyncDisposable
{
[Inject] private IJSRuntime _js { get; set; }



/// <summary>
/// The configuration of the chart.
/// </summary>
Expand Down Expand Up @@ -48,7 +48,64 @@ public partial class BitChart : IAsyncDisposable
[Parameter] public IEnumerable<string>? DateAdapterScripts { get; set; }



[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartBarConfig))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartBubbleConfig))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartLineConfig))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartPieConfig))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartPolarAreaConfig))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartRadarConfig))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartScatterConfig))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartConfigBase<,>))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartConfigBase<>))]

[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(JsonStringEnumConverter))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(IndexableOptionConverter))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(FloatingBarPointConverter))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(ClippingJsonConverter))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(JsonWriteOnlyConverter<>))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(JsonObjectEnumConverter))]

[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartBarOptions))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartBubbleOptions))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartBaseConfigOptions))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartLineOptions))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartPieOptions))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartPolarAreaOptions))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartRadarOptions))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartIndexableOption<>))]

[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartBarDataset<>))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartBubbleDataset))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartDataset<>))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartLineDataset<>))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartPieDataset))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartPolarAreaDataset))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartRadarDataset))]

[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartLegend))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartPosition))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartTooltips))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartAnimation))]

[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartBarScales))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartScales))]

[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartCartesianTicks))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartCategoryTicks))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartLinearCartesianTicks))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartLogarithmicTicks))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartTimeTicks))]

[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartBarCategoryAxis))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartBarLinearCartesianAxis))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartBarLogarithmicAxis))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartBarTimeAxis))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartCartesianAxis))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartCartesianAxis<>))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartCategoryAxis))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartLinearCartesianAxis))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartLogarithmicAxis))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BitChartTimeAxis))]
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static ValueTask RemoveChart(this IJSRuntime jsRuntime, string canvasId)
/// <returns></returns>
public static ValueTask<bool> SetupChart(this IJSRuntime jsRuntime, BitChartConfigBase chartConfig)
{
dynamic dynParam = StripNulls(chartConfig);
var dynParam = StripNulls(chartConfig);
Dictionary<string, object> param = ConvertExpandoObjectToDictionary(dynParam);
return jsRuntime.InvokeAsync<bool>("BitBlazorUI.BitChart.setupChart", param);
}
Expand Down Expand Up @@ -93,7 +93,7 @@ private static Dictionary<string, object> RecursivelyConvertIDictToDict(IDiction
/// <returns></returns>
public static ValueTask<bool> UpdateChart(this IJSRuntime jsRuntime, BitChartConfigBase chartConfig)
{
dynamic dynParam = StripNulls(chartConfig);
var dynParam = StripNulls(chartConfig);
Dictionary<string, object> param = ConvertExpandoObjectToDictionary(dynParam);
return jsRuntime.InvokeAsync<bool>("BitBlazorUI.BitChart.updateChart", param);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
ComponentParameters="componentParameters"
ComponentSubClasses="componentSubClasses"
ComponentSubEnums="componentSubEnums">
@if (isLoadingAssemblies)
{
<LoadingComponent />
}
else
{
<ComponentExampleBox Title="Basic" RazorCode="@example1RazorCode" CsharpCode="@example1CsharpCode" Id="example1">
<ExamplePreview>
<div class="grid1">
Expand Down Expand Up @@ -114,5 +108,4 @@
</div>
</ExamplePreview>
</ComponentExampleBox>
}
</ComponentDemo>
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,6 @@ also it's possible to add arbitrary Blazor components to your table cells.
new CountryModel { Code = "VE", Name = "Venezuela", Medals = new MedalsModel { Gold = 1, Silver = 3, Bronze = 0 } },
];

[AutoInject] LazyAssemblyLoader lazyAssemblyLoader = default!;

private bool isLoadingAssemblies = true;

protected override async Task OnInitAsync()
{
allCountries = _countries.AsQueryable();
Expand Down Expand Up @@ -420,18 +416,6 @@ protected override async Task OnInitAsync()
}
};

try
{
if (OperatingSystem.IsBrowser())
{
await lazyAssemblyLoader.LoadAssembliesAsync(["Newtonsoft.Json.wasm", "System.Private.Xml.wasm", "System.Data.Common.wasm"]);
}
}
finally
{
isLoadingAssemblies = false;
}

await base.OnInitAsync();
}

Expand Down
Loading