Skip to content

Commit

Permalink
Fix crud field width when using a custom component
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavnavar committed Oct 30, 2021
1 parent 8fe08f6 commit 1527deb
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 69 deletions.
2 changes: 1 addition & 1 deletion GridBlazor/GridBlazor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<LangVersion>8.0</LangVersion>
<GenerateEmbeddedFilesManifest>True</GenerateEmbeddedFilesManifest>
<EnableDefaultEmbeddedResourceItems>False</EnableDefaultEmbeddedResourceItems>
<Version>3.0.0-preview-1</Version>
<Version>3.0.0-preview-2</Version>
<Title>GridBlazor</Title>
<Description>Grid components for Blazor</Description>
<Summary>Grid components for Blazor</Summary>
Expand Down
18 changes: 10 additions & 8 deletions GridBlazor/Pages/GridCreateComponent.razor
Original file line number Diff line number Diff line change
Expand Up @@ -300,18 +300,20 @@
{
<label class="col-form-label col-md-@column.CrudLabelWidth.ToString()">@column.Title</label>
}
<div class="col-md-@((12 - column.CrudLabelWidth).ToString())">
@if (column.EnableCard)
{
@if (column.EnableCard)
{
<div class="col-md-@((12 - column.CrudLabelWidth).ToString())">
<div class="card panel panel-default">
<div class="card-body panel-body">@_renderFragments.Get(column.Name)</div>
</div>
}
else
{
</div>
}
else
{
<div class="col-md-@(column.CrudWidth.ToString())">
@_renderFragments.Get(column.Name)
}
</div>
</div>
}
</div>
}
}
Expand Down
18 changes: 10 additions & 8 deletions GridBlazor/Pages/GridDeleteComponent.razor
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,20 @@
{
<label class="col-form-label col-md-@column.CrudLabelWidth.ToString()">@column.Title</label>
}
<div class="col-md-@((12 - column.CrudLabelWidth).ToString())">
@if (column.EnableCard)
{
@if (column.EnableCard)
{
<div class="col-md-@((12 - column.CrudLabelWidth).ToString())">
<div class="card panel panel-default">
<div class="card-body panel-body">@_renderFragments.Get(column.Name)</div>
</div>
}
else
{
</div>
}
else
{
<div class="col-md-@(column.CrudWidth.ToString())">
@_renderFragments.Get(column.Name)
}
</div>
</div>
}
</div>
}
}
Expand Down
18 changes: 10 additions & 8 deletions GridBlazor/Pages/GridReadComponent.razor
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,20 @@
{
<label class="col-form-label col-md-@column.CrudLabelWidth.ToString()">@column.Title</label>
}
<div class="col-md-@((12 - column.CrudLabelWidth).ToString())">
@if (column.EnableCard)
{
@if (column.EnableCard)
{
<div class="col-md-@((12 - column.CrudLabelWidth).ToString())">
<div class="card panel panel-default">
<div class="card-body panel-body">@_renderFragments.Get(column.Name)</div>
</div>
}
else
{
</div>
}
else
{
<div class="col-md-@(column.CrudWidth.ToString())">
@_renderFragments.Get(column.Name)
}
</div>
</div>
}
</div>
}
}
Expand Down
18 changes: 10 additions & 8 deletions GridBlazor/Pages/GridUpdateComponent.razor
Original file line number Diff line number Diff line change
Expand Up @@ -300,18 +300,20 @@
{
<label class="col-form-label col-md-@column.CrudLabelWidth.ToString()">@column.Title</label>
}
<div class="col-md-@((12 - column.CrudLabelWidth).ToString())">
@if (column.EnableCard)
{
@if (column.EnableCard)
{
<div class="col-md-@((12 - column.CrudLabelWidth).ToString())">
<div class="card panel panel-default">
<div class="card-body panel-body">@_renderFragments.Get(column.Name)</div>
</div>
}
else
{
</div>
}
else
{
<div class="col-md-@(column.CrudWidth.ToString())">
@_renderFragments.Get(column.Name)
}
</div>
</div>
}
</div>
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

<ItemGroup>
<PackageReference Include="System.ComponentModel.Annotations" Version="6.0.0-preview.4.21253.7" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0-rc.2.21480.5" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 1 addition & 8 deletions GridBlazorClientSide.Shared/Models/Employee.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Text.Json.Serialization;

Expand Down Expand Up @@ -68,12 +66,7 @@ public string Base64String
{
int offset = 78;
ms.Write(Photo, offset, Photo.Length - offset);
var bmp = new Bitmap(ms);
using (var jpegms = new MemoryStream())
{
bmp.Save(jpegms, ImageFormat.Jpeg);
_base64Str = Convert.ToBase64String(jpegms.ToArray());
}
_base64Str = Convert.ToBase64String(ms.ToArray());
}
}
}
Expand Down
1 change: 0 additions & 1 deletion GridBlazorOData.Shared/GridBlazorOData.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

<ItemGroup>
<PackageReference Include="System.ComponentModel.Annotations" Version="6.0.0-preview.4.21253.7" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0-rc.2.21480.5" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 1 addition & 8 deletions GridBlazorOData.Shared/Models/Employee.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Text.Json.Serialization;

Expand Down Expand Up @@ -68,12 +66,7 @@ public string Base64String
{
int offset = 78;
ms.Write(Photo, offset, Photo.Length - offset);
var bmp = new Bitmap(ms);
using (var jpegms = new MemoryStream())
{
bmp.Save(jpegms, ImageFormat.Jpeg);
_base64Str = Convert.ToBase64String(jpegms.ToArray());
}
_base64Str = Convert.ToBase64String(ms.ToArray());
}
}
}
Expand Down
1 change: 0 additions & 1 deletion GridBlazorServerSide/GridBlazorServerSide.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<ItemGroup>
<PackageReference Include="BlazorStrap" Version="1.5.1" />
<PackageReference Include="FluentValidation" Version="10.3.3" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0-rc.2.21480.5" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 1 addition & 8 deletions GridBlazorServerSide/Models/Employee.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Text.Json.Serialization;

Expand Down Expand Up @@ -65,12 +63,7 @@ public string Base64String
{
int offset = 78;
ms.Write(Photo, offset, Photo.Length - offset);
var bmp = new Bitmap(ms);
using (var jpegms = new MemoryStream())
{
bmp.Save(jpegms, ImageFormat.Jpeg);
base64Str = Convert.ToBase64String(jpegms.ToArray());
}
base64Str = Convert.ToBase64String(ms.ToArray());
}
return base64Str;
}
Expand Down
1 change: 0 additions & 1 deletion GridMvc.Demo/GridMvc.Demo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

<ItemGroup>
<PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="2.1.113" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0-rc.2.21480.5" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 1 addition & 8 deletions GridMvc.Demo/Models/Domain/Employee.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ namespace GridMvc.Demo.Models
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Text.Json.Serialization;

Expand Down Expand Up @@ -61,12 +59,7 @@ public string Base64String
{
int offset = 78;
ms.Write(Photo, offset, Photo.Length - offset);
var bmp = new Bitmap(ms);
using (var jpegms = new MemoryStream())
{
bmp.Save(jpegms, ImageFormat.Jpeg);
base64Str = Convert.ToBase64String(jpegms.ToArray());
}
base64Str = Convert.ToBase64String(ms.ToArray());
}
return base64Str;
}
Expand Down

0 comments on commit 1527deb

Please sign in to comment.