Skip to content

Commit

Permalink
Merge pull request #67 from Mewriick/Preview8
Browse files Browse the repository at this point in the history
Preview 8 support
  • Loading branch information
Mewriick authored Aug 16, 2019
2 parents 52947dc + f491ee3 commit ade0953
Show file tree
Hide file tree
Showing 54 changed files with 252 additions and 245 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ GridView component for Blazor
> Http client urls cannot started with "/" more info [here](https://github.com/Mewriick/Blazor.FlexGrid/releases/tag/release%2F0.8.1)
# Instalation
[![NuGet Pre Release](https://img.shields.io/badge/nuget-0.8.5-orange.svg)](https://www.nuget.org/packages/Blazor.FlexGrid)
[![NuGet Pre Release](https://img.shields.io/badge/nuget-0.8.6-orange.svg)](https://www.nuget.org/packages/Blazor.FlexGrid)

After nuget instalation you must create in Blazor.Client app Linker.xml file because nuget use some features which are not supported in default mono managed interpreter from WebAssembly
(https://github.com/mono/mono/issues/8872)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0-preview7.19365.7" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0-preview8.19405.7" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.0.12" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion demo/Blazor.Components.Demo.FlexGrid/Pages/FetchData.razor
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ else
@code {
WeatherForecast[] forecasts;

protected override async Task OnInitAsync()
protected override async Task OnInitializedAsync()
{
forecasts = await ForecastService.GetForecastAsync(DateTime.Now);
}
Expand Down
2 changes: 1 addition & 1 deletion demo/Blazor.Components.Demo.FlexGrid/Pages/Grid.razor
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Collection.AddColumnEditValueRenderer(w => w.Summary, editWeatherSummary);
CollectionTableDataAdapter<WeatherForecast>
dataAdapter;

protected override async Task OnInitAsync()
protected override async Task OnInitializedAsync()
{
var forecast = await WeatherService.GetForecastAsync(DateTime.Now);
dataAdapter = new CollectionTableDataAdapter<WeatherForecast>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
CollectionTableDataAdapter<CustomerAddress> customerAddressesDataAdapter;
MasterTableDataAdapter<Customer> customersMasterDataAdapter;

protected override void OnInit()
protected override void OnInitialized()
{
var customers = CustomerService.Customers();
var customersAddresses = CustomerService.CustomersAddresses();
Expand Down
4 changes: 2 additions & 2 deletions demo/Blazor.Components.Demo.FlexGrid/Shared/NavMenu.razor
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<div class="top-row pl-4 navbar navbar-dark">
<a class="navbar-brand" href="/">Blazor.FlexGrid.Demo</a>
<button class="navbar-toggler" onclick=@ToggleNavMenu>
<button class="navbar-toggler" @onclick=ToggleNavMenu>
<span class="navbar-toggler-icon"></span>
</button>
</div>

<div class=@(collapseNavMenu ? "collapse" : null) onclick=@ToggleNavMenu>
<div class=@(collapseNavMenu ? "collapse" : null) @onclick=ToggleNavMenu>
<ul class="nav flex-column">
<li class="nav-item px-3">
<NavLink class="nav-link" href="/" Match=NavLinkMatch.All>
Expand Down
1 change: 0 additions & 1 deletion demo/Blazor.Components.Demo.FlexGrid/_Imports.razor
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

@using System.Net.Http
@using Microsoft.AspNetCore.Components
@using Microsoft.AspNetCore.Components.Layouts
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.JSInterop
@using Blazor.Components.Demo.FlexGrid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
modal.parentNode.insertBefore(fadeDiv, modal.nextSibling);

document.body.className = "modal-open";
this.flexGrid.showedModal.name = modalName;
window.flexGrid.showedModal.name = modalName;

return true;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputType>Exe</OutputType>
<RestoreAdditionalProjectSources>
<!--<RestoreAdditionalProjectSources>
https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json;
https://dotnet.myget.org/F/blazor-dev/api/v3/index.json;
</RestoreAdditionalProjectSources>
</RestoreAdditionalProjectSources>-->
<LangVersion>7.3</LangVersion>
<RazorLangVersion>3.0</RazorLangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.0.0-preview7.19365.7" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.0.0-preview7.19365.7" />
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.0.0-preview8.19405.7" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.0.0-preview8.19405.7" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.0.0-preview8.19405.7" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.DevServer" Version="3.0.0-preview8.19405.7" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class OrderGridConfiguration : IEntityTypeConfiguration<Order>
public void Configure(EntityTypeBuilder<Order> builder)
{
builder.AllowInlineEdit();

builder.HasEmptyItemsMessage("<h1>Test</h1>");
builder.IsMasterTable();
builder.HasDetailRelationship(o => o.OrderItems)
.HasCaption("Order products");
Expand Down
28 changes: 0 additions & 28 deletions demo/Blazor.FlexGrid.Demo.Client/Pages/Counter.razor

This file was deleted.

2 changes: 1 addition & 1 deletion demo/Blazor.FlexGrid.Demo.Client/Pages/Grid.razor
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Collection.AddColumnEditValueRenderer(w => w.Summary, editWeatherSummary);
@code{
CollectionTableDataAdapter<WeatherForecast> dataAdapter;

protected override async Task OnInitAsync()
protected override async Task OnInitializedAsync()
{
var forecast = await Http.GetJsonAsync<WeatherForecast[]>("api/SampleData/WeatherForecastsSimple");
dataAdapter = new CollectionTableDataAdapter<WeatherForecast>(forecast);
Expand Down
2 changes: 0 additions & 2 deletions demo/Blazor.FlexGrid.Demo.Client/Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
<h1>Hello, world!</h1>

Welcome to your new app.

<SurveyPrompt Title="How is Blazor working for you?" />
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
CollectionTableDataAdapter<CustomerAddress> customerAddressesDataAdapter;
MasterTableDataAdapter<Customer> customersMasterDataAdapter;

protected override async Task OnInitAsync()
protected override async Task OnInitializedAsync()
{
var customers = await Http.GetJsonAsync<Customer[]>("api/Customer/Customers");
var customersAddresses = await Http.GetJsonAsync<CustomerAddress[]>("api/Customer/CustomersAddresses");
Expand Down
4 changes: 2 additions & 2 deletions demo/Blazor.FlexGrid.Demo.Client/Shared/NavMenu.razor
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<div class="top-row pl-4 navbar navbar-dark">
<a class="navbar-brand" href="/">Blazor.FlexGrid.Demo</a>
<button class="navbar-toggler" onclick="@ToggleNavMenu">
<button class="navbar-toggler" @onclick="ToggleNavMenu">
<span class="navbar-toggler-icon"></span>
</button>
</div>

<div class=@(collapseNavMenu ? "collapse" : null) onclick="@ToggleNavMenu">
<div class=@(collapseNavMenu ? "collapse" : null) @onclick="ToggleNavMenu">
<ul class="nav flex-column">
<li class="nav-item px-3">
<NavLink class="nav-link" href="/" Match=NavLinkMatch.All>
Expand Down
17 changes: 0 additions & 17 deletions demo/Blazor.FlexGrid.Demo.Client/Shared/SurveyPrompt.razor

This file was deleted.

1 change: 0 additions & 1 deletion demo/Blazor.FlexGrid.Demo.Client/_Imports.razor
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@using System.Net.Http
@using Microsoft.AspNetCore.Components
@using Microsoft.AspNetCore.Components.Layouts
@using Microsoft.AspNetCore.Components.Routing
@using Blazor.FlexGrid.Demo.Client
@using Blazor.FlexGrid.Demo.Client.Shared
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Blazor.Server" Version="3.0.0-preview7.19365.7" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0-preview7.19365.7" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Server" Version="3.0.0-preview8.19405.7" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0-preview8.19405.7" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.0.12" />
</ItemGroup>

Expand Down
18 changes: 18 additions & 0 deletions src/Blazor.FlexGrid/BindConverterExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Microsoft.AspNetCore.Components;
using System.Globalization;

namespace Blazor.FlexGrid
{
public static class BindConverterExtensions
{
public static T ConvertTo<T>(object obj, T defaultValue)
{
if (BindConverter.TryConvertTo<T>(obj, CultureInfo.CurrentCulture, out var convertedValue))
{
return convertedValue;
}

return defaultValue;
}
}
}
17 changes: 8 additions & 9 deletions src/Blazor.FlexGrid/Blazor.FlexGrid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
<BlazorLinkOnBuild>false</BlazorLinkOnBuild>
<LangVersion>7.3</LangVersion>
<PackageId>Blazor.FlexGrid</PackageId>
<PackageVersion>0.8.6</PackageVersion>
<PackageVersion>0.8.7</PackageVersion>
<Title>Blazor.FlexGrid</Title>
<Description>GridView component for Blazor</Description>
<Authors>Jaroslav Surala</Authors>
<PackageProjectUrl>https://github.com/Mewriick/Blazor.FlexGrid</PackageProjectUrl>
<PackageTags>Blazor;GridView;Component</PackageTags>
<Version>0.8.6</Version>
<PackageReleaseNotes>EditColumn custom template support</PackageReleaseNotes>
<Version>0.8.7</Version>
<PackageReleaseNotes>Support .NET Core 3.0 Preview 8</PackageReleaseNotes>
<PackageIconUrl>https://msdnshared.blob.core.windows.net/media/2018/04/Blazor-300x280.jpg</PackageIconUrl>
<RestoreAdditionalProjectSources>
https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json;
Expand All @@ -34,13 +34,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.0.0-preview7.19365.7" />
<PackageReference Include="Microsoft.AspNetCore.Components.Browser" Version="3.0.0-preview7.19365.7" />
<PackageReference Include="Microsoft.AspNetCore.Components.Build" Version="3.0.0-preview3-19153-02" />
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.0.0-preview8.19405.7" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.0.0-preview8.19405.7" />
<PackageReference Include="Microsoft.AspNetCore.Http.Extensions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.0.0-preview7.19362.4" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.0.0-preview7.19362.4" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.6.0-preview7.19362.9" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.0.0-preview8.19405.4" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.0.0-preview8.19405.4" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.6.0-preview8.19405.3" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.0.12" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,17 @@ public virtual EntityTypeBuilder<TEntity> EnableSortingForAllProperties()

return this;
}

public virtual EntityTypeBuilder<TEntity> HasEmptyItemsMessage(string message)
{
if (string.IsNullOrWhiteSpace(message))
{
throw new ArgumentNullException(nameof(message));
}

Builder.HasEmptyItemsMessage(message);

return this;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public bool AllowInlineEdit(InlineEditOptions inlineEditOptions)
public bool AllowCreateItem(CreateItemOptions createItemOptions)
=> HasAnnotation(GridViewAnnotationNames.CreateItemOptions, createItemOptions);


public bool HasEmptyItemsMessage(string message)
=> HasAnnotation(GridViewAnnotationNames.EmptyItemsMessage, message);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public static class GridViewAnnotationNames
public const string MasterDetailOptions = "MasterDetailOptions";
public const string OnlyShowExplicitProperties = "OnlyShowExplicitProperties";
public const string GroupingOptions = "GroupingOptions";
public const string EmptyItemsMessage = "EmptyItemsMessage";

public const string ColumnHeaderStyle = "GridColumnHeaderStyle";
public const string ColumnCaption = "GridColumnCaption";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,19 @@ public GlobalGroupingOptions GroupingOptions
}
}

public string EmptyItemsMessage
{
get
{
var emptyItemsMessage = annotations[GridViewAnnotationNames.EmptyItemsMessage];
if (emptyItemsMessage is NullAnotationValue)
{
return "No data to show here ...";
}

return emptyItemsMessage.ToString();
}
}

public GridAnotations(IEntityType entityType)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Blazor.FlexGrid.DataSet.Options;
using System;
using System;

namespace Blazor.FlexGrid.Components.Configuration.MetaData
{
Expand All @@ -8,13 +7,15 @@ public interface IGridViewAnotations
bool IsMasterTable { get; }

bool OnlyShowExplicitProperties { get; }


string EmptyItemsMessage { get; }

InlineEditOptions InlineEditOptions { get; }

MasterDetailOptions MasterDetailOptions { get; }

CreateItemOptions CreateItemOptions { get; }

GridCssClasses CssClasses { get; }

GlobalGroupingOptions GroupingOptions { get; }
Expand Down
2 changes: 1 addition & 1 deletion src/Blazor.FlexGrid/Components/CreateItemForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class CreateItemForm<TModel, TOutputDto> : ComponentBase
[Inject]
private FlexGridInterop FlexGridInterop { get; set; }

[Parameter] CreateItemContext CreateItemContext { get; set; }
[Parameter] public CreateItemContext CreateItemContext { get; set; }

protected override void BuildRenderTree(RenderTreeBuilder builder)
{
Expand Down
10 changes: 5 additions & 5 deletions src/Blazor.FlexGrid/Components/CreateItemModal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ namespace Blazor.FlexGrid.Components
{
public class CreateItemModal : ComponentBase
{
[Parameter] CreateItemOptions CreateItemOptions { get; set; }
[Parameter] public CreateItemOptions CreateItemOptions { get; set; }

[Parameter] PermissionContext PermissionContext { get; set; }
[Parameter] public PermissionContext PermissionContext { get; set; }

[Parameter] CreateFormCssClasses CreateFormCssClasses { get; set; }
[Parameter] public CreateFormCssClasses CreateFormCssClasses { get; set; }

[Parameter] Action<ItemCreatedArgs> NewItemCreated { get; set; }
[Parameter] public Action<ItemCreatedArgs> NewItemCreated { get; set; }


[Inject]
Expand Down Expand Up @@ -49,7 +49,7 @@ protected override void BuildRenderTree(RenderTreeBuilder builder)
.AddContent("Create Item")
.CloseElement()
.OpenElement(HtmlTagNames.Button, "close")
.AddAttribute(HtmlJSEvents.OnClick, BindMethods.GetEventHandlerValue((UIMouseEventArgs e) => FlexGridInterop.HideModal(CreateItemOptions.CreateItemModalName)))
.AddAttribute(HtmlJSEvents.OnClick, EventCallback.Factory.Create(this, (UIMouseEventArgs e) => FlexGridInterop.HideModal(CreateItemOptions.CreateItemModalName)))
.AddAttribute(HtmlAttributes.Type, "button")
.AddAttribute("data-dismiss", "modal")
.AddAttribute("aria-label", "Close")
Expand Down
Loading

0 comments on commit ade0953

Please sign in to comment.