diff --git a/Sources/BlazorApp/.vs/BlazorApp/DesignTimeBuild/.dtbcache.v2 b/Sources/BlazorApp/.vs/BlazorApp/DesignTimeBuild/.dtbcache.v2 index b255ca1..94dff13 100644 Binary files a/Sources/BlazorApp/.vs/BlazorApp/DesignTimeBuild/.dtbcache.v2 and b/Sources/BlazorApp/.vs/BlazorApp/DesignTimeBuild/.dtbcache.v2 differ diff --git a/Sources/BlazorApp/.vs/BlazorApp/v17/.suo b/Sources/BlazorApp/.vs/BlazorApp/v17/.suo index 372aa25..dea143e 100644 Binary files a/Sources/BlazorApp/.vs/BlazorApp/v17/.suo and b/Sources/BlazorApp/.vs/BlazorApp/v17/.suo differ diff --git a/Sources/BlazorApp/BlazorApp/Components/Card.razor b/Sources/BlazorApp/BlazorApp/Components/Card.razor new file mode 100644 index 0000000..422077c --- /dev/null +++ b/Sources/BlazorApp/BlazorApp/Components/Card.razor @@ -0,0 +1,6 @@ +@typeparam TItem +
+ @CardHeader(Item) + @CardBody(Item) + @CardFooter +
\ No newline at end of file diff --git a/Sources/BlazorApp/BlazorApp/Components/Card.razor.cs b/Sources/BlazorApp/BlazorApp/Components/Card.razor.cs new file mode 100644 index 0000000..de0e02c --- /dev/null +++ b/Sources/BlazorApp/BlazorApp/Components/Card.razor.cs @@ -0,0 +1,16 @@ +using Microsoft.AspNetCore.Components; +namespace BlazorApp.Components; +public partial class Card +{ + [Parameter] + public RenderFragment CardBody { get; set; } + + [Parameter] + public RenderFragment CardFooter { get; set; } + + [Parameter] + public RenderFragment CardHeader { get; set; } + + [Parameter] + public TItem Item { get; set; } +} \ No newline at end of file diff --git a/Sources/BlazorApp/BlazorApp/Components/Crafting.razor b/Sources/BlazorApp/BlazorApp/Components/Crafting.razor new file mode 100644 index 0000000..65c9b93 --- /dev/null +++ b/Sources/BlazorApp/BlazorApp/Components/Crafting.razor @@ -0,0 +1,50 @@ + +
+
+
+ +
Available items:
+
+
+ + @foreach (var item in Items) + { + + } +
+
+ +
+ +
+
Recipe
+ +
+ +
+ + + + + + + + + +
+
+ +
Result
+
+ +
+
+ +
+
Actions
+
+
+
+
+
+
\ No newline at end of file diff --git a/Sources/BlazorApp/BlazorApp/Components/Crafting.razor.cs b/Sources/BlazorApp/BlazorApp/Components/Crafting.razor.cs new file mode 100644 index 0000000..085096f --- /dev/null +++ b/Sources/BlazorApp/BlazorApp/Components/Crafting.razor.cs @@ -0,0 +1,80 @@ +using BlazorApp.Models; +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using System.Collections.ObjectModel; +using System.Collections.Specialized; + +namespace BlazorApp.Components +{ + public partial class Crafting + { + private Item _recipeResult; + + public Crafting() + { + Actions = new ObservableCollection(); + Actions.CollectionChanged += OnActionsCollectionChanged; + this.RecipeItems = new List { null, null, null, null, null, null, null, null, null }; + } + + public ObservableCollection Actions { get; set; } + public Item CurrentDragItem { get; set; } + + [Parameter] + public List Items { get; set; } + + public List RecipeItems { get; set; } + + public Item RecipeResult + { + get => this._recipeResult; + set + { + if (this._recipeResult == value) + { + return; + } + + this._recipeResult = value; + this.StateHasChanged(); + } + } + + [Parameter] + public List Recipes { get; set; } + + /// + /// Gets or sets the java script runtime. + /// + [Inject] + internal IJSRuntime JavaScriptRuntime { get; set; } + + public void CheckRecipe() + { + RecipeResult = null; + + // Get the current model + var currentModel = string.Join("|", this.RecipeItems.Select(s => s != null ? s.Name : string.Empty)); + + this.Actions.Add(new CraftingAction { Action = $"Items : {currentModel}" }); + + foreach (var craftingRecipe in Recipes) + { + // Get the recipe model + var recipeModel = string.Join("|", craftingRecipe.Have.SelectMany(s => s)); + + this.Actions.Add(new CraftingAction { Action = $"Recipe model : {recipeModel}" }); + + if (currentModel == recipeModel) + { + RecipeResult = craftingRecipe.Give; + } + } + } + + private void OnActionsCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) + { + JavaScriptRuntime.InvokeVoidAsync("Crafting.AddActions", e.NewItems); + } + } +} diff --git a/Sources/BlazorApp/BlazorApp/Components/Crafting.razor.css b/Sources/BlazorApp/BlazorApp/Components/Crafting.razor.css new file mode 100644 index 0000000..2a388f2 --- /dev/null +++ b/Sources/BlazorApp/BlazorApp/Components/Crafting.razor.css @@ -0,0 +1,19 @@ +.css-grid { + grid-template-columns: repeat(4,minmax(0,1fr)); + gap: 10px; + display: grid; + width: 286px; +} + +.css-recipe { + grid-template-columns: repeat(3,minmax(0,1fr)); + gap: 10px; + display: grid; + width: 212px; +} + +.actions { + border: 1px solid black; + height: 250px; + overflow: scroll; +} diff --git a/Sources/BlazorApp/BlazorApp/Components/Crafting.razor.js b/Sources/BlazorApp/BlazorApp/Components/Crafting.razor.js new file mode 100644 index 0000000..8fdb58e --- /dev/null +++ b/Sources/BlazorApp/BlazorApp/Components/Crafting.razor.js @@ -0,0 +1,16 @@ +window.Crafting = +{ + AddActions: function (data) { + + data.forEach(element => { + var div = document.createElement('div'); + div.innerHTML = 'Action: ' + element.action + ' - Index: ' + element.index; + + if (element.item) { + div.innerHTML += ' - Item Name: ' + element.item.name; + } + + document.getElementById('actions').appendChild(div); + }); + } +} \ No newline at end of file diff --git a/Sources/BlazorApp/BlazorApp/Components/CraftingAction.cs b/Sources/BlazorApp/BlazorApp/Components/CraftingAction.cs new file mode 100644 index 0000000..45393c9 --- /dev/null +++ b/Sources/BlazorApp/BlazorApp/Components/CraftingAction.cs @@ -0,0 +1,11 @@ +using BlazorApp.Models; + +namespace BlazorApp.Components +{ + public class CraftingAction + { + public string Action { get; set; } + public int Index { get; set; } + public Item Item { get; set; } + } +} diff --git a/Sources/BlazorApp/BlazorApp/Components/CraftingItem.razor b/Sources/BlazorApp/BlazorApp/Components/CraftingItem.razor new file mode 100644 index 0000000..e64e6cd --- /dev/null +++ b/Sources/BlazorApp/BlazorApp/Components/CraftingItem.razor @@ -0,0 +1,13 @@ +
+ + @if (Item != null) + { + @Item.DisplayName + } +
\ No newline at end of file diff --git a/Sources/BlazorApp/BlazorApp/Components/CraftingItem.razor.cs b/Sources/BlazorApp/BlazorApp/Components/CraftingItem.razor.cs new file mode 100644 index 0000000..5035244 --- /dev/null +++ b/Sources/BlazorApp/BlazorApp/Components/CraftingItem.razor.cs @@ -0,0 +1,64 @@ +using BlazorApp.Models; +using Blazorise; +using Microsoft.AspNetCore.Components; + +namespace BlazorApp.Components +{ + public partial class CraftingItem + { + [Parameter] + public int Index { get; set; } + + [Parameter] + public Item Item { get; set; } + + [Parameter] + public bool NoDrop { get; set; } + + [CascadingParameter] + public Crafting Parent { get; set; } + + internal void OnDragEnter() + { + if (NoDrop) + { + return; + } + + Parent.Actions.Add(new CraftingAction { Action = "Drag Enter", Item = this.Item, Index = this.Index }); + } + + internal void OnDragLeave() + { + if (NoDrop) + { + return; + } + + Parent.Actions.Add(new CraftingAction { Action = "Drag Leave", Item = this.Item, Index = this.Index }); + } + + internal void OnDrop() + { + if (NoDrop) + { + return; + } + + this.Item = Parent.CurrentDragItem; + Parent.RecipeItems[this.Index] = this.Item; + + Parent.Actions.Add(new CraftingAction { Action = "Drop", Item = this.Item, Index = this.Index }); + + // Check recipe + Parent.CheckRecipe(); + } + + private void OnDragStart() + { + Parent.CurrentDragItem = this.Item; + + Parent.Actions.Add(new CraftingAction { Action = "Drag Start", Item = this.Item, Index = this.Index }); + } + } +} diff --git a/Sources/BlazorApp/BlazorApp/Components/CraftingItem.razor.css b/Sources/BlazorApp/BlazorApp/Components/CraftingItem.razor.css new file mode 100644 index 0000000..b2d4521 --- /dev/null +++ b/Sources/BlazorApp/BlazorApp/Components/CraftingItem.razor.css @@ -0,0 +1,6 @@ +.item { + width: 64px; + height: 64px; + border: 1px solid; + overflow: hidden; +} diff --git a/Sources/BlazorApp/BlazorApp/Components/CraftingRecipe.cs b/Sources/BlazorApp/BlazorApp/Components/CraftingRecipe.cs new file mode 100644 index 0000000..7cbe8a4 --- /dev/null +++ b/Sources/BlazorApp/BlazorApp/Components/CraftingRecipe.cs @@ -0,0 +1,10 @@ +using BlazorApp.Models; + +namespace BlazorApp.Components +{ + public class CraftingRecipe + { + public Item Give { get; set; } + public List> Have { get; set; } + } +} diff --git a/Sources/BlazorApp/BlazorApp/Components/ShowItems.razor b/Sources/BlazorApp/BlazorApp/Components/ShowItems.razor new file mode 100644 index 0000000..e8fccfd --- /dev/null +++ b/Sources/BlazorApp/BlazorApp/Components/ShowItems.razor @@ -0,0 +1,11 @@ +@typeparam TItem + +
+ @if ((Items?.Count ?? 0) != 0) + { + @foreach (var item in Items) + { + @ShowTemplate(item); + } + } +
\ No newline at end of file diff --git a/Sources/BlazorApp/BlazorApp/Components/ShowItems.razor.cs b/Sources/BlazorApp/BlazorApp/Components/ShowItems.razor.cs new file mode 100644 index 0000000..75587b0 --- /dev/null +++ b/Sources/BlazorApp/BlazorApp/Components/ShowItems.razor.cs @@ -0,0 +1,13 @@ +using Microsoft.AspNetCore.Components; + +namespace BlazorApp.Components +{ + public partial class ShowItems + { + [Parameter] + public List Items { get; set; } + + [Parameter] + public RenderFragment ShowTemplate { get; set; } + } +} diff --git a/Sources/BlazorApp/BlazorApp/Components/TestRenderFragment.razor b/Sources/BlazorApp/BlazorApp/Components/TestRenderFragment.razor new file mode 100644 index 0000000..176ee34 --- /dev/null +++ b/Sources/BlazorApp/BlazorApp/Components/TestRenderFragment.razor @@ -0,0 +1,8 @@ +

TestRenderFragment

+ +@code { + [Parameter] + public RenderFragment ChildContent { get; set; } +} + +@ChildContent \ No newline at end of file diff --git a/Sources/BlazorApp/BlazorApp/Controllers/CultureControllers.cs b/Sources/BlazorApp/BlazorApp/Controllers/CultureControllers.cs new file mode 100644 index 0000000..328c28e --- /dev/null +++ b/Sources/BlazorApp/BlazorApp/Controllers/CultureControllers.cs @@ -0,0 +1,31 @@ +using Microsoft.AspNetCore.Localization; +using Microsoft.AspNetCore.Mvc; + +/// +/// The culture controller. +/// +[Route("[controller]/[action]")] +public class CultureController : Controller +{ + /// + /// Sets the culture. + /// + /// The culture. + /// The redirect URI. + /// + /// The action result. + /// + public IActionResult SetCulture(string culture, string redirectUri) + { + if (culture != null) + { + // Define a cookie with the selected culture + this.HttpContext.Response.Cookies.Append( + CookieRequestCultureProvider.DefaultCookieName, + CookieRequestCultureProvider.MakeCookieValue( + new RequestCulture(culture))); + } + + return this.LocalRedirect(redirectUri); + } +} \ No newline at end of file diff --git a/Sources/BlazorApp/BlazorApp/Models/Cake.cs b/Sources/BlazorApp/BlazorApp/Models/Cake.cs new file mode 100644 index 0000000..5593683 --- /dev/null +++ b/Sources/BlazorApp/BlazorApp/Models/Cake.cs @@ -0,0 +1,8 @@ +namespace BlazorApp.Models; + +public class Cake +{ + public int Id { get; set; } + public string Name { get; set; } + public decimal Cost { get; set; } +} \ No newline at end of file diff --git a/Sources/BlazorApp/BlazorApp/Pages/Index.razor b/Sources/BlazorApp/BlazorApp/Pages/Index.razor index 6085c4a..16aaf67 100644 --- a/Sources/BlazorApp/BlazorApp/Pages/Index.razor +++ b/Sources/BlazorApp/BlazorApp/Pages/Index.razor @@ -1,4 +1,6 @@ @page "/" +@using System.Globalization +@using BlazorApp.Components Index @@ -7,3 +9,42 @@ Welcome to your new app. + +

+ CurrentCulture: @CultureInfo.CurrentCulture +

+ + + +
+ Cake Token Number - @headContext.Id +
+
+ +
+
@bodyContext.Name
+
$ @bodyContext.Cost
+
+
+
+ + + +
+
+ Cake Token Id - @CakeContext.Id +
+
+
@CakeContext.Name
+

Price $@CakeContext.Cost

+
+ +
+
+
+ + +
Content of my TestRenderFragment
+
\ No newline at end of file diff --git a/Sources/BlazorApp/BlazorApp/Pages/Index.razor.cs b/Sources/BlazorApp/BlazorApp/Pages/Index.razor.cs new file mode 100644 index 0000000..22c3121 --- /dev/null +++ b/Sources/BlazorApp/BlazorApp/Pages/Index.razor.cs @@ -0,0 +1,35 @@ +namespace BlazorApp.Pages; +using BlazorApp.Models; + +public partial class Index +{ + private Cake CakeItem = new Cake + { + Id = 1, + Name = "Black Forest", + Cost = 50 + }; + + public List Cakes { get; set; } + + protected override Task OnAfterRenderAsync(bool firstRender) + { + LoadCakes(); + StateHasChanged(); + return base.OnAfterRenderAsync(firstRender); + } + + public void LoadCakes() + { + Cakes = new List + { + // items hidden for display purpose + new Cake + { + Id = 1, + Name = "Red Velvet", + Cost = 60 + }, + }; + } +} \ No newline at end of file diff --git a/Sources/BlazorApp/BlazorApp/Pages/List.razor b/Sources/BlazorApp/BlazorApp/Pages/List.razor index 26dd94a..f58987f 100644 --- a/Sources/BlazorApp/BlazorApp/Pages/List.razor +++ b/Sources/BlazorApp/BlazorApp/Pages/List.razor @@ -1,7 +1,7 @@ @page "/list" @using BlazorApp.Models -

List

+

@Localizer["Title"]

diff --git a/Sources/BlazorApp/BlazorApp/Pages/List.razor.cs b/Sources/BlazorApp/BlazorApp/Pages/List.razor.cs index 668d889..370d201 100644 --- a/Sources/BlazorApp/BlazorApp/Pages/List.razor.cs +++ b/Sources/BlazorApp/BlazorApp/Pages/List.razor.cs @@ -16,6 +16,9 @@ public partial class List private int totalItem; + [Inject] + public IStringLocalizer Localizer { get; set; } + [Inject] public IDataService DataService { get; set; } diff --git a/Sources/BlazorApp/BlazorApp/Pages/Pets1.razor b/Sources/BlazorApp/BlazorApp/Pages/Pets1.razor new file mode 100644 index 0000000..065feec --- /dev/null +++ b/Sources/BlazorApp/BlazorApp/Pages/Pets1.razor @@ -0,0 +1,29 @@ +@page "/pets1" + +

Pets

+ + + + ID + Name + + + @pet.PetId + @pet.Name + + + +@code { + private List pets = new() + { + new Pet { PetId = 2, Name = "Mr. Bigglesworth" }, + new Pet { PetId = 4, Name = "Salem Saberhagen" }, + new Pet { PetId = 7, Name = "K-9" } + }; + + private class Pet + { + public int PetId { get; set; } + public string? Name { get; set; } + } +} \ No newline at end of file diff --git a/Sources/BlazorApp/BlazorApp/Pages/Pets2.razor b/Sources/BlazorApp/BlazorApp/Pages/Pets2.razor new file mode 100644 index 0000000..c545e37 --- /dev/null +++ b/Sources/BlazorApp/BlazorApp/Pages/Pets2.razor @@ -0,0 +1,29 @@ +@page "/pets2" + +

Pets

+ + + + ID + Name + + + @pet.PetId + @pet.Name + + + +@code { + private List pets = new() + { + new Pet { PetId = 2, Name = "Mr. Bigglesworth" }, + new Pet { PetId = 4, Name = "Salem Saberhagen" }, + new Pet { PetId = 7, Name = "K-9" } + }; + + private class Pet + { + public int PetId { get; set; } + public string? Name { get; set; } + } +} \ No newline at end of file diff --git a/Sources/BlazorApp/BlazorApp/Pages/Pets3.razor b/Sources/BlazorApp/BlazorApp/Pages/Pets3.razor new file mode 100644 index 0000000..fd52259 --- /dev/null +++ b/Sources/BlazorApp/BlazorApp/Pages/Pets3.razor @@ -0,0 +1,29 @@ +@page "/pets3" + +

Pets

+ + + + ID + Name + + + @context.PetId + @context.Name + + + +@code { + private List pets = new() + { + new Pet { PetId = 2, Name = "Mr. Bigglesworth" }, + new Pet { PetId = 4, Name = "Salem Saberhagen" }, + new Pet { PetId = 7, Name = "K-9" } + }; + + private class Pet + { + public int PetId { get; set; } + public string? Name { get; set; } + } +} \ No newline at end of file diff --git a/Sources/BlazorApp/BlazorApp/Pages/Pets4.razor b/Sources/BlazorApp/BlazorApp/Pages/Pets4.razor new file mode 100644 index 0000000..ac0d918 --- /dev/null +++ b/Sources/BlazorApp/BlazorApp/Pages/Pets4.razor @@ -0,0 +1,29 @@ +@page "/pets4" + +

Pets

+ + + + ID + Name + + + @context.PetId + @context.Name + + + +@code { + private List pets = new() + { + new Pet { PetId = 2, Name = "Mr. Bigglesworth" }, + new Pet { PetId = 4, Name = "Salem Saberhagen" }, + new Pet { PetId = 7, Name = "K-9" } + }; + + private class Pet + { + public int PetId { get; set; } + public string? Name { get; set; } + } +} \ No newline at end of file diff --git a/Sources/BlazorApp/BlazorApp/Program.cs b/Sources/BlazorApp/BlazorApp/Program.cs index 207ee55..e62dc74 100644 --- a/Sources/BlazorApp/BlazorApp/Program.cs +++ b/Sources/BlazorApp/BlazorApp/Program.cs @@ -5,6 +5,9 @@ using Blazorise; using Blazorise.Bootstrap; using Blazorise.Icons.FontAwesome; using Blazored.Modal; +using Microsoft.AspNetCore.Localization; +using System.Globalization; +using Microsoft.Extensions.Options; var builder = WebApplication.CreateBuilder(args); @@ -21,6 +24,22 @@ builder.Services builder.Services.AddScoped(); builder.Services.AddBlazoredModal(); +// Add the controller of the app +builder.Services.AddControllers(); + +// Add the localization to the app and specify the resources path +builder.Services.AddLocalization(opts => { opts.ResourcesPath = "Resources"; }); + +// Configure the localtization +builder.Services.Configure(options => +{ + // Set the default culture of the web site + options.DefaultRequestCulture = new RequestCulture(new CultureInfo("en-US")); + + // Declare the supported culture + options.SupportedCultures = new List { new CultureInfo("en-US"), new CultureInfo("fr-FR") }; + options.SupportedUICultures = new List { new CultureInfo("en-US"), new CultureInfo("fr-FR") }; +}); var app = builder.Build(); // Configure the HTTP request pipeline. @@ -36,7 +55,20 @@ app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); +// Get the current localization options +var options = ((IApplicationBuilder)app).ApplicationServices.GetService>(); +if (options?.Value != null) +{ + // use the default localization + app.UseRequestLocalization(options.Value); +} + +// Add the controller to the endpoint +app.UseEndpoints(endpoints => +{ + endpoints.MapControllers(); +}); app.MapBlazorHub(); app.MapFallbackToPage("/_Host"); diff --git a/Sources/BlazorApp/BlazorApp/Ressources/Pages.List.fr-FR.resx b/Sources/BlazorApp/BlazorApp/Ressources/Pages.List.fr-FR.resx new file mode 100644 index 0000000..50bb302 --- /dev/null +++ b/Sources/BlazorApp/BlazorApp/Ressources/Pages.List.fr-FR.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Liste des éléments + + \ No newline at end of file diff --git a/Sources/BlazorApp/BlazorApp/Ressources/Pages.List.resx b/Sources/BlazorApp/BlazorApp/Ressources/Pages.List.resx new file mode 100644 index 0000000..ae67689 --- /dev/null +++ b/Sources/BlazorApp/BlazorApp/Ressources/Pages.List.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Items List + + \ No newline at end of file diff --git a/Sources/BlazorApp/BlazorApp/Shared/CultureSelector.razor b/Sources/BlazorApp/BlazorApp/Shared/CultureSelector.razor new file mode 100644 index 0000000..6d7f012 --- /dev/null +++ b/Sources/BlazorApp/BlazorApp/Shared/CultureSelector.razor @@ -0,0 +1,43 @@ +@using System.Globalization +@inject NavigationManager NavigationManager + +

+ +

+ +@code +{ + private CultureInfo[] supportedCultures = new[] + { + new CultureInfo("en-US"), + new CultureInfo("fr-FR") + }; + + private CultureInfo Culture + { + get => CultureInfo.CurrentCulture; + set + { + if (CultureInfo.CurrentUICulture == value) + { + return; + } + + var culture = value.Name.ToLower(CultureInfo.InvariantCulture); + + var uri = new Uri(this.NavigationManager.Uri).GetComponents(UriComponents.PathAndQuery, UriFormat.Unescaped); + var query = $"?culture={Uri.EscapeDataString(culture)}&" + $"redirectUri={Uri.EscapeDataString(uri)}"; + + // Redirect the user to the culture controller to set the cookie + this.NavigationManager.NavigateTo("/Culture/SetCulture" + query, forceLoad: true); + } + } +} \ No newline at end of file diff --git a/Sources/BlazorApp/BlazorApp/Shared/MainLayout.razor b/Sources/BlazorApp/BlazorApp/Shared/MainLayout.razor index dd158b5..5ff591e 100644 --- a/Sources/BlazorApp/BlazorApp/Shared/MainLayout.razor +++ b/Sources/BlazorApp/BlazorApp/Shared/MainLayout.razor @@ -10,6 +10,9 @@
About +
+ +
diff --git a/Sources/BlazorApp/BlazorApp/Shared/TableTemplate.razor b/Sources/BlazorApp/BlazorApp/Shared/TableTemplate.razor new file mode 100644 index 0000000..72c3ae5 --- /dev/null +++ b/Sources/BlazorApp/BlazorApp/Shared/TableTemplate.razor @@ -0,0 +1,28 @@ +@typeparam TItem +@using System.Diagnostics.CodeAnalysis + + + + @TableHeader + + + @foreach (var item in Items) + { + if (RowTemplate is not null) + { + @RowTemplate(item) + } + } + +
+ +@code { + [Parameter] + public RenderFragment? TableHeader { get; set; } + + [Parameter] + public RenderFragment? RowTemplate { get; set; } + + [Parameter, AllowNull] + public IReadOnlyList Items { get; set; } +} \ No newline at end of file diff --git a/Sources/BlazorApp/BlazorApp/obj/Debug/net6.0/BlazorApp.GeneratedMSBuildEditorConfig.editorconfig b/Sources/BlazorApp/BlazorApp/obj/Debug/net6.0/BlazorApp.GeneratedMSBuildEditorConfig.editorconfig index 8c66c97..56a0f41 100644 --- a/Sources/BlazorApp/BlazorApp/obj/Debug/net6.0/BlazorApp.GeneratedMSBuildEditorConfig.editorconfig +++ b/Sources/BlazorApp/BlazorApp/obj/Debug/net6.0/BlazorApp.GeneratedMSBuildEditorConfig.editorconfig @@ -19,6 +19,18 @@ build_property._RazorSourceGeneratorDebug = build_metadata.AdditionalFiles.TargetPath = QXBwLnJhem9y build_metadata.AdditionalFiles.CssScope = +[C:/Users/felix/Documents/BUT2/Blazor/TP/Sources/BlazorApp/BlazorApp/Components/Card.razor] +build_metadata.AdditionalFiles.TargetPath = Q29tcG9uZW50c1xDYXJkLnJhem9y +build_metadata.AdditionalFiles.CssScope = + +[C:/Users/felix/Documents/BUT2/Blazor/TP/Sources/BlazorApp/BlazorApp/Components/ShowItems.razor] +build_metadata.AdditionalFiles.TargetPath = Q29tcG9uZW50c1xTaG93SXRlbXMucmF6b3I= +build_metadata.AdditionalFiles.CssScope = + +[C:/Users/felix/Documents/BUT2/Blazor/TP/Sources/BlazorApp/BlazorApp/Components/TestRenderFragment.razor] +build_metadata.AdditionalFiles.TargetPath = Q29tcG9uZW50c1xUZXN0UmVuZGVyRnJhZ21lbnQucmF6b3I= +build_metadata.AdditionalFiles.CssScope = + [C:/Users/felix/Documents/BUT2/Blazor/TP/Sources/BlazorApp/BlazorApp/Modals/DeleteConfirmation.razor] build_metadata.AdditionalFiles.TargetPath = TW9kYWxzXERlbGV0ZUNvbmZpcm1hdGlvbi5yYXpvcg== build_metadata.AdditionalFiles.CssScope = @@ -55,6 +67,26 @@ build_metadata.AdditionalFiles.CssScope = build_metadata.AdditionalFiles.TargetPath = UGFnZXNcTGlzdC5yYXpvcg== build_metadata.AdditionalFiles.CssScope = +[C:/Users/felix/Documents/BUT2/Blazor/TP/Sources/BlazorApp/BlazorApp/Pages/Pets1.razor] +build_metadata.AdditionalFiles.TargetPath = UGFnZXNcUGV0czEucmF6b3I= +build_metadata.AdditionalFiles.CssScope = + +[C:/Users/felix/Documents/BUT2/Blazor/TP/Sources/BlazorApp/BlazorApp/Pages/Pets2.razor] +build_metadata.AdditionalFiles.TargetPath = UGFnZXNcUGV0czIucmF6b3I= +build_metadata.AdditionalFiles.CssScope = + +[C:/Users/felix/Documents/BUT2/Blazor/TP/Sources/BlazorApp/BlazorApp/Pages/Pets3.razor] +build_metadata.AdditionalFiles.TargetPath = UGFnZXNcUGV0czMucmF6b3I= +build_metadata.AdditionalFiles.CssScope = + +[C:/Users/felix/Documents/BUT2/Blazor/TP/Sources/BlazorApp/BlazorApp/Pages/Pets4.razor] +build_metadata.AdditionalFiles.TargetPath = UGFnZXNcUGV0czQucmF6b3I= +build_metadata.AdditionalFiles.CssScope = + +[C:/Users/felix/Documents/BUT2/Blazor/TP/Sources/BlazorApp/BlazorApp/Shared/CultureSelector.razor] +build_metadata.AdditionalFiles.TargetPath = U2hhcmVkXEN1bHR1cmVTZWxlY3Rvci5yYXpvcg== +build_metadata.AdditionalFiles.CssScope = + [C:/Users/felix/Documents/BUT2/Blazor/TP/Sources/BlazorApp/BlazorApp/Shared/DoctorWhoLayout.razor] build_metadata.AdditionalFiles.TargetPath = U2hhcmVkXERvY3Rvcldob0xheW91dC5yYXpvcg== build_metadata.AdditionalFiles.CssScope = @@ -63,10 +95,22 @@ build_metadata.AdditionalFiles.CssScope = build_metadata.AdditionalFiles.TargetPath = U2hhcmVkXFN1cnZleVByb21wdC5yYXpvcg== build_metadata.AdditionalFiles.CssScope = +[C:/Users/felix/Documents/BUT2/Blazor/TP/Sources/BlazorApp/BlazorApp/Shared/TableTemplate.razor] +build_metadata.AdditionalFiles.TargetPath = U2hhcmVkXFRhYmxlVGVtcGxhdGUucmF6b3I= +build_metadata.AdditionalFiles.CssScope = + [C:/Users/felix/Documents/BUT2/Blazor/TP/Sources/BlazorApp/BlazorApp/_Imports.razor] build_metadata.AdditionalFiles.TargetPath = X0ltcG9ydHMucmF6b3I= build_metadata.AdditionalFiles.CssScope = +[C:/Users/felix/Documents/BUT2/Blazor/TP/Sources/BlazorApp/BlazorApp/Components/Crafting.razor] +build_metadata.AdditionalFiles.TargetPath = Q29tcG9uZW50c1xDcmFmdGluZy5yYXpvcg== +build_metadata.AdditionalFiles.CssScope = b-0c7vkjpwvp + +[C:/Users/felix/Documents/BUT2/Blazor/TP/Sources/BlazorApp/BlazorApp/Components/CraftingItem.razor] +build_metadata.AdditionalFiles.TargetPath = Q29tcG9uZW50c1xDcmFmdGluZ0l0ZW0ucmF6b3I= +build_metadata.AdditionalFiles.CssScope = b-syyk20fth2 + [C:/Users/felix/Documents/BUT2/Blazor/TP/Sources/BlazorApp/BlazorApp/Shared/MainLayout.razor] build_metadata.AdditionalFiles.TargetPath = U2hhcmVkXE1haW5MYXlvdXQucmF6b3I= build_metadata.AdditionalFiles.CssScope = b-3dsd3z3yec diff --git a/Sources/BlazorApp/BlazorApp/obj/staticwebassets.pack.sentinel b/Sources/BlazorApp/BlazorApp/obj/staticwebassets.pack.sentinel index 50f6d0a..debb8a5 100644 --- a/Sources/BlazorApp/BlazorApp/obj/staticwebassets.pack.sentinel +++ b/Sources/BlazorApp/BlazorApp/obj/staticwebassets.pack.sentinel @@ -12,3 +12,4 @@ 2.0 2.0 2.0 +2.0