Skip to content

Commit

Permalink
1.1.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Jurioli committed Aug 28, 2021
1 parent 4cbbd9b commit a520c8f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
Binary file added Blazor.WebForm.Components.1.1.9.1.nupkg
Binary file not shown.
Binary file removed Blazor.WebForm.Components.1.1.9.nupkg
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,19 @@ public static ITemplate GetTemplateProperty<TValue>(this IParameterViewComponent
}
}

public static ITemplate GetInsertTemplateProperty<TValue>(this IParameterViewComponent component, RenderFragment<TValue> value)
where TValue : new()
{
if (value != null)
{
return new RenderFragmentBindableTemplateBuilder<TValue>(value, ExtractValues, () => new TValue());
}
else
{
return null;
}
}

private static IOrderedDictionary ExtractValues<TValue>(Control container, TValue context)
{
return new OrderedDictionary().Apply(() => context);
Expand Down
4 changes: 2 additions & 2 deletions Blazor.WebForm.Components/Blazor.WebForm.Components.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net5.0</TargetFramework>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>Blazor.WebForm.Components.pfx</AssemblyOriginatorKeyFile>
<Version>1.1.9.0</Version>
<Version>1.1.9.1</Version>
<RootNamespace>asp</RootNamespace>
<Copyright>Jurio li</Copyright>
<AssemblyName>Blazor.WebForm.Components</AssemblyName>
Expand All @@ -17,7 +17,7 @@

<ItemGroup>
<PackageReference Include="Applied" Version="1.2.1.5" />
<PackageReference Include="Blazor.WebForm.UI" Version="1.1.9" />
<PackageReference Include="Blazor.WebForm.UI" Version="1.1.9.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.8" />
</ItemGroup>

Expand Down
13 changes: 12 additions & 1 deletion Blazor.WebForm.Components/Inner/Common/InsertItemTemplate.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Blazor.WebForm.UI.PropertyComponents;
using Blazor.WebForm.UI;
using Blazor.WebForm.UI.PropertyComponents;
using System;
using System.Collections.Generic;
using System.Linq;
Expand All @@ -8,6 +9,7 @@
namespace Microsoft.AspNetCore.Components
{
public partial class InsertItemTemplate<TItem> : BindableTemplatePropertyComponent<object, TItem>, ICommonPropertyComponent
where TItem : new()
{
protected override string PropertyName
{
Expand All @@ -16,5 +18,14 @@ protected override string PropertyName
return nameof(InsertItemTemplate<TItem>);
}
}

protected override KeyValuePair<string, object>? OnConvertParameter(KeyValuePair<string, object> parameter)
{
if (parameter.Key == nameof(this.ChildContent))
{
return new KeyValuePair<string, object>(this.PropertyName, this.GetInsertTemplateProperty(this.ChildContent));
}
return base.OnConvertParameter(parameter);
}
}
}

0 comments on commit a520c8f

Please sign in to comment.