From a6983b5510887f12ac06cab114ab1b2b414ee06d Mon Sep 17 00:00:00 2001 From: Ilkay Ilknur Date: Tue, 6 Apr 2021 15:48:03 +0300 Subject: [PATCH 1/2] `Sortable` and `DisplayFormatProvider` properties have been added to the `TableColumn` --- .../Extensibility/TableColumns/TableColumn.cs | 3 ++ .../Components/AbpExtensibleDataGrid.razor | 41 ++++++++++++------- .../Components/AbpExtensibleDataGrid.razor.cs | 12 ++++++ 3 files changed, 41 insertions(+), 15 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Extensibility/TableColumns/TableColumn.cs b/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Extensibility/TableColumns/TableColumn.cs index 0676c14399..2121b8a128 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Extensibility/TableColumns/TableColumn.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Extensibility/TableColumns/TableColumn.cs @@ -1,6 +1,7 @@ using JetBrains.Annotations; using System; using System.Collections.Generic; +using System.Globalization; using Volo.Abp.AspNetCore.Components.Web.Extensibility.EntityActions; namespace Volo.Abp.AspNetCore.Components.Web.Extensibility.TableColumns @@ -11,11 +12,13 @@ namespace Volo.Abp.AspNetCore.Components.Web.Extensibility.TableColumns public string Data { get; set; } [CanBeNull] public string DisplayFormat { get; set; } + public IFormatProvider DisplayFormatProvider { get; set; } = CultureInfo.CurrentCulture; [CanBeNull] public Type Component { get; set; } public List Actions { get; set; } [CanBeNull] public Func ValueConverter { get; set; } + public bool Sortable { get; set; } public TableColumn() { diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor b/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor index f060450ffd..e0b867492e 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor @@ -25,11 +25,11 @@ if (action.ConfirmationMessage != null) { } @@ -37,9 +37,9 @@ { } @@ -62,7 +62,26 @@ { if (!ExtensionPropertiesRegex.IsMatch(column.Data)) { - + @if (column.ValueConverter == null) + { + + } + else + { + + + @(GetConvertedFieldValue(context, column)) + + + } } else { @@ -87,14 +106,7 @@ { if (column.ValueConverter != null) { - if (column.DisplayFormat == null) - { - @(column.ValueConverter(propertyValue)) - } - else - { - @(string.Format(column.DisplayFormat, column.ValueConverter(propertyValue))) - } + @(GetConvertedFieldValue(context, column)) } else { @@ -104,10 +116,9 @@ } else { - @(string.Format(column.DisplayFormat, propertyValue)) + @(string.Format(column.DisplayFormatProvider, column.DisplayFormat, propertyValue)) } } - } } diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor.cs index 72a58f94a5..71ff4b61ec 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor.cs @@ -46,5 +46,17 @@ namespace Volo.Abp.BlazoriseUI.Components builder.CloseComponent(); }; } + + protected virtual string GetConvertedFieldValue(TItem item, TableColumn columnDefinition) + { + var convertedValue = columnDefinition.ValueConverter.Invoke(item); + if (!columnDefinition.DisplayFormat.IsNullOrEmpty()) + { + return string.Format(columnDefinition.DisplayFormatProvider, columnDefinition.DisplayFormat, + convertedValue); + } + + return convertedValue; + } } } \ No newline at end of file From 929c4aae86a2f441ad721f9150477378f909a73b Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Wed, 7 Apr 2021 14:01:34 +0300 Subject: [PATCH 2/2] add warning about dotnet run in proxy generation doc --- docs/en/UI/Angular/Service-Proxies.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/en/UI/Angular/Service-Proxies.md b/docs/en/UI/Angular/Service-Proxies.md index 3a10f1b6e8..18e5a3a0cc 100644 --- a/docs/en/UI/Angular/Service-Proxies.md +++ b/docs/en/UI/Angular/Service-Proxies.md @@ -10,6 +10,8 @@ To avoid manual effort, we might use a tool like [NSWAG](https://github.com/Rico ABP introduces an endpoint that exposes server-side method contracts. When the `generate-proxy` command is run, ABP CLI makes an HTTP request to this endpoint and generates better-aligned client proxies in TypeScript. It organizes folders according to namespaces, adds barrel exports, and reflects method signatures in Angular services. +> Before you start, please make sure you start the backend application with `dotnet run`. There is a [known limitation about Visual Studio](#known-limitations), so please do not run the project using its built-in web server. + Run the following command in the **root folder** of the angular application: ```bash