Skip to content
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
21 changes: 11 additions & 10 deletions docs/CodeBeam.MudBlazor.Extensions.Docs.Wasm/App.razor
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@
{
try
{
//Route to the component that contains the QR
if (args.Path == "mudbarcode" || args.Path == "api")
{
var assemblies = await AssemblyLoader
.LoadAssembliesAsync(new[]
{
"zxing.dll",
});
_lazyLoadedAssemblies.AddRange(assemblies);
}
//Route to the component that contains the lazy load components
// if (args.Path == "mudbarcode" || args.Path == "api")
// {
// var assemblies = await AssemblyLoader
// .LoadAssembliesAsync(new[]
// {
// "CodeBeam.MudBlazor.Extensions.Qr.dll",
// "CodeBeam.MudBlazor.Extensions.CsvMapper.dll"
// });
// _lazyLoadedAssemblies.AddRange(assemblies);
// }
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MudExtensions.Docs.Wasm</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.*" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="10.0.*" PrivateAssets="all" />
</ItemGroup>

<!--<ItemGroup>
<BlazorWebAssemblyLazyLoad Include="zxing.dll" />
</ItemGroup>-->

<ItemGroup>
<ProjectReference Include="..\..\src\CodeBeam.MudBlazor.Extensions\CodeBeam.MudBlazor.Extensions.csproj" />
<ProjectReference Include="..\..\docs\CodeBeam.MudBlazor.Extensions.Docs\CodeBeam.MudBlazor.Extensions.Docs.csproj" />
</ItemGroup>
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MudExtensions.Docs.Wasm</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.*" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="10.0.*" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\CodeBeam.MudBlazor.Extensions\CodeBeam.MudBlazor.Extensions.csproj" />
<ProjectReference Include="..\..\docs\CodeBeam.MudBlazor.Extensions.Docs\CodeBeam.MudBlazor.Extensions.Docs.csproj" />
</ItemGroup>

<Target Name="CopyXmlDocToWwwRoot" AfterTargets="Build">
<ItemGroup>
Expand All @@ -35,10 +31,10 @@


<ItemGroup>
<Content Update="wwwroot\favicon.ico">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
<Content Update="wwwroot\favicon.ico">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>

</Project>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<MudText Typo="Typo.body2">@value</MudText>
</MudTd>
<MudTd DataLabel="Description">
@(_docReader?.GetSummary(context) ?? "—")
@(GetDocReaderFor(context.DeclaringType!)?.GetSummary(context) ?? "—")
</MudTd>
</RowTemplate>
<NoRecordsContent>
Expand All @@ -40,7 +40,7 @@
<RowTemplate>
<MudTd DataLabel="Name">@context.Name</MudTd>
<MudTd DataLabel="Type">@DocUtilities.GetFriendlyTypeName(context.PropertyType)</MudTd>
<MudTd DataLabel="Description">@(_docReader?.GetSummary(context) ?? "—")</MudTd>
<MudTd DataLabel="Description">@(GetDocReaderFor(context.DeclaringType!)?.GetSummary(context) ?? "—")</MudTd>
</RowTemplate>
<NoRecordsContent>
No specific items.
Expand All @@ -57,7 +57,7 @@
<RowTemplate>
<MudTd DataLabel="Name">@context.Name</MudTd>
<MudTd DataLabel="Return Type">@DocUtilities.GetFriendlyTypeName(context.ReturnType)</MudTd>
<MudTd DataLabel="Description">@(_docReader?.GetSummary(context) ?? "—")</MudTd>
<MudTd DataLabel="Description">@(GetDocReaderFor(context.DeclaringType!)?.GetSummary(context) ?? "—")</MudTd>
</RowTemplate>
<NoRecordsContent>
No specific items.
Expand All @@ -79,7 +79,8 @@
[Parameter] public Type? Type { get; set; }
[Parameter] public MudExtensionComponentInfo? Component { get; set; }

private SimpleXmlDocReader? _docReader;
// private SimpleXmlDocReader? _docReader;
private readonly Dictionary<string, SimpleXmlDocReader> _docReaders = new();

private List<string> _excludedMethods = new()
{
Expand Down Expand Up @@ -122,24 +123,55 @@
}
}

protected override async Task OnInitializedAsync()
private SimpleXmlDocReader? GetDocReaderFor(Type memberType)
{
string? xmlContent = null;
var asmName = memberType.Assembly.GetName().Name;

if (OperatingSystem.IsBrowser())
return asmName switch
{
xmlContent = await Http.GetStringAsync("CodeBeam.MudBlazor.Extensions.xml");
}
else
"CodeBeam.MudBlazor.Extensions" => _docReaders.GetValueOrDefault("CodeBeam.MudBlazor.Extensions.xml"),
"CodeBeam.MudBlazor.Extensions.Qr" => _docReaders.GetValueOrDefault("CodeBeam.MudBlazor.Extensions.Qr.xml"),
"CodeBeam.MudBlazor.Extensions.CsvMapper" => _docReaders.GetValueOrDefault("CodeBeam.MudBlazor.Extensions.CsvMapper.xml"),
_ => null
};
}

protected override async Task OnInitializedAsync()
{
var xmlFiles = new[]
{
var xmlPath = Path.Combine(AppContext.BaseDirectory, "CodeBeam.MudBlazor.Extensions.xml");
if (File.Exists(xmlPath))
xmlContent = await File.ReadAllTextAsync(xmlPath);
}
"CodeBeam.MudBlazor.Extensions.xml",
"CodeBeam.MudBlazor.Extensions.Qr.xml",
"CodeBeam.MudBlazor.Extensions.CsvMapper.xml"
};

if (!string.IsNullOrEmpty(xmlContent))
foreach (var file in xmlFiles)
{
_docReader = new SimpleXmlDocReader(xmlContent);
string? xmlContent = null;

try
{
if (OperatingSystem.IsBrowser())
{
xmlContent = await Http.GetStringAsync(file);
}
else
{
var xmlPath = Path.Combine(AppContext.BaseDirectory, file);
if (File.Exists(xmlPath))
xmlContent = await File.ReadAllTextAsync(xmlPath);
}

if (!string.IsNullOrWhiteSpace(xmlContent))
{
_docReaders[file] = new SimpleXmlDocReader(xmlContent);
}
}
catch
{

}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Version>1.0.0</Version>
<Version>9.0.0-preview.1</Version>
<Title>CodeBeam.MudBlazor.Extensions.Csv</Title>
<Authors>CodeBeam</Authors>
<Company>CodeBeam</Company>
Expand All @@ -20,10 +20,11 @@
<RepositoryUrl>https://github.com/CodeBeamOrg/CodeBeam.MudBlazor.Extensions</RepositoryUrl>
<PackageTags>Blazor; MudBlazor; Component; Extension; Csv; Mapper;</PackageTags>
<RootNamespace>MudExtensions</RootNamespace>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="8.3.0" />
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="9.0.0-preview.1" />
<PackageReference Include="CsvHelper" Version="33.1.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.ComponentModel;
using CsvHelper;
using CsvHelper;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Forms;
using MudBlazor;
Expand All @@ -11,9 +10,19 @@

namespace MudExtensions
{
internal class ConfirmedDefaultValue
/// <summary>
///
/// </summary>
public class ConfirmedDefaultValue
{
/// <summary>
///
/// </summary>
public string? DefaultValue { get; set; }

/// <summary>
///
/// </summary>
public bool Confirmed { get; set; }
}

Expand Down Expand Up @@ -315,7 +324,7 @@ private async Task OnImport()
await using (var csv = new CsvWriter(writer, config))
{
var dynamicContent = CsvContent?.Cast<dynamic>();
await csv.WriteRecordsAsync(dynamicContent);
await csv.WriteRecordsAsync(dynamicContent ?? Enumerable.Empty<dynamic>());

var str = writer.ToString();
FileContentByte = Encoding.UTF8.GetBytes(str);
Expand Down
Loading
Loading