From 3d64cbd88852fe69c7fa932e01eaf7b7dd773a72 Mon Sep 17 00:00:00 2001 From: John Bomhold Date: Wed, 18 Dec 2024 01:21:25 -1000 Subject: [PATCH] ... --- src/BlazorStrap.V4/BlazorStrap.V4.csproj | 2 +- .../Components/Common/BSBreadcrumb.razor | 2 +- .../Components/Common/BSBreadcrumb.razor.cs | 11 +---------- src/BlazorStrap.V5/BlazorStrap.V5.csproj | 2 +- .../Components/Common/BSBreadcrumb.razor | 2 +- .../Components/Common/BSBreadcrumb.razor.cs | 11 +---------- .../Shared/Components/Common/BSBreadcrumbBase.cs | 4 +++- 7 files changed, 9 insertions(+), 25 deletions(-) diff --git a/src/BlazorStrap.V4/BlazorStrap.V4.csproj b/src/BlazorStrap.V4/BlazorStrap.V4.csproj index 753cd42d..750db834 100644 --- a/src/BlazorStrap.V4/BlazorStrap.V4.csproj +++ b/src/BlazorStrap.V4/BlazorStrap.V4.csproj @@ -14,7 +14,7 @@ https://blazorstrap.io/ https://github.com/chanan/BlazorStrap BlazorStrap.V4 - 5.2.103.121924 + 5.2.103.122024 diff --git a/src/BlazorStrap.V4/Components/Common/BSBreadcrumb.razor b/src/BlazorStrap.V4/Components/Common/BSBreadcrumb.razor index e34de1f7..5ddc21a2 100644 --- a/src/BlazorStrap.V4/Components/Common/BSBreadcrumb.razor +++ b/src/BlazorStrap.V4/Components/Common/BSBreadcrumb.razor @@ -28,7 +28,7 @@ else } } - @foreach (var item in Tree.Skip(_skip)) + @foreach (var item in Tree.Skip(Skip)) { if (NavigationManager?.Uri == item.Key) { diff --git a/src/BlazorStrap.V4/Components/Common/BSBreadcrumb.razor.cs b/src/BlazorStrap.V4/Components/Common/BSBreadcrumb.razor.cs index 7156c5c6..2d471c4a 100644 --- a/src/BlazorStrap.V4/Components/Common/BSBreadcrumb.razor.cs +++ b/src/BlazorStrap.V4/Components/Common/BSBreadcrumb.razor.cs @@ -6,21 +6,12 @@ namespace BlazorStrap.V4 { public partial class BSBreadcrumb : BSBreadcrumbBase { - private int _skip = 0; protected override string? LayoutClass => LayoutClassBuilder.Build(this); protected override string? ClassBuilder => new CssBuilder("breadcrumb") .AddClass(LayoutClass, !string.IsNullOrEmpty(LayoutClass)) .AddClass(Class, !string.IsNullOrEmpty(Class)) .Build().ToNullString(); - - protected override void OnInitialized() - { - base.OnInitialized(); - if (Tree.Count > MaxItems) - { - _skip = Tree.Count - MaxItems; - } - } + } } diff --git a/src/BlazorStrap.V5/BlazorStrap.V5.csproj b/src/BlazorStrap.V5/BlazorStrap.V5.csproj index f891f0e6..fdd5aba6 100644 --- a/src/BlazorStrap.V5/BlazorStrap.V5.csproj +++ b/src/BlazorStrap.V5/BlazorStrap.V5.csproj @@ -13,7 +13,7 @@ https://blazorstrap.io/ https://github.com/chanan/BlazorStrap BlazorStrap.V5 - 5.2.103.121924 + 5.2.103.122024 diff --git a/src/BlazorStrap.V5/Components/Common/BSBreadcrumb.razor b/src/BlazorStrap.V5/Components/Common/BSBreadcrumb.razor index ec3ad438..afb92da5 100644 --- a/src/BlazorStrap.V5/Components/Common/BSBreadcrumb.razor +++ b/src/BlazorStrap.V5/Components/Common/BSBreadcrumb.razor @@ -28,7 +28,7 @@ else } } - @foreach (var item in Tree.Skip(_skip)) + @foreach (var item in Tree.Skip(Skip)) { if (NavigationManager?.Uri == item.Key) { diff --git a/src/BlazorStrap.V5/Components/Common/BSBreadcrumb.razor.cs b/src/BlazorStrap.V5/Components/Common/BSBreadcrumb.razor.cs index c4f90b36..e72f647c 100644 --- a/src/BlazorStrap.V5/Components/Common/BSBreadcrumb.razor.cs +++ b/src/BlazorStrap.V5/Components/Common/BSBreadcrumb.razor.cs @@ -6,21 +6,12 @@ namespace BlazorStrap.V5 { public partial class BSBreadcrumb : BSBreadcrumbBase { - private int _skip = 0; protected override string? LayoutClass => LayoutClassBuilder.Build(this); protected override string? ClassBuilder => new CssBuilder("breadcrumb") .AddClass(LayoutClass, !string.IsNullOrEmpty(LayoutClass)) .AddClass(Class, !string.IsNullOrEmpty(Class)) .Build().ToNullString(); - - protected override void OnInitialized() - { - base.OnInitialized(); - if (Tree.Count > MaxItems) - { - _skip = Tree.Count - MaxItems; - } - } + } } diff --git a/src/BlazorStrap/Shared/Components/Common/BSBreadcrumbBase.cs b/src/BlazorStrap/Shared/Components/Common/BSBreadcrumbBase.cs index 517bedd3..5e5baa29 100644 --- a/src/BlazorStrap/Shared/Components/Common/BSBreadcrumbBase.cs +++ b/src/BlazorStrap/Shared/Components/Common/BSBreadcrumbBase.cs @@ -31,7 +31,7 @@ public abstract class BSBreadcrumbBase : BlazorStrapBase protected abstract string? ClassBuilder { get; } protected Dictionary Tree { get; set; } = new(); - + protected int Skip { get; set; } protected override void OnInitialized() { @@ -41,6 +41,7 @@ protected override void OnInitialized() //Tree = GetPath(NavigationManager.Uri, BasePath, Labels, "https://localhost:7262/V5/" ?? ""); Tree = GetPath(NavigationManager.Uri, BasePath, Labels, NavigationManager?.BaseUri ?? ""); + Skip = Tree.Count - MaxItems; } private void OnLocationChanged(object? sender, LocationChangedEventArgs e) @@ -48,6 +49,7 @@ private void OnLocationChanged(object? sender, LocationChangedEventArgs e) if (string.IsNullOrEmpty(BasePath)) return; if (NavigationManager == null) return; Tree = GetPath(NavigationManager.Uri, BasePath, Labels, NavigationManager?.BaseUri ?? ""); + Skip = Tree.Count - MaxItems; StateHasChanged(); }