diff --git a/Assets/Blazor/MdiHost.gif b/Assets/Blazor/MdiHost.gif new file mode 100644 index 00000000..08fadde1 Binary files /dev/null and b/Assets/Blazor/MdiHost.gif differ diff --git a/README.md b/README.md index 1b699465..ea9cea45 100644 --- a/README.md +++ b/README.md @@ -3,12 +3,15 @@ # EficazFramework ![DotNet Versions](https://img.shields.io/static/v1?label=dotnet&message=6.0%20%7C%207.0&color=blueviolet&style=flat-square&logo=dotnet) -![Azure DevOps builds](https://eficazshields.azurewebsites.net/azure-devops/build/eficazcs/EficazFramework/27?&logo=azurepipelines&logoColor=white&style=flat-square) -![Azure DevOps tests (compact)](https://eficazshields.azurewebsites.net/azure-devops/tests/eficazcs/EficazFramework/18?compact_message&logo=azuredevops&logoColor=white&style=flat-square) -![Azure DevOps coverage](https://eficazshields.azurewebsites.net/azure-devops/coverage/eficazcs/EficazFramework/18?logo=codecov&logoColor=white&style=flat-square) [![Discord](https://eficazshields.azurewebsites.net/discord/846078359498653706?color=purple&logo=discord&logoColor=white&style=flat-square)](https://discord.gg/ePvZEGBgaf) [![Twitter Follow](https://eficazshields.azurewebsites.net/twitter/follow/EficazCS?color=blue&label=twitter&logo=twitter&logoColor=white&style=flat-square)](https://twitter.com/EficazCS) +| Área | Versão | Build | Testes | Cobertura | +| :--- | :---: | :---: | :---: | :---: | +| Core | ![Nuget](https://eficazshields.azurewebsites.net/nuget/v/EficazFramework.Utilities?style=flat-square) | ![Azure DevOps builds](https://eficazshields.azurewebsites.net/azure-devops/build/eficazcs/EficazFramework/27?&logo=azurepipelines&logoColor=white&style=flat-square) | ![Azure DevOps tests (compact)](https://eficazshields.azurewebsites.net/azure-devops/tests/eficazcs/EficazFramework/18?compact_message&logo=azuredevops&logoColor=white&style=flat-square) | ![Azure DevOps coverage](https://eficazshields.azurewebsites.net/azure-devops/coverage/eficazcs/EficazFramework/18?logo=codecov&logoColor=white&style=flat-square) | +| Blazor | ![Nuget](https://eficazshields.azurewebsites.net/nuget/v/EficazFramework.Blazor?style=flat-square) | ![Azure DevOps builds](https://eficazshields.azurewebsites.net/azure-devops/build/eficazcs/EficazFramework/29?&logo=azurepipelines&logoColor=white&style=flat-square) | ![Azure DevOps tests (compact)](https://eficazshields.azurewebsites.net/azure-devops/tests/eficazcs/EficazFramework/30?compact_message&logo=azuredevops&logoColor=white&style=flat-square) | ![Azure DevOps coverage](https://eficazshields.azurewebsites.net/azure-devops/coverage/eficazcs/EficazFramework/30?logo=codecov&logoColor=white&style=flat-square) +| WPF | N/A | ![Azure DevOps builds (branch)](https://eficazshields.azurewebsites.net/azure-devops/build/eficazcs/EficazFramework/26/master?&logo=azurepipelines&logoColor=white&style=flat-square) | ![Azure DevOps tests (compact)](https://eficazshields.azurewebsites.net/azure-devops/tests/eficazcs/EficazFramework/26?compact_message&logo=azuredevops&logoColor=white&style=flat-square) | ![Azure DevOps coverage](https://eficazshields.azurewebsites.net/azure-devops/coverage/eficazcs/EficazFramework/26?logo=codecov&logoColor=white&style=flat-square) + Bem vindo à EficazFramework, biblioteca de extensões, componentes e utilitários para aplicações .NET em geral. Este projeto tem por finalidade oferecer funcionalidades extras e padronizadas para diversas plataformas. @@ -20,7 +23,7 @@ ## Características -#### Ambiente Multi-Plataformas +### Ambiente Multi-Plataformas - Extensões para operações comuns em datas e números - Extensões para trabalho com textos e suas formatações, incluindo documentos federais e estaduais - Extensões para manipuração de listas de objetos @@ -34,22 +37,19 @@ #### Biblioteca de extensão para Blazor (Server-Side e WebAssembly) -![Azure DevOps builds](https://eficazshields.azurewebsites.net/azure-devops/build/eficazcs/EficazFramework/29?&logo=azurepipelines&logoColor=white&style=flat-square) -![Azure DevOps tests (compact)](https://eficazshields.azurewebsites.net/azure-devops/tests/eficazcs/EficazFramework/30?compact_message&logo=azuredevops&logoColor=white&style=flat-square) -![Azure DevOps coverage](https://eficazshields.azurewebsites.net/azure-devops/coverage/eficazcs/EficazFramework/30?logo=codecov&logoColor=white&style=flat-square) - - Novos Componentes, Templates e Layouts para melhor padronização das aplicações, conforme sua natureza - UI baseada em MaterialDesign, utilizando a biblioteca OpenSource [MudBlazor](https://github.com/MudBlazor/MudBlazor) -#### Biblioteca de extensão para Windows Presentation Foundation (WPF) +![Mdi Host](/Assets/Blazor/MdiHost.gif) -![Azure DevOps builds (branch)](https://eficazshields.azurewebsites.net/azure-devops/build/eficazcs/EficazFramework/26/master?label=tests&logo=azuredevops&logoColor=white&style=flat-square) -![Azure DevOps tests (compact)](https://eficazshields.azurewebsites.net/azure-devops/tests/eficazcs/EficazFramework/26?compact_message&logo=azuredevops&logoColor=white&style=flat-square) -![Azure DevOps coverage](https://eficazshields.azurewebsites.net/azure-devops/coverage/eficazcs/EficazFramework/26?logo=codecov&logoColor=white&style=flat-square) +### Biblioteca de extensão para Windows Presentation Foundation (WPF) - Controles Visuais para melhor experiência de utilização pelo usuário - Extensões para XAML e Code-Behind - UI baseada em MaterialDesign, usufruindo do trabalho feito na versão 3.x desta framework, consolidada no mercado e em produção desde 2015; -#### Pré-Requisitos - - [.NET 6.0](https://dotnet.microsoft.com/download/dotnet/6.0), para versão mais recente da biblioteca (pode sofrer alterações sem aviso prévio). +### Pré-Requisitos +| Versão | Versão do .NET | Suporte | +| :--- | :--- | :---: | +| 6.1.x | [.NET 6](https://dotnet.microsoft.com/download/dotnet/6.0); [.NET 7](https://dotnet.microsoft.com/en-us/download/dotnet/7.0) | :white_check_mark:| +| 6.0.x | [.NET 6](https://dotnet.microsoft.com/download/dotnet/6.0) | :x: | diff --git a/src/CodeGenerators/EficazFramework.Generators/EficazFramework.Generators.csproj b/src/CodeGenerators/EficazFramework.Generators/EficazFramework.Generators.csproj index 99672b56..87e6f84a 100644 --- a/src/CodeGenerators/EficazFramework.Generators/EficazFramework.Generators.csproj +++ b/src/CodeGenerators/EficazFramework.Generators/EficazFramework.Generators.csproj @@ -34,8 +34,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/src/Core/EficazFramework.Collections/EficazFramework.Collections.csproj b/src/Core/EficazFramework.Collections/EficazFramework.Collections.csproj index 2db17c4d..b2daba91 100644 --- a/src/Core/EficazFramework.Collections/EficazFramework.Collections.csproj +++ b/src/Core/EficazFramework.Collections/EficazFramework.Collections.csproj @@ -2,9 +2,9 @@ net6.0;net7.0 - 6.1.3 - 6.1.3.0 - 6.1.3.0 + 6.1.5 + 6.1.5.0 + 6.1.5.0 EficazFramework true EfCore.snk diff --git a/src/Core/EficazFramework.Data/EficazFramework.Data.csproj b/src/Core/EficazFramework.Data/EficazFramework.Data.csproj index 57b5ce3d..da5c6ce8 100644 --- a/src/Core/EficazFramework.Data/EficazFramework.Data.csproj +++ b/src/Core/EficazFramework.Data/EficazFramework.Data.csproj @@ -2,9 +2,9 @@ net6.0;net7.0 - 6.1.3 - 6.1.3.0 - 6.1.3.0 + 6.1.5 + 6.1.5.0 + 6.1.5.0 EficazFramework true EfCore.snk @@ -90,6 +90,9 @@ + + + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -100,19 +103,19 @@ - + - + True True diff --git a/src/Core/EficazFramework.Expressions/EficazFramework.Expressions.csproj b/src/Core/EficazFramework.Expressions/EficazFramework.Expressions.csproj index 2321b869..a75504ec 100644 --- a/src/Core/EficazFramework.Expressions/EficazFramework.Expressions.csproj +++ b/src/Core/EficazFramework.Expressions/EficazFramework.Expressions.csproj @@ -2,9 +2,9 @@ net6.0;net7.0 - 6.1.3 - 6.1.3.0 - 6.1.3.0 + 6.1.5 + 6.1.5.0 + 6.1.5.0 EficazFramework true EfCore.snk diff --git a/src/Core/EficazFramework.Utilities/EficazFramework.Utilities.csproj b/src/Core/EficazFramework.Utilities/EficazFramework.Utilities.csproj index 5bff25db..4506da18 100644 --- a/src/Core/EficazFramework.Utilities/EficazFramework.Utilities.csproj +++ b/src/Core/EficazFramework.Utilities/EficazFramework.Utilities.csproj @@ -2,9 +2,9 @@ net6.0;net7.0 - 6.1.3 - 6.1.3.0 - 6.1.3.0 + 6.1.5 + 6.1.5.0 + 6.1.5.0 enable EficazFramework Eficaz Sistemas @@ -56,6 +56,7 @@ + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -65,15 +66,13 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + - - - + diff --git a/src/DataProviders/EficazFramework.Data.InMemory/EficazFramework.Data.InMemory.csproj b/src/DataProviders/EficazFramework.Data.InMemory/EficazFramework.Data.InMemory.csproj index 748cbbe3..ce5632a4 100644 --- a/src/DataProviders/EficazFramework.Data.InMemory/EficazFramework.Data.InMemory.csproj +++ b/src/DataProviders/EficazFramework.Data.InMemory/EficazFramework.Data.InMemory.csproj @@ -2,9 +2,9 @@ net6.0;net7.0 - 6.1.3 - 6.1.3.0 - 6.1.3.0 + 6.1.5 + 6.1.5.0 + 6.1.5.0 EficazFramework true EfCore.snk @@ -56,6 +56,7 @@ + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -65,14 +66,6 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - diff --git a/src/DataProviders/EficazFramework.Data.MsSqlServer/EficazFramework.Data.MsSqlServer.csproj b/src/DataProviders/EficazFramework.Data.MsSqlServer/EficazFramework.Data.MsSqlServer.csproj index c70bb06f..abce66d0 100644 --- a/src/DataProviders/EficazFramework.Data.MsSqlServer/EficazFramework.Data.MsSqlServer.csproj +++ b/src/DataProviders/EficazFramework.Data.MsSqlServer/EficazFramework.Data.MsSqlServer.csproj @@ -2,9 +2,9 @@ net6.0;net7.0 - 6.1.3 - 6.1.3.0 - 6.1.3.0 + 6.1.5 + 6.1.5.0 + 6.1.5.0 EficazFramework true EfCore.snk @@ -56,6 +56,7 @@ + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -66,14 +67,6 @@ - - - - - - - - diff --git a/src/DataProviders/EficazFramework.Data.MySql/EficazFramework.Data.MySql.csproj b/src/DataProviders/EficazFramework.Data.MySql/EficazFramework.Data.MySql.csproj index 70aa2216..702ec45f 100644 --- a/src/DataProviders/EficazFramework.Data.MySql/EficazFramework.Data.MySql.csproj +++ b/src/DataProviders/EficazFramework.Data.MySql/EficazFramework.Data.MySql.csproj @@ -2,9 +2,9 @@ net6.0;net7.0 - 6.1.3 - 6.1.3.0 - 6.1.3.0 + 6.1.5 + 6.1.5.0 + 6.1.5.0 EficazFramework true EfCore.snk @@ -54,6 +54,7 @@ + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -64,14 +65,6 @@ - - - - - - - - diff --git a/src/DataProviders/EficazFramework.Data.SqlLite/EficazFramework.Data.SqlLite.csproj b/src/DataProviders/EficazFramework.Data.SqlLite/EficazFramework.Data.SqlLite.csproj index 689a114b..9267da7f 100644 --- a/src/DataProviders/EficazFramework.Data.SqlLite/EficazFramework.Data.SqlLite.csproj +++ b/src/DataProviders/EficazFramework.Data.SqlLite/EficazFramework.Data.SqlLite.csproj @@ -2,9 +2,9 @@ net6.0;net7.0 - 6.1.3 - 6.1.3.0 - 6.1.3.0 + 6.1.5 + 6.1.5.0 + 6.1.5.0 EficazFramework true EfCore.snk @@ -48,6 +48,7 @@ + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -57,14 +58,6 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - diff --git a/src/Desktop/EficazFramework.WPF/EficazFramework.WPF.csproj b/src/Desktop/EficazFramework.WPF/EficazFramework.WPF.csproj index d69654a1..f951dfc4 100644 --- a/src/Desktop/EficazFramework.WPF/EficazFramework.WPF.csproj +++ b/src/Desktop/EficazFramework.WPF/EficazFramework.WPF.csproj @@ -3,9 +3,9 @@ net6.0-windows;net7.0-windows true - 6.1.3 - 6.1.3.0 - 6.1.3.0 + 6.1.5 + 6.1.5.0 + 6.1.5.0 EficazFramework Eficaz Sistemas Eficaz Sistemas de Gestão e Inteligência Tributária @@ -56,7 +56,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/Tests/Core/EficazFramework.Tests/EficazFramework.Tests.csproj b/src/Tests/Core/EficazFramework.Tests/EficazFramework.Tests.csproj index 94238b0b..fb8b4c4f 100644 --- a/src/Tests/Core/EficazFramework.Tests/EficazFramework.Tests.csproj +++ b/src/Tests/Core/EficazFramework.Tests/EficazFramework.Tests.csproj @@ -21,11 +21,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -37,38 +37,31 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - + + + + - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/Tests/Desktop/EficazFramework.Tests.WPF/EficazFramework.Tests.WPF.csproj b/src/Tests/Desktop/EficazFramework.Tests.WPF/EficazFramework.Tests.WPF.csproj index c4151acd..2f770592 100644 --- a/src/Tests/Desktop/EficazFramework.Tests.WPF/EficazFramework.Tests.WPF.csproj +++ b/src/Tests/Desktop/EficazFramework.Tests.WPF/EficazFramework.Tests.WPF.csproj @@ -20,15 +20,15 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Tests/Docs/EficazFramework.Tests.DocsApiPlugin/EficazFramework.Tests.DocsApiPlugin.csproj b/src/Tests/Docs/EficazFramework.Tests.DocsApiPlugin/EficazFramework.Tests.DocsApiPlugin.csproj index 157250b7..5097e2c9 100644 --- a/src/Tests/Docs/EficazFramework.Tests.DocsApiPlugin/EficazFramework.Tests.DocsApiPlugin.csproj +++ b/src/Tests/Docs/EficazFramework.Tests.DocsApiPlugin/EficazFramework.Tests.DocsApiPlugin.csproj @@ -25,14 +25,14 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Tests/Generators/EficazFramework.Tests.Generators/EficazFramework.Tests.Generators.csproj b/src/Tests/Generators/EficazFramework.Tests.Generators/EficazFramework.Tests.Generators.csproj index 378dfe74..d6adb0f6 100644 --- a/src/Tests/Generators/EficazFramework.Tests.Generators/EficazFramework.Tests.Generators.csproj +++ b/src/Tests/Generators/EficazFramework.Tests.Generators/EficazFramework.Tests.Generators.csproj @@ -8,12 +8,12 @@ - + - + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Tests/Web/EficazFramework.Tests.Blazor.Views/Pages/Components/Panels/Mdi.razor b/src/Tests/Web/EficazFramework.Tests.Blazor.Views/Pages/Components/Panels/Mdi.razor index ffda4d43..c2594a71 100644 --- a/src/Tests/Web/EficazFramework.Tests.Blazor.Views/Pages/Components/Panels/Mdi.razor +++ b/src/Tests/Web/EficazFramework.Tests.Blazor.Views/Pages/Components/Panels/Mdi.razor @@ -1,5 +1,11 @@ @page "/Components/Panels/Mdi" + +
MdiDataGridApp - + diff --git a/src/Tests/Web/EficazFramework.Tests.Blazor.Views/Pages/Components/Panels/MdiApps/MdiDataGridApp.razor.css b/src/Tests/Web/EficazFramework.Tests.Blazor.Views/Pages/Components/Panels/MdiApps/MdiDataGridApp.razor.css new file mode 100644 index 00000000..e02abfc9 --- /dev/null +++ b/src/Tests/Web/EficazFramework.Tests.Blazor.Views/Pages/Components/Panels/MdiApps/MdiDataGridApp.razor.css @@ -0,0 +1 @@ + diff --git a/src/Tests/Web/EficazFramework.Tests.Blazor.Views/Pages/Components/Panels/MdiApps/MdiDataGridFullScreenApp.razor b/src/Tests/Web/EficazFramework.Tests.Blazor.Views/Pages/Components/Panels/MdiApps/MdiDataGridFullScreenApp.razor deleted file mode 100644 index be6b1772..00000000 --- a/src/Tests/Web/EficazFramework.Tests.Blazor.Views/Pages/Components/Panels/MdiApps/MdiDataGridFullScreenApp.razor +++ /dev/null @@ -1,24 +0,0 @@ -

MdiDataGridFullScreenApp

- - - - - - @context.Item - - - - - -@code { - EficazFramework.Collections.StringCollection _dataSource = new(); - - protected override void OnInitialized() - { - base.OnInitialized(); - for (int i = 0; i <= 10000; i++) - { - _dataSource.Add($"Data {i}"); - } - } -} diff --git a/src/Tests/Web/EficazFramework.Tests.Blazor.Views/Resources/Mocks/Applications.cs b/src/Tests/Web/EficazFramework.Tests.Blazor.Views/Resources/Mocks/Applications.cs index a668c367..a875b93d 100644 --- a/src/Tests/Web/EficazFramework.Tests.Blazor.Views/Resources/Mocks/Applications.cs +++ b/src/Tests/Web/EficazFramework.Tests.Blazor.Views/Resources/Mocks/Applications.cs @@ -131,7 +131,7 @@ public static void GenerateApps(EficazFramework.Application.IApplicationManager? appDataGrid2.Targets.Add("Blazor", new() { Icon = MudBlazor.Icons.Material.Filled.DataArray, - StartupUriOrType = typeof(EficazFramework.Tests.Blazor.Views.Pages.Components.Panels.MdiApps.MdiDataGridFullScreenApp) + StartupUriOrType = typeof(EficazFramework.Tests.Blazor.Views.Pages.Components.Panels.MdiApps.MdiDataGridApp) }); appDataGrid2.Targets["Blazor"].Properties.Add("IsMaximized", true); diff --git a/src/Tests/Web/EficazFramework.Tests.Blazor/EficazFramework.Tests.Blazor.csproj b/src/Tests/Web/EficazFramework.Tests.Blazor/EficazFramework.Tests.Blazor.csproj index 28e4beb1..d54d8201 100644 --- a/src/Tests/Web/EficazFramework.Tests.Blazor/EficazFramework.Tests.Blazor.csproj +++ b/src/Tests/Web/EficazFramework.Tests.Blazor/EficazFramework.Tests.Blazor.csproj @@ -1,4 +1,4 @@ - + net6.0;net7.0 @@ -12,20 +12,21 @@ - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + @@ -34,13 +35,11 @@ - - + - - + diff --git a/src/Tests/Web/EficazFramework.Tests.Blazor/Services/ServicesTest.cs b/src/Tests/Web/EficazFramework.Tests.Blazor/Services/ServicesTest.cs index 86d70117..c0332e4b 100644 --- a/src/Tests/Web/EficazFramework.Tests.Blazor/Services/ServicesTest.cs +++ b/src/Tests/Web/EficazFramework.Tests.Blazor/Services/ServicesTest.cs @@ -16,14 +16,14 @@ public void Test() o.UseApplicationManager = true; o.Theme = new MudBlazor.MudTheme() { - Palette = new MudBlazor.Palette() + Palette = new MudBlazor.PaletteLight() { Primary = "#0078d7", Secondary = "#003864", AppbarBackground = "#0078d7", AppbarText = "#fff", }, - PaletteDark = new MudBlazor.Palette() + PaletteDark = new MudBlazor.PaletteDark() { Primary = "#0078d7", Secondary = "#003864", diff --git a/src/Web/EficazFramework.Blazor/Components/Input/ChatInput.razor b/src/Web/EficazFramework.Blazor/Components/Input/ChatInput.razor index 666f5387..dde69847 100644 --- a/src/Web/EficazFramework.Blazor/Components/Input/ChatInput.razor +++ b/src/Web/EficazFramework.Blazor/Components/Input/ChatInput.razor @@ -9,8 +9,8 @@ @*note: the value="@Text" is absolutely essential here. the inner html @Text is kept only for compatibility*@ + @oninput="OnInput" @onchange="OnChange" @onblur="OnBlur" @onkeydown="OnKeyDown" @onkeypress="OnKeyPress" @onkeyup="OnKeyUp" @onpaste="OnPaste" value="@Text" + @onkeydown:preventDefault="KeyDownPreventDefault" @onkeypress:preventDefault="KeyPressPreventDefault" @onkeyup:preventDefault="KeyUpPreventDefault">@Text @if (Clearable && !Disabled) { diff --git a/src/Web/EficazFramework.Blazor/Components/Input/ChatMessageField.razor b/src/Web/EficazFramework.Blazor/Components/Input/ChatMessageField.razor index 2aa2bbb2..db84f823 100644 --- a/src/Web/EficazFramework.Blazor/Components/Input/ChatMessageField.razor +++ b/src/Web/EficazFramework.Blazor/Components/Input/ChatMessageField.razor @@ -6,7 +6,7 @@ diff --git a/src/Web/EficazFramework.Blazor/Components/Input/DocumentField.cs b/src/Web/EficazFramework.Blazor/Components/Input/DocumentField.cs index b9844cc1..8f45b6b5 100644 --- a/src/Web/EficazFramework.Blazor/Components/Input/DocumentField.cs +++ b/src/Web/EficazFramework.Blazor/Components/Input/DocumentField.cs @@ -40,10 +40,10 @@ public string UF } } - protected override void OnBlurred(FocusEventArgs obj) + protected override Task OnBlurredAsync(FocusEventArgs obj) { - base.OnBlurred(obj); - SetTextAsync(Converter.Set(Value), false); + base.OnBlurredAsync(obj); + return SetTextAsync(Converter.Set(Value), false); } } diff --git a/src/Web/EficazFramework.Blazor/Components/Input/FocusTrapEx.razor b/src/Web/EficazFramework.Blazor/Components/Input/FocusTrapEx.razor new file mode 100644 index 00000000..a345ba4a --- /dev/null +++ b/src/Web/EficazFramework.Blazor/Components/Input/FocusTrapEx.razor @@ -0,0 +1,41 @@ +@inherits MudBlazor.MudFocusTrap +@namespace EficazFramework.Components + +
+ +
+
+ +
+
+ +
+
+ +
+ @ChildContent +
+ +
+
+ +
+
+ +
+ +@code { + string TrapTabIndex => (Disabled? "-1" : "0"); +} \ No newline at end of file diff --git a/src/Web/EficazFramework.Blazor/Components/Input/FocusTrapEx.razor.cs b/src/Web/EficazFramework.Blazor/Components/Input/FocusTrapEx.razor.cs new file mode 100644 index 00000000..168434ce --- /dev/null +++ b/src/Web/EficazFramework.Blazor/Components/Input/FocusTrapEx.razor.cs @@ -0,0 +1,124 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Web; +using MudBlazor; +using MudBlazor.Utilities; + +namespace EficazFramework.Components; +public partial class FocusTrapEx : MudFocusTrap +{ + + protected string HostClassName => + new CssBuilder() + .AddClass(Class) + .Build(); + + /// + /// User class names, separated by space, the the ChildContent host. + /// + [Parameter] + [Category(CategoryTypes.ComponentBase.Common)] + public string? HostClass { get; set; } + + private bool _shiftDown; + private bool _initialized; + private bool _shouldRender = true; + + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + await base.OnAfterRenderAsync(firstRender); + + if (firstRender) + await SaveFocusAsync(); + + if (!_initialized) + await InitializeFocusAsync(); + } + + private Task OnBottomFocusAsync(FocusEventArgs args) + { + return FocusLastAsync(); + } + + private Task OnBumperFocusAsync(FocusEventArgs args) + { + return _shiftDown ? FocusLastAsync() : FocusFirstAsync(); + } + + private Task OnRootFocusAsync(FocusEventArgs args) + { + return FocusFallbackAsync(); + } + + internal void OnRootKeyDown(KeyboardEventArgs args) + { + HandleKeyEvent(args); + } + + private void OnRootKeyUp(KeyboardEventArgs args) + { + HandleKeyEvent(args); + } + + private Task OnTopFocusAsync(FocusEventArgs args) + { + return FocusFirstAsync(); + } + + private Task InitializeFocusAsync() + { + _initialized = true; + + if (!Disabled) + { + switch (DefaultFocus) + { + case DefaultFocus.Element: return FocusFallbackAsync(); + case DefaultFocus.FirstChild: return FocusFirstAsync(); + case DefaultFocus.LastChild: return FocusLastAsync(); + } + } + return Task.CompletedTask; + } + + private Task FocusFallbackAsync() + { + return _fallback.FocusAsync().AsTask(); + } + + private Task FocusFirstAsync() + { + return _root.MudFocusFirstAsync(2, 4).AsTask(); + } + + private Task FocusLastAsync() + { + return _root.MudFocusLastAsync(2, 4).AsTask(); + } + + private void HandleKeyEvent(KeyboardEventArgs args) + { + _shouldRender = false; + if (args.Key == "Tab") + _shiftDown = args.ShiftKey; + } + + private Task RestoreFocusAsync() + { + return _root.MudRestoreFocusAsync().AsTask(); + } + + private Task SaveFocusAsync() + { + return _root.MudSaveFocusAsync().AsTask(); + } + + + protected override bool ShouldRender() + { + if (_shouldRender) + return true; + _shouldRender = true; // auto-reset _shouldRender to true + return false; + } +} diff --git a/src/Web/EficazFramework.Blazor/Components/Input/NumberField.cs b/src/Web/EficazFramework.Blazor/Components/Input/NumberField.cs index 50e9c85a..97062922 100644 --- a/src/Web/EficazFramework.Blazor/Components/Input/NumberField.cs +++ b/src/Web/EficazFramework.Blazor/Components/Input/NumberField.cs @@ -36,10 +36,12 @@ protected void SetupAttributes() attributes["step"] = (object)"1"; } - protected override void OnBlurred(FocusEventArgs obj) + + protected override Task OnBlurredAsync(FocusEventArgs obj) { - base.OnBlurred(obj); - SetTextAsync(Converter.Set(Value), false); + base.OnBlurredAsync(obj); + return SetTextAsync(Converter.Set(Value), false); } + } diff --git a/src/Web/EficazFramework.Blazor/Components/Panels/MdiWindow.razor b/src/Web/EficazFramework.Blazor/Components/Panels/MdiWindow.razor index 033cdf4c..b9678e16 100644 --- a/src/Web/EficazFramework.Blazor/Components/Panels/MdiWindow.razor +++ b/src/Web/EficazFramework.Blazor/Components/Panels/MdiWindow.razor @@ -22,7 +22,11 @@ Class="mr-2 mt-1"> @(ApplicationInstance != null ? ApplicationInstance.Title : Title) - @HeaderContent +
+ @HeaderContent +
- + @ChildContent - + diff --git a/src/Web/EficazFramework.Blazor/EficazFramework.Blazor.csproj b/src/Web/EficazFramework.Blazor/EficazFramework.Blazor.csproj index 09ad2fa7..2c5c51c5 100644 --- a/src/Web/EficazFramework.Blazor/EficazFramework.Blazor.csproj +++ b/src/Web/EficazFramework.Blazor/EficazFramework.Blazor.csproj @@ -5,9 +5,9 @@ enable enable true - 6.1.3 - 6.1.3.0 - 6.1.3.0 + 6.1.5 + 6.1.5 + 6.1.5 EficazFramework Eficaz Sistemas Eficaz Sistemas de Gestão e Inteligência Tributária @@ -96,7 +96,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive
- +
diff --git a/src/Web/EficazFramework.Blazor/_Imports.razor b/src/Web/EficazFramework.Blazor/_Imports.razor new file mode 100644 index 00000000..c3615efc --- /dev/null +++ b/src/Web/EficazFramework.Blazor/_Imports.razor @@ -0,0 +1 @@ +@using Microsoft.AspNetCore.Components.Web \ No newline at end of file