From 98c17468ae912260a2c5decb17891183b2c6dc52 Mon Sep 17 00:00:00 2001 From: Ilkay Ilknur Date: Thu, 10 Dec 2020 16:41:09 +0300 Subject: [PATCH] UI extensions initial implementation. --- .../EntityActions/EntityAction.cs | 14 ++++++++++++ .../EntityActions/EntityActionDictionary.cs | 9 ++++++++ .../EntityActionsConfiguration.cs | 19 ++++++++++++++++ .../Extensibility/TableColumns/TableColumn.cs | 22 +++++++++++++++++++ .../TableColumns/TableColumnDictionary.cs | 9 ++++++++ .../TableColumns/TableColumnsConfiguration.cs | 19 ++++++++++++++++ .../Components/Extensibility/UIExtensions.cs | 20 +++++++++++++++++ 7 files changed, 112 insertions(+) create mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/EntityActions/EntityAction.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/EntityActions/EntityActionDictionary.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/EntityActions/EntityActionsConfiguration.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/TableColumns/TableColumn.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/TableColumns/TableColumnDictionary.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/TableColumns/TableColumnsConfiguration.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/UIExtensions.cs diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/EntityActions/EntityAction.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/EntityActions/EntityAction.cs new file mode 100644 index 0000000000..74bf28157f --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/EntityActions/EntityAction.cs @@ -0,0 +1,14 @@ +using System; +using System.Threading.Tasks; + +namespace Volo.Abp.AspNetCore.Components.Extensibility.EntityActions +{ + public class EntityAction + { + public string Text { get; set; } + public Func Clicked { get; set; } + public string RequiredPolicy { get; set; } + public Func ConfirmationMessage { get; set; } + public bool Primary { get; set; } + } +} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/EntityActions/EntityActionDictionary.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/EntityActions/EntityActionDictionary.cs new file mode 100644 index 0000000000..3f0aa796c5 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/EntityActions/EntityActionDictionary.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; + +namespace Volo.Abp.AspNetCore.Components.Extensibility.EntityActions +{ + public class EntityActionDictionary : Dictionary> + { + + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/EntityActions/EntityActionsConfiguration.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/EntityActions/EntityActionsConfiguration.cs new file mode 100644 index 0000000000..26cc22275b --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/EntityActions/EntityActionsConfiguration.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; + +namespace Volo.Abp.AspNetCore.Components.Extensibility.EntityActions +{ + public class EntityActionsConfiguration + { + protected EntityActionDictionary EntityActions { get; set; } + + public EntityActionsConfiguration() + { + EntityActions = new EntityActionDictionary(); + } + + public List Get() + { + return EntityActions.GetOrAdd(typeof(T).FullName, () => new List()); + } + } +} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/TableColumns/TableColumn.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/TableColumns/TableColumn.cs new file mode 100644 index 0000000000..9a50860c99 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/TableColumns/TableColumn.cs @@ -0,0 +1,22 @@ +using JetBrains.Annotations; +using Microsoft.AspNetCore.Components; +using System; +using System.Collections.Generic; +using Volo.Abp.AspNetCore.Components.Extensibility.EntityActions; + +namespace Volo.Abp.AspNetCore.Components.Extensibility.TableColumns +{ + public class TableColumn + { + public string Title { get; set; } + public string Data { get; set; } + [CanBeNull] + public Func Render { get; set; } + public List Actions { get; set; } + + public TableColumn() + { + Actions = new List(); + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/TableColumns/TableColumnDictionary.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/TableColumns/TableColumnDictionary.cs new file mode 100644 index 0000000000..f4e7a9b46a --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/TableColumns/TableColumnDictionary.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; + +namespace Volo.Abp.AspNetCore.Components.Extensibility.TableColumns +{ + public class TableColumnDictionary : Dictionary> + { + + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/TableColumns/TableColumnsConfiguration.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/TableColumns/TableColumnsConfiguration.cs new file mode 100644 index 0000000000..d2a9f78fd1 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/TableColumns/TableColumnsConfiguration.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; + +namespace Volo.Abp.AspNetCore.Components.Extensibility.TableColumns +{ + public class TableColumnsConfiguration + { + protected TableColumnDictionary TableColumns { get; set; } + + public TableColumnsConfiguration() + { + TableColumns = new TableColumnDictionary(); + } + + public List Get() + { + return TableColumns.GetOrAdd(typeof(T).FullName, () => new List()); + } + } +} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/UIExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/UIExtensions.cs new file mode 100644 index 0000000000..3bc219fc8d --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/UIExtensions.cs @@ -0,0 +1,20 @@ +using Volo.Abp.AspNetCore.Components.Extensibility.EntityActions; +using Volo.Abp.AspNetCore.Components.Extensibility.TableColumns; + +namespace Volo.Abp.AspNetCore.Components.Extensibility +{ + public class UIExtensions + { + public static UIExtensions Instance { get; protected set; } = new UIExtensions(); + + public EntityActionsConfiguration EntityActions { get; set; } + + public TableColumnsConfiguration TableColumns { get; set; } + + public UIExtensions() + { + EntityActions = new EntityActionsConfiguration(); + TableColumns = new TableColumnsConfiguration(); + } + } +}