+
@@ -12,8 +15,13 @@
@Body
-
+@code{
+
+ protected bool navLarge { get; set; } = true;
+ protected string sideClass { get; set; } = "sidebar";
+}
\ No newline at end of file
diff --git a/EgwCoreLib.BlazorTest/Shared/MainLayout.razor.css b/EgwCoreLib.BlazorTest/Shared/MainLayout.razor.css
index 551e4b2..8dc4822 100644
--- a/EgwCoreLib.BlazorTest/Shared/MainLayout.razor.css
+++ b/EgwCoreLib.BlazorTest/Shared/MainLayout.razor.css
@@ -8,22 +8,22 @@ main {
flex: 1;
}
-.sidebar {
- background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
+.sidebar, .sidebarSmall {
+ background-image: linear-gradient(180deg, rgb(5, 39, 103) 20%, #3aa6ff 90%);
}
.top-row {
background-color: #f7f7f7;
border-bottom: 1px solid #d6d5d5;
- justify-content: flex-end;
height: 3.5rem;
- display: flex;
align-items: center;
+ /*justify-content: space-evenly;
+ display: flex;*/
}
.top-row ::deep a, .top-row .btn-link {
white-space: nowrap;
- margin-left: 1.5rem;
+ margin-left: 0.5rem;
}
.top-row a:first-child {
@@ -45,13 +45,34 @@ main {
}
}
+.bottom-row {
+ color: #dedede;
+ background-color: #000000;
+ height: 1.6rem;
+ align-items: center;
+}
+
+@media (max-width: 640.99px) {
+ .main > div {
+ padding-left: 0.5rem !important;
+ padding-right: 0.5rem !important;
+ }
+}
+
@media (min-width: 641px) {
.page {
flex-direction: row;
}
.sidebar {
- width: 250px;
+ width: 230px;
+ height: 100vh;
+ position: sticky;
+ top: 0;
+ }
+
+ .sidebarSmall {
+ width: 80px;
height: 100vh;
position: sticky;
top: 0;
@@ -64,7 +85,18 @@ main {
}
.top-row, article {
- padding-left: 2rem !important;
- padding-right: 1.5rem !important;
+ padding-left: 1rem !important;
+ padding-right: 1.0rem !important;
+ }
+
+ .bottom-row {
+ position: fixed;
+ bottom: 0;
+ z-index: 1;
+ }
+
+ .main > div {
+ /*padding-left: 0.5rem !important;
+ padding-right: 0.5rem !important;*/
}
}
diff --git a/EgwCoreLib.BlazorTest/Shared/NavMenu.razor b/EgwCoreLib.BlazorTest/Shared/NavMenu.razor
index 8a334bd..23f9203 100644
--- a/EgwCoreLib.BlazorTest/Shared/NavMenu.razor
+++ b/EgwCoreLib.BlazorTest/Shared/NavMenu.razor
@@ -1,4 +1,5 @@
-
+@using EgwCoreLib.BlazorTest.Data
+
EgwCoreLib.BlazorTest
@@ -9,26 +10,19 @@
@code {
diff --git a/EgwCoreLib.Razor/EgwCoreLib.Razor.csproj b/EgwCoreLib.Razor/EgwCoreLib.Razor.csproj
index 9a99e29..1187007 100644
--- a/EgwCoreLib.Razor/EgwCoreLib.Razor.csproj
+++ b/EgwCoreLib.Razor/EgwCoreLib.Razor.csproj
@@ -33,6 +33,7 @@
+
@@ -52,6 +53,7 @@
true
PreserveNewest
+
@@ -64,7 +66,9 @@
-
+
+
+
diff --git a/EgwCoreLib.Razor/NavigationManagerExtension.cs b/EgwCoreLib.Razor/NavigationManagerExtension.cs
new file mode 100644
index 0000000..cddccbd
--- /dev/null
+++ b/EgwCoreLib.Razor/NavigationManagerExtension.cs
@@ -0,0 +1,44 @@
+using Microsoft.AspNetCore.Components;
+using Microsoft.AspNetCore.WebUtilities;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EgwCoreLib.Razor
+{
+ public static class NavigationManagerExtension
+ {
+ #region Public Methods
+
+ ///
+ /// Estensione metodo NavigationManager
+ ///
+ /// https://code-maze.com/query-strings-blazor-webassembly/
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static T ExtractQueryStringByKey(this NavigationManager navManager, string key)
+ {
+ var uri = navManager.ToAbsoluteUri(navManager.Uri);
+ QueryHelpers.ParseQuery(uri.Query)
+ .TryGetValue(key, out var queryValue);
+
+ if (typeof(T).Equals(typeof(int)))
+ {
+ int.TryParse(queryValue, out int result);
+ return (T)(object)result;
+ }
+
+ if (typeof(T).Equals(typeof(string)))
+ return (T)(object)queryValue.ToString();
+
+ return default;
+ }
+
+ #endregion Public Methods
+ }
+}
diff --git a/EgwCoreLib.Razor/PasswordBox.razor b/EgwCoreLib.Razor/PasswordBox.razor
index 6a66586..dcbe5ae 100644
--- a/EgwCoreLib.Razor/PasswordBox.razor
+++ b/EgwCoreLib.Razor/PasswordBox.razor
@@ -8,7 +8,7 @@
}
-
+
@if (showPassword)
{
diff --git a/EgwCoreLib.Razor/PasswordBox.razor.cs b/EgwCoreLib.Razor/PasswordBox.razor.cs
index 98765b8..806a7dd 100644
--- a/EgwCoreLib.Razor/PasswordBox.razor.cs
+++ b/EgwCoreLib.Razor/PasswordBox.razor.cs
@@ -6,6 +6,9 @@ namespace EgwCoreLib.Razor
{
#region Public Properties
+ [Parameter]
+ public bool DisableShow { get; set; } = false;
+
[Parameter]
public string ItemLabel { get; set; } = "";
diff --git a/EgwCoreLib.Razor/PdfDisplay.razor b/EgwCoreLib.Razor/PdfDisplay.razor
new file mode 100644
index 0000000..ecfa851
--- /dev/null
+++ b/EgwCoreLib.Razor/PdfDisplay.razor
@@ -0,0 +1,26 @@
+
+
+
+ @(isMobile ? "Mobile" : "Desktop")
+
+
+
+
+ H
+
+ @foreach (var item in HeightList)
+ {
+ @item.Key
+ }
+
+
+
+
+@if (isMobile)
+{
+
+}
+else
+{
+
+}
diff --git a/EgwCoreLib.Razor/PdfDisplay.razor.cs b/EgwCoreLib.Razor/PdfDisplay.razor.cs
new file mode 100644
index 0000000..61a77d9
--- /dev/null
+++ b/EgwCoreLib.Razor/PdfDisplay.razor.cs
@@ -0,0 +1,95 @@
+using Microsoft.AspNetCore.Components;
+using Microsoft.Extensions.Options;
+using Microsoft.JSInterop;
+using System.Diagnostics.CodeAnalysis;
+using System.Xml.Linq;
+using ZXingBlazor.Components;
+
+namespace EgwCoreLib.Razor
+{
+ public partial class PdfDisplay
+ {
+ #region Public Properties
+
+ ///
+ /// URL del documento da mostrare
+ ///
+ [Parameter]
+ public string PdfUrl { get; set; } = "";
+
+ ///
+ /// Larghezza desiderata
+ ///
+ [Parameter]
+ public string Width { get; set; } = "100%";
+
+
+ ///
+ /// Elenco altezze ammesse
+ ///
+ [Parameter]
+ public Dictionary HeightList
+ {
+ get => hList;
+ set
+ {
+ if (hList != value && value.Count > 0)
+ {
+ hList = value;
+ }
+ }
+ }
+
+
+ private Dictionary hList { get; set; } = new Dictionary() { { "200", "200px" }, { "400", "400px" }, { "600", "600px" } };
+
+
+ protected override void OnInitialized()
+ {
+ // in base a quanti ne ho preso ultima o in mezzo...
+ int numSkip = HeightList.Count() > 3 ? 2 : 0;
+
+ Height = HeightList.Skip(numSkip).FirstOrDefault().Value;
+ }
+
+ #endregion Public Properties
+
+ #region Protected Methods
+
+ protected override async Task OnAfterRenderAsync(bool firstRender)
+ {
+ try
+ {
+ if (!firstRender) return;
+
+ module = await JS.InvokeAsync("import", "./_content/EgwCoreLib.Razor/PdfDisplay.razor.js");
+ isMobile = await JS.InvokeAsync("isDevice");
+ }
+ catch
+ { }
+ }
+
+ #endregion Protected Methods
+
+ #region Private Fields
+
+ private IJSObjectReference? module;
+
+ #endregion Private Fields
+
+ #region Private Properties
+
+ private string Height { get; set; } = "600px";
+
+ ///
+ /// Boolean Mobile vs Desktop
+ ///
+ private bool isMobile { get; set; }
+
+ [Inject]
+ [NotNull]
+ private IJSRuntime? JS { get; set; }
+
+ #endregion Private Properties
+ }
+}
\ No newline at end of file
diff --git a/EgwCoreLib.Razor/PdfDisplay.razor.js b/EgwCoreLib.Razor/PdfDisplay.razor.js
new file mode 100644
index 0000000..951d596
--- /dev/null
+++ b/EgwCoreLib.Razor/PdfDisplay.razor.js
@@ -0,0 +1,3 @@
+function isDevice() {
+ return /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini|mobile/i.test(navigator.userAgent);
+}
\ No newline at end of file