From 903711ed04669499e0676e3c50eb69eee029ae57 Mon Sep 17 00:00:00 2001 From: Loretta Date: Wed, 17 Dec 2025 13:54:08 +0100 Subject: [PATCH] Refactor InfoPanel: non-generic, nested grid support - Replace generic InfoPanel with non-generic version using IInfoPanelBase - Add ParentGrid, GetRootGrid, and InfoPanelInstance to IMgGridBase for nested grid hierarchy - Only root grid displays InfoPanel; nested grids inherit context - InfoPanel now handles any data type via reflection and object - All grid-to-InfoPanel communication routed through root grid - Add option to show/hide readonly fields in edit mode - Improve InfoPanel CSS for up to 4 responsive columns - Remove redundant code and add debug output for InfoPanel data flow --- .../Components/MgGridBase.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/FruitBankHybrid.Shared/Components/MgGridBase.cs b/FruitBankHybrid.Shared/Components/MgGridBase.cs index 0a582d9..8d776fa 100644 --- a/FruitBankHybrid.Shared/Components/MgGridBase.cs +++ b/FruitBankHybrid.Shared/Components/MgGridBase.cs @@ -26,6 +26,24 @@ public class MgGridBase : DxGrid, IMgGridBase /// public MgGridEditState GridEditState { get; private set; } = MgGridEditState.None; + /// + [CascadingParameter] + public IMgGridBase? ParentGrid { get; set; } + + /// + public IMgGridBase GetRootGrid() + { + var current = (IMgGridBase)this; + while (current.ParentGrid != null) + { + current = current.ParentGrid; + } + return current; + } + + /// + public IInfoPanelBase? InfoPanelInstance { get; set; } + [Inject] public required IEnumerable LogWriters { get; set; } [Inject] public required FruitBankSignalRClient FruitBankSignalRClient { get; set; } [Inject] public required LoggedInModel LoggedInModel { get; set; } @@ -170,6 +188,8 @@ public class MgGridBase : DxGrid, IMgGridBase } } + public bool ShowInfoPanel { get; set; } = false; + async Task Grid_LayoutAutoLoading(GridPersistentLayoutEventArgs e) { e.Layout = await LoadLayoutFromLocalStorageAsync($"{AutoSaveLayoutName}_AutoSave_{LoggedInModel.CustomerDto?.Id ?? 0}");