From f5677bff4ef8f471f6cb9cf1fdfd17f51ad4c735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Gr=C3=A4fe?= Date: Tue, 6 Oct 2020 20:54:13 +0200 Subject: [PATCH 1/7] Added Localization for BlazorTable. It is necessary to add "builder.Services.AddLocalization();" in Program.cs to get it working. Perhaps we should build someting like a initialization method --- src/BlazorTable.Sample.Server/Startup.cs | 1 + src/BlazorTable.Sample.Wasm/Program.cs | 1 + src/BlazorTable/BlazorTable.csproj | 16 + .../Components/FilterManager.razor | 7 +- .../Components/Localization.Designer.cs | 405 ++++++++++++++++++ .../Components/Localization.de.resx | 234 ++++++++++ src/BlazorTable/Components/Localization.resx | 234 ++++++++++ src/BlazorTable/Components/Pager.razor | 17 +- src/BlazorTable/Components/Table.razor | 9 +- .../Filters/BooleanFilter.razor.cs | 12 +- src/BlazorTable/Filters/CustomSelect.razor.cs | 12 +- src/BlazorTable/Filters/EnumFilter.razor.cs | 15 +- src/BlazorTable/Filters/NumberFilter.razor.cs | 24 +- src/BlazorTable/Filters/StringFilter.razor.cs | 24 +- .../LocalizedDescriptionAttribute.cs | 49 +++ 15 files changed, 1004 insertions(+), 56 deletions(-) create mode 100644 src/BlazorTable/Components/Localization.Designer.cs create mode 100644 src/BlazorTable/Components/Localization.de.resx create mode 100644 src/BlazorTable/Components/Localization.resx create mode 100644 src/BlazorTable/LocalizedDescriptionAttribute.cs diff --git a/src/BlazorTable.Sample.Server/Startup.cs b/src/BlazorTable.Sample.Server/Startup.cs index d8e1a10b..4256a558 100644 --- a/src/BlazorTable.Sample.Server/Startup.cs +++ b/src/BlazorTable.Sample.Server/Startup.cs @@ -42,6 +42,7 @@ public void ConfigureServices(IServiceCollection services) }; }); } + services.AddLocalization(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. diff --git a/src/BlazorTable.Sample.Wasm/Program.cs b/src/BlazorTable.Sample.Wasm/Program.cs index 2d10099a..73b46fb0 100644 --- a/src/BlazorTable.Sample.Wasm/Program.cs +++ b/src/BlazorTable.Sample.Wasm/Program.cs @@ -16,6 +16,7 @@ public static async Task Main(string[] args) builder.RootComponents.Add("app"); builder.Services.AddSingleton(new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); + builder.Services.AddLocalization(); await builder.Build().RunAsync(); } diff --git a/src/BlazorTable/BlazorTable.csproj b/src/BlazorTable/BlazorTable.csproj index 08c8f841..d5a47ed8 100644 --- a/src/BlazorTable/BlazorTable.csproj +++ b/src/BlazorTable/BlazorTable.csproj @@ -30,6 +30,7 @@ + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -42,5 +43,20 @@ + + + + True + True + Localization.resx + + + + + + ResXFileCodeGenerator + Localization.Designer.cs + + \ No newline at end of file diff --git a/src/BlazorTable/Components/FilterManager.razor b/src/BlazorTable/Components/FilterManager.razor index 5e161d5b..a698ca80 100644 --- a/src/BlazorTable/Components/FilterManager.razor +++ b/src/BlazorTable/Components/FilterManager.razor @@ -1,5 +1,6 @@ @namespace BlazorTable @typeparam TableItem +@inject Microsoft.Extensions.Localization.IStringLocalizer Localization @ChildContent @@ -7,7 +8,7 @@
- - - + + +
diff --git a/src/BlazorTable/Components/Localization.Designer.cs b/src/BlazorTable/Components/Localization.Designer.cs new file mode 100644 index 00000000..cd46e66f --- /dev/null +++ b/src/BlazorTable/Components/Localization.Designer.cs @@ -0,0 +1,405 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.42000 +// +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. +// +//------------------------------------------------------------------------------ + +namespace BlazorTable.Components { + using System; + + + /// + /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// + // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert + // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. + // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen + // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Localization { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Localization() { + } + + /// + /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BlazorTable.Components.Localization", typeof(Localization).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die False ähnelt. + /// + internal static string BooleanConditionFalse { + get { + return ResourceManager.GetString("BooleanConditionFalse", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Is not null ähnelt. + /// + internal static string BooleanConditionIsNotNull { + get { + return ResourceManager.GetString("BooleanConditionIsNotNull", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Is null ähnelt. + /// + internal static string BooleanConditionIsNull { + get { + return ResourceManager.GetString("BooleanConditionIsNull", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die True ähnelt. + /// + internal static string BooleanConditionTrue { + get { + return ResourceManager.GetString("BooleanConditionTrue", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Is equal to ähnelt. + /// + internal static string CustomSelectConditionIsEqualTo { + get { + return ResourceManager.GetString("CustomSelectConditionIsEqualTo", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Is not equal to ähnelt. + /// + internal static string CustomSelectConditionIsNotEqualTo { + get { + return ResourceManager.GetString("CustomSelectConditionIsNotEqualTo", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Is not null ähnelt. + /// + internal static string CustomSelectConditionIsNotNull { + get { + return ResourceManager.GetString("CustomSelectConditionIsNotNull", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Is null ähnelt. + /// + internal static string CustomSelectConditionIsNull { + get { + return ResourceManager.GetString("CustomSelectConditionIsNull", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Is equal to ähnelt. + /// + internal static string EnumConditionIsEqualTo { + get { + return ResourceManager.GetString("EnumConditionIsEqualTo", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Is not equal to ähnelt. + /// + internal static string EnumConditionIsNotEqualTo { + get { + return ResourceManager.GetString("EnumConditionIsNotEqualTo", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Is not null ähnelt. + /// + internal static string EnumConditionIsNotNull { + get { + return ResourceManager.GetString("EnumConditionIsNotNull", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Is null ähnelt. + /// + internal static string EnumConditionIsNull { + get { + return ResourceManager.GetString("EnumConditionIsNull", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Apply ähnelt. + /// + internal static string FilterManagerApply { + get { + return ResourceManager.GetString("FilterManagerApply", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Clear ähnelt. + /// + internal static string FilterManagerClear { + get { + return ResourceManager.GetString("FilterManagerClear", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Close ähnelt. + /// + internal static string FilterManagerClose { + get { + return ResourceManager.GetString("FilterManagerClose", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Is equal to ähnelt. + /// + internal static string NumberConditionIsEqualTo { + get { + return ResourceManager.GetString("NumberConditionIsEqualTo", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Is greater than ähnelt. + /// + internal static string NumberConditionIsGreaterThan { + get { + return ResourceManager.GetString("NumberConditionIsGreaterThan", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Is greater than or equal to ähnelt. + /// + internal static string NumberConditionIsGreaterThanOrEqualTo { + get { + return ResourceManager.GetString("NumberConditionIsGreaterThanOrEqualTo", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Is less than ähnelt. + /// + internal static string NumberConditionIsLessThan { + get { + return ResourceManager.GetString("NumberConditionIsLessThan", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Is less than or equal to ähnelt. + /// + internal static string NumberConditionIsLessThanOrEqualTo { + get { + return ResourceManager.GetString("NumberConditionIsLessThanOrEqualTo", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Is not equal to ähnelt. + /// + internal static string NumberConditionIsnotEqualTo { + get { + return ResourceManager.GetString("NumberConditionIsnotEqualTo", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Is not null ähnelt. + /// + internal static string NumberConditionIsNotNull { + get { + return ResourceManager.GetString("NumberConditionIsNotNull", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Is null ähnelt. + /// + internal static string NumberConditionIsNull { + get { + return ResourceManager.GetString("NumberConditionIsNull", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die First ähnelt. + /// + internal static string PagerFirst { + get { + return ResourceManager.GetString("PagerFirst", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Last ähnelt. + /// + internal static string PagerLast { + get { + return ResourceManager.GetString("PagerLast", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Next ähnelt. + /// + internal static string PagerNext { + get { + return ResourceManager.GetString("PagerNext", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Previous ähnelt. + /// + internal static string PagerPrevious { + get { + return ResourceManager.GetString("PagerPrevious", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Contains ähnelt. + /// + internal static string StringConditionContains { + get { + return ResourceManager.GetString("StringConditionContains", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Does not contain ähnelt. + /// + internal static string StringConditionDoesNotContain { + get { + return ResourceManager.GetString("StringConditionDoesNotContain", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Ends with ähnelt. + /// + internal static string StringConditionEndsWith { + get { + return ResourceManager.GetString("StringConditionEndsWith", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Is equal to ähnelt. + /// + internal static string StringConditionIsEqualTo { + get { + return ResourceManager.GetString("StringConditionIsEqualTo", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Is not equal to ähnelt. + /// + internal static string StringConditionIsNotEqualTo { + get { + return ResourceManager.GetString("StringConditionIsNotEqualTo", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Is not null or empty ähnelt. + /// + internal static string StringConditionIsNotNullOrEmpty { + get { + return ResourceManager.GetString("StringConditionIsNotNullOrEmpty", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Is null or empty ähnelt. + /// + internal static string StringConditionIsNullOrEmpty { + get { + return ResourceManager.GetString("StringConditionIsNullOrEmpty", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Starts with ähnelt. + /// + internal static string StringConditionStartsWith { + get { + return ResourceManager.GetString("StringConditionStartsWith", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Details View ähnelt. + /// + internal static string TableDetailsView { + get { + return ResourceManager.GetString("TableDetailsView", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Global Search... ähnelt. + /// + internal static string TableGlobalSearch { + get { + return ResourceManager.GetString("TableGlobalSearch", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Loading... ähnelt. + /// + internal static string TableLoading { + get { + return ResourceManager.GetString("TableLoading", resourceCulture); + } + } + } +} diff --git a/src/BlazorTable/Components/Localization.de.resx b/src/BlazorTable/Components/Localization.de.resx new file mode 100644 index 00000000..05448a3d --- /dev/null +++ b/src/BlazorTable/Components/Localization.de.resx @@ -0,0 +1,234 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + Falsch + + + Ist nicht null + + + Ist null + + + Wahr + + + Ist gleich + + + Ist ungleich + + + Ist nicht null + + + Ist null + + + Ist gleich + + + Ist ungleich + + + Ist nicht null + + + Ist null + + + Anwenden + + + Löschen + + + Schließen + + + Ist gleich + + + Ist größer als + + + Ist größer oder gleich als + + + Ist kleiner als + + + Ist kleiner oder gleich als + + + Ist ungleich + + + Ist nicht null + + + Ist null + + + Beginn + + + Ende + + + Nächste + + + Zurück + + + Beinhaltet + + + Beinhaltet nicht + + + Endet mit + + + Ist gleich + + + Ist ungleich + + + Ist nicht Null oder leer + + + Ist Null oder leer + + + Beginnt mit + + + Detailansicht + + + Globale Suche... + + + Lade... + + \ No newline at end of file diff --git a/src/BlazorTable/Components/Localization.resx b/src/BlazorTable/Components/Localization.resx new file mode 100644 index 00000000..8c94477f --- /dev/null +++ b/src/BlazorTable/Components/Localization.resx @@ -0,0 +1,234 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + False + + + Is not null + + + Is null + + + True + + + Is equal to + + + Is not equal to + + + Is not null + + + Is null + + + Is equal to + + + Is not equal to + + + Is not null + + + Is null + + + Apply + + + Clear + + + Close + + + Is equal to + + + Is greater than + + + Is greater than or equal to + + + Is less than + + + Is less than or equal to + + + Is not equal to + + + Is not null + + + Is null + + + First + + + Last + + + Next + + + Previous + + + Contains + + + Does not contain + + + Ends with + + + Is equal to + + + Is not equal to + + + Is not null or empty + + + Is null or empty + + + Starts with + + + Details View + + + Global Search... + + + Loading... + + \ No newline at end of file diff --git a/src/BlazorTable/Components/Pager.razor b/src/BlazorTable/Components/Pager.razor index db0b9b47..6947d9b7 100644 --- a/src/BlazorTable/Components/Pager.razor +++ b/src/BlazorTable/Components/Pager.razor @@ -1,4 +1,5 @@ @namespace BlazorTable +@inject Microsoft.Extensions.Localization.IStringLocalizer Localization @if (AlwaysShow || (Table.TotalPages > 1)) { @@ -34,17 +35,17 @@ } -
  • - First +
  • + @Localization["PagerFirst"]
  • -
  • - Previous +
  • + @Localization["PagerPrevious"]
  • -
  • - Next +
  • + @Localization["PagerNext"]
  • -
  • - Last +
  • + @Localization["PagerLast"]
  • diff --git a/src/BlazorTable/Components/Table.razor b/src/BlazorTable/Components/Table.razor index a8d81b0f..c65cfc25 100644 --- a/src/BlazorTable/Components/Table.razor +++ b/src/BlazorTable/Components/Table.razor @@ -1,7 +1,6 @@ @namespace BlazorTable @typeparam TableItem - - +@inject Microsoft.Extensions.Localization.IStringLocalizer Localization @if (Columns.Any()) { @@ -13,7 +12,7 @@ { - + } @@ -97,7 +96,7 @@ @if (_detailTemplate != null) { - + @if (isOpen) {} else @@ -155,7 +154,7 @@ else {
    - Loading... + @Localization["TableLoading"]
    } diff --git a/src/BlazorTable/Filters/BooleanFilter.razor.cs b/src/BlazorTable/Filters/BooleanFilter.razor.cs index d72cb49b..f8526472 100644 --- a/src/BlazorTable/Filters/BooleanFilter.razor.cs +++ b/src/BlazorTable/Filters/BooleanFilter.razor.cs @@ -1,7 +1,7 @@ -using Microsoft.AspNetCore.Components; +using BlazorTable.Components; +using Microsoft.AspNetCore.Components; using System; using System.Collections.Generic; -using System.ComponentModel; using System.Linq.Expressions; namespace BlazorTable @@ -92,16 +92,16 @@ protected override void OnInitialized() public enum BooleanCondition { - [Description("True")] + [LocalizedDescription("BooleanConditionTrue", typeof(Localization))] True, - [Description("False")] + [LocalizedDescription("BooleanConditionFalse", typeof(Localization))] False, - [Description("Is null")] + [LocalizedDescription("BooleanConditionIsNull", typeof(Localization))] IsNull, - [Description("Is not null")] + [LocalizedDescription("BooleanConditionIsNotNull", typeof(Localization))] IsNotNull } } diff --git a/src/BlazorTable/Filters/CustomSelect.razor.cs b/src/BlazorTable/Filters/CustomSelect.razor.cs index 3e3f7928..c8d467b1 100644 --- a/src/BlazorTable/Filters/CustomSelect.razor.cs +++ b/src/BlazorTable/Filters/CustomSelect.razor.cs @@ -1,7 +1,7 @@ -using Microsoft.AspNetCore.Components; +using BlazorTable.Components; +using Microsoft.AspNetCore.Components; using System; using System.Collections.Generic; -using System.ComponentModel; using System.Globalization; using System.Linq; using System.Linq.Expressions; @@ -97,16 +97,16 @@ public void AddSelect(string key, object value) public enum CustomSelectCondition { - [Description("Is equal to")] + [LocalizedDescription("CustomSelectConditionIsEqualTo", typeof(Localization))] IsEqualTo, - [Description("Is not equal to")] + [LocalizedDescription("CustomSelectConditionIsNotEqualTo", typeof(Localization))] IsNotEqualTo, - [Description("Is null")] + [LocalizedDescription("CustomSelectConditionIsNull", typeof(Localization))] IsNull, - [Description("Is not null")] + [LocalizedDescription("CustomSelectConditionIsNotNull", typeof(Localization))] IsNotNull } } diff --git a/src/BlazorTable/Filters/EnumFilter.razor.cs b/src/BlazorTable/Filters/EnumFilter.razor.cs index 04ca4e28..fc29d3ca 100644 --- a/src/BlazorTable/Filters/EnumFilter.razor.cs +++ b/src/BlazorTable/Filters/EnumFilter.razor.cs @@ -1,6 +1,6 @@ -using Microsoft.AspNetCore.Components; +using BlazorTable.Components; +using Microsoft.AspNetCore.Components; using System; -using System.ComponentModel; using System.Globalization; using System.Linq.Expressions; @@ -11,6 +11,9 @@ public partial class EnumFilter : IFilter [CascadingParameter(Name = "Column")] public IColumn Column { get; set; } + [Inject] + Microsoft.Extensions.Localization.IStringLocalizer Localization { get; set; } + private EnumCondition Condition { get; set; } private object FilterValue { get; set; } @@ -87,16 +90,16 @@ protected override void OnInitialized() public enum EnumCondition { - [Description("Is equal to")] + [LocalizedDescription("EnumConditionIsEqualTo", typeof(Localization))] IsEqualTo, - [Description("Is not equal to")] + [LocalizedDescription("EnumConditionIsNotEqualTo", typeof(Localization))] IsNotEqualTo, - [Description("Is null")] + [LocalizedDescription("EnumConditionIsNull", typeof(Localization))] IsNull, - [Description("Is not null")] + [LocalizedDescription("EnumConditionIsNotNull", typeof(Localization))] IsNotNull } } diff --git a/src/BlazorTable/Filters/NumberFilter.razor.cs b/src/BlazorTable/Filters/NumberFilter.razor.cs index 23a3fca3..886ed64b 100644 --- a/src/BlazorTable/Filters/NumberFilter.razor.cs +++ b/src/BlazorTable/Filters/NumberFilter.razor.cs @@ -1,7 +1,6 @@ -using Microsoft.AspNetCore.Components; -using Microsoft.Extensions.Logging; +using BlazorTable.Components; +using Microsoft.AspNetCore.Components; using System; -using System.ComponentModel; using System.Globalization; using System.Linq.Expressions; @@ -12,6 +11,9 @@ public partial class NumberFilter : IFilter [CascadingParameter(Name = "Column")] public IColumn Column { get; set; } + [Inject] + Microsoft.Extensions.Localization.IStringLocalizer Localization { get; set; } + private NumberCondition Condition { get; set; } private string FilterValue { get; set; } @@ -140,28 +142,28 @@ protected override void OnInitialized() public enum NumberCondition { - [Description("Is equal to")] + [LocalizedDescription("NumberConditionIsEqualTo", typeof(Localization))] IsEqualTo, - [Description("Is not equal to")] + [LocalizedDescription("NumberConditionIsnotEqualTo", typeof(Localization))] IsNotEqualTo, - [Description("Is greater than or equal to")] + [LocalizedDescription("NumberConditionIsGreaterThanOrEqualTo", typeof(Localization))] IsGreaterThanOrEqualTo, - [Description("Is greater than")] + [LocalizedDescription("NumberConditionIsGreaterThan", typeof(Localization))] IsGreaterThan, - [Description("Is less than or equal to")] + [LocalizedDescription("NumberConditionIsLessThanOrEqualTo", typeof(Localization))] IsLessThanOrEqualTo, - [Description("Is less than")] + [LocalizedDescription("NumberConditionIsLessThan", typeof(Localization))] IsLessThan, - [Description("Is null")] + [LocalizedDescription("NumberConditionIsNull", typeof(Localization))] IsNull, - [Description("Is not null")] + [LocalizedDescription("NumberConditionIsNotNull", typeof(Localization))] IsNotNull } } diff --git a/src/BlazorTable/Filters/StringFilter.razor.cs b/src/BlazorTable/Filters/StringFilter.razor.cs index 8e4ae904..4e5b0a40 100644 --- a/src/BlazorTable/Filters/StringFilter.razor.cs +++ b/src/BlazorTable/Filters/StringFilter.razor.cs @@ -1,7 +1,6 @@ -using Microsoft.AspNetCore.Components; -using Microsoft.Extensions.Logging; +using BlazorTable.Components; +using Microsoft.AspNetCore.Components; using System; -using System.ComponentModel; using System.Linq.Expressions; namespace BlazorTable @@ -11,6 +10,9 @@ public partial class StringFilter : IFilter [CascadingParameter(Name = "Column")] public IColumn Column { get; set; } + [Inject] + Microsoft.Extensions.Localization.IStringLocalizer Localization { get; set; } + private StringCondition Condition { get; set; } private string FilterText { get; set; } @@ -185,28 +187,28 @@ private StringCondition GetConditionFromMethod(string method, bool not) public enum StringCondition { - [Description("Contains")] + [LocalizedDescription("StringConditionContains", typeof(Localization))] Contains, - [Description("Does not contain")] + [LocalizedDescription("StringConditionDoesNotContain", typeof(Localization))] DoesNotContain, - [Description("Starts with")] + [LocalizedDescription("StringConditionStartsWith", typeof(Localization))] StartsWith, - [Description("Ends with")] + [LocalizedDescription("StringConditionEndsWith", typeof(Localization))] EndsWith, - [Description("Is equal to")] + [LocalizedDescription("StringConditionIsEqualTo", typeof(Localization))] IsEqualTo, - [Description("Is not equal to")] + [LocalizedDescription("StringConditionIsNotEqualTo", typeof(Localization))] IsNotEqualTo, - [Description("Is null or empty")] + [LocalizedDescription("StringConditionIsNullOrEmpty", typeof(Localization))] IsNullOrEmpty, - [Description("Is not null or empty")] + [LocalizedDescription("StringConditionIsNotNullOrEmpty", typeof(Localization))] IsNotNulOrEmpty } } diff --git a/src/BlazorTable/LocalizedDescriptionAttribute.cs b/src/BlazorTable/LocalizedDescriptionAttribute.cs new file mode 100644 index 00000000..dd8bbee3 --- /dev/null +++ b/src/BlazorTable/LocalizedDescriptionAttribute.cs @@ -0,0 +1,49 @@ +using System; +using System.ComponentModel; +using System.Reflection; +using System.Resources; + +namespace BlazorTable +{ + public class LocalizedDescriptionAttribute : DescriptionAttribute + { + private readonly string _resourceKey; + private readonly ResourceManager _resource; + public LocalizedDescriptionAttribute(string resourceKey, Type resourceType) + { + _resource = new ResourceManager(resourceType); + _resourceKey = resourceKey; + } + + public override string Description + { + get + { + string displayName = _resource.GetString(_resourceKey); + + return string.IsNullOrEmpty(displayName) + ? string.Format("[[{0}]]", _resourceKey) + : displayName; + } + } + } + + public static class EnumExtensions + { + public static string GetDescription(this Enum enumValue) + { + FieldInfo fi = enumValue.GetType().GetField(enumValue.ToString()); + + DescriptionAttribute[] attributes = + (DescriptionAttribute[])fi.GetCustomAttributes( + typeof(DescriptionAttribute), + false); + + if (attributes != null && + attributes.Length > 0) + return attributes[0].Description; + else + return enumValue.ToString(); + } + } +} From 9b19c3caa5fc9abb4f30a9f19f355a33c6ba3a91 Mon Sep 17 00:00:00 2001 From: NilsPur Date: Sun, 25 Oct 2020 00:06:02 +0200 Subject: [PATCH 2/7] Colum visibility --- .../BlazorTable.Sample.Shared.csproj | 4 + src/BlazorTable.Sample.Shared/NavMenu.razor | 5 + .../Pages/ToggleColumnVisibility.razor | 69 +++++++ src/BlazorTable/Components/Column.razor.cs | 22 +++ src/BlazorTable/Components/Table.razor | 179 ++++++++++++------ src/BlazorTable/Components/Table.razor.cs | 10 + src/BlazorTable/Interfaces/IColumn.cs | 11 ++ 7 files changed, 238 insertions(+), 62 deletions(-) create mode 100644 src/BlazorTable.Sample.Shared/Pages/ToggleColumnVisibility.razor diff --git a/src/BlazorTable.Sample.Shared/BlazorTable.Sample.Shared.csproj b/src/BlazorTable.Sample.Shared/BlazorTable.Sample.Shared.csproj index 06c19390..a12cc1fe 100644 --- a/src/BlazorTable.Sample.Shared/BlazorTable.Sample.Shared.csproj +++ b/src/BlazorTable.Sample.Shared/BlazorTable.Sample.Shared.csproj @@ -19,5 +19,9 @@ + + + + diff --git a/src/BlazorTable.Sample.Shared/NavMenu.razor b/src/BlazorTable.Sample.Shared/NavMenu.razor index 11e34bfc..2a81e847 100644 --- a/src/BlazorTable.Sample.Shared/NavMenu.razor +++ b/src/BlazorTable.Sample.Shared/NavMenu.razor @@ -67,6 +67,11 @@ Dynamic Columns + diff --git a/src/BlazorTable.Sample.Shared/Pages/ToggleColumnVisibility.razor b/src/BlazorTable.Sample.Shared/Pages/ToggleColumnVisibility.razor new file mode 100644 index 00000000..d636d609 --- /dev/null +++ b/src/BlazorTable.Sample.Shared/Pages/ToggleColumnVisibility.razor @@ -0,0 +1,69 @@ +@page "/ToggleColumnVisibility" +@inject HttpClient Http +@using BlazorTable +@using System.ComponentModel + +

    Toggle Column Visibility

    + + + + + + + + + + + + + + + + + + + + +
    + +@code +{ + [Inject] + private HttpClient httpClient { get; set; } + + private PersonData[] data; + + private bool showSearchBar; + + protected override async Task OnInitializedAsync() + { + data = await httpClient.GetFromJsonAsync("sample-data/MOCK_DATA.json"); + } + + public class PersonData + { + public int? id { get; set; } + public string full_name { get; set; } + public string email { get; set; } + public bool? paid { get; set; } + public decimal? price { get; set; } + public CreditCard? cc_type { get; set; } + public DateTime? created_date { get; set; } + } + + public enum CreditCard + { + none = 0, + [Description("MasterCard")] + MasterCard = 1, + Visa = 2 + } +} \ No newline at end of file diff --git a/src/BlazorTable/Components/Column.razor.cs b/src/BlazorTable/Components/Column.razor.cs index 847bc112..bd0257f6 100644 --- a/src/BlazorTable/Components/Column.razor.cs +++ b/src/BlazorTable/Components/Column.razor.cs @@ -48,6 +48,12 @@ public string Title [Parameter] public bool Filterable { get; set; } + /// + /// Column can be hidden + /// + [Parameter] + public bool Hideable { get; set; } + /// /// Normal Item Template /// @@ -142,6 +148,22 @@ public string Title /// public bool FilterOpen { get; private set; } + private bool _visible = true; + + /// + /// Column visibility + /// True if current column is visible else false. + /// + public bool Visible + { + get { return _visible; } + set + { + _visible = value; + Table.Refresh(); + } + } + /// /// Column Data Type /// diff --git a/src/BlazorTable/Components/Table.razor b/src/BlazorTable/Components/Table.razor index a8d81b0f..54de02ba 100644 --- a/src/BlazorTable/Components/Table.razor +++ b/src/BlazorTable/Components/Table.razor @@ -9,11 +9,51 @@
    - @if (ShowSearchBar) + @if (ShowSearchBar || Columns.Exists(column => !column.Visible)) { - + } @@ -26,56 +66,68 @@ } @foreach (IColumn column in Columns) { - + + } + + + } } @@ -108,17 +160,20 @@ @foreach (IColumn column in Columns) { - + @if (column.Visible) + { + + } } diff --git a/src/BlazorTable/Components/Table.razor.cs b/src/BlazorTable/Components/Table.razor.cs index 824518c3..59470ee3 100644 --- a/src/BlazorTable/Components/Table.razor.cs +++ b/src/BlazorTable/Components/Table.razor.cs @@ -81,6 +81,16 @@ public partial class Table : ITable [Inject] private ILogger> Logger { get; set; } + /// + /// Ref to visibility menu icon for popover display + /// + private ElementReference VisibilityMenuIconRef { get; set; } + + /// + /// True if visibility menu is open otherwise false + /// + private bool VisibilityMenuOpen { get; set; } + /// /// Collection of filtered items /// diff --git a/src/BlazorTable/Interfaces/IColumn.cs b/src/BlazorTable/Interfaces/IColumn.cs index 6ab96d87..8943ebd2 100644 --- a/src/BlazorTable/Interfaces/IColumn.cs +++ b/src/BlazorTable/Interfaces/IColumn.cs @@ -35,6 +35,11 @@ public interface IColumn /// bool Filterable { get; set; } + /// + /// Column can be hidden + /// + bool Hideable { get; set; } + /// /// Set the format for values if no template /// @@ -45,6 +50,12 @@ public interface IColumn /// bool FilterOpen { get; } + /// + /// Column visibility + /// True if current column is visible else false. + /// + bool Visible { get; set; } + /// /// Opens/Closes the Filter Panel /// From a3bba23969d33a24f6195fb922a9a2de5c8a1379 Mon Sep 17 00:00:00 2001 From: NilsPur Date: Sun, 25 Oct 2020 00:12:20 +0200 Subject: [PATCH 3/7] Some cleanup (column visibility) --- .../BlazorTable.Sample.Shared.csproj | 4 ---- .../Pages/ToggleColumnVisibility.razor | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/BlazorTable.Sample.Shared/BlazorTable.Sample.Shared.csproj b/src/BlazorTable.Sample.Shared/BlazorTable.Sample.Shared.csproj index a12cc1fe..06c19390 100644 --- a/src/BlazorTable.Sample.Shared/BlazorTable.Sample.Shared.csproj +++ b/src/BlazorTable.Sample.Shared/BlazorTable.Sample.Shared.csproj @@ -19,9 +19,5 @@ - - - - diff --git a/src/BlazorTable.Sample.Shared/Pages/ToggleColumnVisibility.razor b/src/BlazorTable.Sample.Shared/Pages/ToggleColumnVisibility.razor index d636d609..3d7bf8ff 100644 --- a/src/BlazorTable.Sample.Shared/Pages/ToggleColumnVisibility.razor +++ b/src/BlazorTable.Sample.Shared/Pages/ToggleColumnVisibility.razor @@ -66,4 +66,4 @@ MasterCard = 1, Visa = 2 } -} \ No newline at end of file +} From c88bf4d35ec4464dc36bb3754e056e108125fdc1 Mon Sep 17 00:00:00 2001 From: Ivan Josipovic <9521987+IvanJosipovic@users.noreply.github.com> Date: Wed, 25 Nov 2020 22:29:49 -0800 Subject: [PATCH 4/7] Added initialization method --- README.md | 2 ++ src/BlazorTable.Sample.Server/Startup.cs | 2 +- src/BlazorTable.Sample.Wasm/Program.cs | 2 +- src/BlazorTable/IServiceCollectionExtensions.cs | 12 ++++++++++++ 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 src/BlazorTable/IServiceCollectionExtensions.cs diff --git a/README.md b/README.md index ea881b37..d0a00b53 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ Blazor Table Component with Sorting, Paging and Filtering - dotnet add package BlazorTable - Add to the index.html or _Hosts.cshtml - `` +- Add call to Program.cs or Startup.cs + - Services.AddBlazorTable(); ## Features - Column Reordering diff --git a/src/BlazorTable.Sample.Server/Startup.cs b/src/BlazorTable.Sample.Server/Startup.cs index 4256a558..aba6addb 100644 --- a/src/BlazorTable.Sample.Server/Startup.cs +++ b/src/BlazorTable.Sample.Server/Startup.cs @@ -42,7 +42,7 @@ public void ConfigureServices(IServiceCollection services) }; }); } - services.AddLocalization(); + services.AddBlazorTable(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. diff --git a/src/BlazorTable.Sample.Wasm/Program.cs b/src/BlazorTable.Sample.Wasm/Program.cs index 73b46fb0..a4cc9539 100644 --- a/src/BlazorTable.Sample.Wasm/Program.cs +++ b/src/BlazorTable.Sample.Wasm/Program.cs @@ -16,7 +16,7 @@ public static async Task Main(string[] args) builder.RootComponents.Add("app"); builder.Services.AddSingleton(new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); - builder.Services.AddLocalization(); + builder.Services.AddBlazorTable(); await builder.Build().RunAsync(); } diff --git a/src/BlazorTable/IServiceCollectionExtensions.cs b/src/BlazorTable/IServiceCollectionExtensions.cs new file mode 100644 index 00000000..6ed95cd5 --- /dev/null +++ b/src/BlazorTable/IServiceCollectionExtensions.cs @@ -0,0 +1,12 @@ +using Microsoft.Extensions.DependencyInjection; + +namespace BlazorTable +{ + public static class IServiceCollectionExtensions + { + public static IServiceCollection AddBlazorTable(this IServiceCollection services) + { + return services.AddLocalization(); + } + } +} \ No newline at end of file From 6d3a576635a896fefea2b9f4d97374683c828408 Mon Sep 17 00:00:00 2001 From: Ivan Josipovic <9521987+IvanJosipovic@users.noreply.github.com> Date: Wed, 25 Nov 2020 22:30:27 -0800 Subject: [PATCH 5/7] added dependabot config --- .dependabot/dependabot.yaml | 16 ++++++++++++++++ BlazorTable.sln | 1 + 2 files changed, 17 insertions(+) create mode 100644 .dependabot/dependabot.yaml diff --git a/.dependabot/dependabot.yaml b/.dependabot/dependabot.yaml new file mode 100644 index 00000000..d5137800 --- /dev/null +++ b/.dependabot/dependabot.yaml @@ -0,0 +1,16 @@ +version: 2 +updates: +- package-ecosystem: nuget + directory: "/" + schedule: + interval: daily + time: "06:00" + timezone: America/Vancouver + open-pull-requests-limit: 10 + ignore: + - dependency-name: Microsoft.AspNetCore.* + versions: + - 5.x + - dependency-name: System.Net.Http.Json + versions: + - 5.x diff --git a/BlazorTable.sln b/BlazorTable.sln index 5c57f951..04dd9e0c 100644 --- a/BlazorTable.sln +++ b/BlazorTable.sln @@ -11,6 +11,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ProjectSection(SolutionItems) = preProject .github\workflows\build.yml = .github\workflows\build.yml .github\workflows\cicd.yml = .github\workflows\cicd.yml + .dependabot\dependabot.yaml = .dependabot\dependabot.yaml README.md = README.md .github\workflows\release.yml = .github\workflows\release.yml EndProjectSection From 7ef724052019a80700aaa73fb350a2c6ae178860 Mon Sep 17 00:00:00 2001 From: Ivan Josipovic <9521987+IvanJosipovic@users.noreply.github.com> Date: Wed, 25 Nov 2020 22:30:44 -0800 Subject: [PATCH 6/7] NuGet update --- .../BlazorTable.Sample.Shared.csproj | 4 +- .../BlazorTable.Tests.csproj | 4 +- src/BlazorTable/BlazorTable.csproj | 10 +- .../Components/Localization.Designer.cs | 100 +++++++++--------- 4 files changed, 59 insertions(+), 59 deletions(-) diff --git a/src/BlazorTable.Sample.Shared/BlazorTable.Sample.Shared.csproj b/src/BlazorTable.Sample.Shared/BlazorTable.Sample.Shared.csproj index 06c19390..5154481d 100644 --- a/src/BlazorTable.Sample.Shared/BlazorTable.Sample.Shared.csproj +++ b/src/BlazorTable.Sample.Shared/BlazorTable.Sample.Shared.csproj @@ -6,8 +6,8 @@ - - + + diff --git a/src/BlazorTable.Tests/BlazorTable.Tests.csproj b/src/BlazorTable.Tests/BlazorTable.Tests.csproj index 450b1c47..e8ae8d44 100644 --- a/src/BlazorTable.Tests/BlazorTable.Tests.csproj +++ b/src/BlazorTable.Tests/BlazorTable.Tests.csproj @@ -7,10 +7,10 @@ - + - + all diff --git a/src/BlazorTable/BlazorTable.csproj b/src/BlazorTable/BlazorTable.csproj index d5a47ed8..6600f78c 100644 --- a/src/BlazorTable/BlazorTable.csproj +++ b/src/BlazorTable/BlazorTable.csproj @@ -27,11 +27,11 @@ - - - - - + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/BlazorTable/Components/Localization.Designer.cs b/src/BlazorTable/Components/Localization.Designer.cs index cd46e66f..3e1961dc 100644 --- a/src/BlazorTable/Components/Localization.Designer.cs +++ b/src/BlazorTable/Components/Localization.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// Dieser Code wurde von einem Tool generiert. -// Laufzeitversion:4.0.30319.42000 +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 // -// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -// der Code erneut generiert wird. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -13,12 +13,12 @@ namespace BlazorTable.Components { /// - /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// A strongly-typed resource class, for looking up localized strings, etc. /// - // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert - // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. - // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen - // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] @@ -33,7 +33,7 @@ internal class Localization { } /// - /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { @@ -47,8 +47,8 @@ internal class Localization { } /// - /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle - /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { @@ -61,7 +61,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die False ähnelt. + /// Looks up a localized string similar to False. /// internal static string BooleanConditionFalse { get { @@ -70,7 +70,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Is not null ähnelt. + /// Looks up a localized string similar to Is not null. /// internal static string BooleanConditionIsNotNull { get { @@ -79,7 +79,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Is null ähnelt. + /// Looks up a localized string similar to Is null. /// internal static string BooleanConditionIsNull { get { @@ -88,7 +88,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die True ähnelt. + /// Looks up a localized string similar to True. /// internal static string BooleanConditionTrue { get { @@ -97,7 +97,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Is equal to ähnelt. + /// Looks up a localized string similar to Is equal to. /// internal static string CustomSelectConditionIsEqualTo { get { @@ -106,7 +106,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Is not equal to ähnelt. + /// Looks up a localized string similar to Is not equal to. /// internal static string CustomSelectConditionIsNotEqualTo { get { @@ -115,7 +115,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Is not null ähnelt. + /// Looks up a localized string similar to Is not null. /// internal static string CustomSelectConditionIsNotNull { get { @@ -124,7 +124,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Is null ähnelt. + /// Looks up a localized string similar to Is null. /// internal static string CustomSelectConditionIsNull { get { @@ -133,7 +133,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Is equal to ähnelt. + /// Looks up a localized string similar to Is equal to. /// internal static string EnumConditionIsEqualTo { get { @@ -142,7 +142,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Is not equal to ähnelt. + /// Looks up a localized string similar to Is not equal to. /// internal static string EnumConditionIsNotEqualTo { get { @@ -151,7 +151,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Is not null ähnelt. + /// Looks up a localized string similar to Is not null. /// internal static string EnumConditionIsNotNull { get { @@ -160,7 +160,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Is null ähnelt. + /// Looks up a localized string similar to Is null. /// internal static string EnumConditionIsNull { get { @@ -169,7 +169,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Apply ähnelt. + /// Looks up a localized string similar to Apply. /// internal static string FilterManagerApply { get { @@ -178,7 +178,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Clear ähnelt. + /// Looks up a localized string similar to Clear. /// internal static string FilterManagerClear { get { @@ -187,7 +187,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Close ähnelt. + /// Looks up a localized string similar to Close. /// internal static string FilterManagerClose { get { @@ -196,7 +196,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Is equal to ähnelt. + /// Looks up a localized string similar to Is equal to. /// internal static string NumberConditionIsEqualTo { get { @@ -205,7 +205,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Is greater than ähnelt. + /// Looks up a localized string similar to Is greater than. /// internal static string NumberConditionIsGreaterThan { get { @@ -214,7 +214,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Is greater than or equal to ähnelt. + /// Looks up a localized string similar to Is greater than or equal to. /// internal static string NumberConditionIsGreaterThanOrEqualTo { get { @@ -223,7 +223,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Is less than ähnelt. + /// Looks up a localized string similar to Is less than. /// internal static string NumberConditionIsLessThan { get { @@ -232,7 +232,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Is less than or equal to ähnelt. + /// Looks up a localized string similar to Is less than or equal to. /// internal static string NumberConditionIsLessThanOrEqualTo { get { @@ -241,7 +241,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Is not equal to ähnelt. + /// Looks up a localized string similar to Is not equal to. /// internal static string NumberConditionIsnotEqualTo { get { @@ -250,7 +250,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Is not null ähnelt. + /// Looks up a localized string similar to Is not null. /// internal static string NumberConditionIsNotNull { get { @@ -259,7 +259,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Is null ähnelt. + /// Looks up a localized string similar to Is null. /// internal static string NumberConditionIsNull { get { @@ -268,7 +268,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die First ähnelt. + /// Looks up a localized string similar to First. /// internal static string PagerFirst { get { @@ -277,7 +277,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Last ähnelt. + /// Looks up a localized string similar to Last. /// internal static string PagerLast { get { @@ -286,7 +286,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Next ähnelt. + /// Looks up a localized string similar to Next. /// internal static string PagerNext { get { @@ -295,7 +295,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Previous ähnelt. + /// Looks up a localized string similar to Previous. /// internal static string PagerPrevious { get { @@ -304,7 +304,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Contains ähnelt. + /// Looks up a localized string similar to Contains. /// internal static string StringConditionContains { get { @@ -313,7 +313,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Does not contain ähnelt. + /// Looks up a localized string similar to Does not contain. /// internal static string StringConditionDoesNotContain { get { @@ -322,7 +322,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Ends with ähnelt. + /// Looks up a localized string similar to Ends with. /// internal static string StringConditionEndsWith { get { @@ -331,7 +331,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Is equal to ähnelt. + /// Looks up a localized string similar to Is equal to. /// internal static string StringConditionIsEqualTo { get { @@ -340,7 +340,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Is not equal to ähnelt. + /// Looks up a localized string similar to Is not equal to. /// internal static string StringConditionIsNotEqualTo { get { @@ -349,7 +349,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Is not null or empty ähnelt. + /// Looks up a localized string similar to Is not null or empty. /// internal static string StringConditionIsNotNullOrEmpty { get { @@ -358,7 +358,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Is null or empty ähnelt. + /// Looks up a localized string similar to Is null or empty. /// internal static string StringConditionIsNullOrEmpty { get { @@ -367,7 +367,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Starts with ähnelt. + /// Looks up a localized string similar to Starts with. /// internal static string StringConditionStartsWith { get { @@ -376,7 +376,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Details View ähnelt. + /// Looks up a localized string similar to Details View. /// internal static string TableDetailsView { get { @@ -385,7 +385,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Global Search... ähnelt. + /// Looks up a localized string similar to Global Search.... /// internal static string TableGlobalSearch { get { @@ -394,7 +394,7 @@ internal class Localization { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Loading... ähnelt. + /// Looks up a localized string similar to Loading.... /// internal static string TableLoading { get { From 210a7ee58ca73c54ca4cff5c3f68832219194383 Mon Sep 17 00:00:00 2001 From: Ivan Josipovic <9521987+IvanJosipovic@users.noreply.github.com> Date: Wed, 25 Nov 2020 22:48:27 -0800 Subject: [PATCH 7/7] fixed bad merge change column visibility plus to link --- src/BlazorTable/Components/Table.razor | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/BlazorTable/Components/Table.razor b/src/BlazorTable/Components/Table.razor index 2f41cff8..91a4fcbe 100644 --- a/src/BlazorTable/Components/Table.razor +++ b/src/BlazorTable/Components/Table.razor @@ -15,7 +15,7 @@ + } @if (Columns.Exists(column => !column.Visible)) { @@ -38,9 +38,11 @@
    + @if (ShowSearchBar) + { + + } + @if (Columns.Exists(column => !column.Visible)) + { + + +

    Column Visibility

    +
    + + @foreach (IColumn column in Columns.Where(column => !column.Visible)) + { + + + + + } +
    + @(column.Title) + +
    + +
    +
    + +
    +
    + } +
    - -
    - @column.Title - - @if (column.SortColumn) - { - if (column.SortDescending) - { } - else - { } - } - - @if (column.Filterable) - { -
    + +
    + @column.Title + + @if (column.SortColumn) + { + if (column.SortDescending) + { } + else + { } + } + + @if (column.Filterable) + { + + + +

    Filter

    +
    + + + + + + + @if (column.CustomIFilters != null) + { + @column.CustomIFilters(column) + } + +
    +
    +
    + } + + @if (column.Hideable) + { +
    + - -
    - - -

    Filter

    -
    - - - - - - - @if (column.CustomIFilters != null) - { - @column.CustomIFilters(column) - } - -
    -
    -
    - } -
    -
    - - @if (IsEditMode && column.EditTemplate != null) - @column.EditTemplate(item) - else if (column.Template == null) - @column.Render(item) - else - @column.Template(item) - + + @if (IsEditMode && column.EditTemplate != null) + @column.EditTemplate(item) + else if (column.Template == null) + @column.Render(item) + else + @column.Template(item) +
    @if (ShowSearchBar) { -
    - + + +