Add extensible InfoPanel system with custom templates
Introduce a flexible InfoPanel architecture for grid components, allowing per-grid customization via a new InfoPanelType parameter. Add MgInfoPanelTemplateBase for code-based InfoPanel templates with overridable header, content, and footer sections. Support custom templates in MgGridInfoPanel via new RenderFragment parameters. Add MgGridDataColumn for InfoPanel-specific column settings. Demonstrate usage with a custom InfoPanel for ShippingDocument grid. Maintains backward compatibility with default InfoPanel behavior.
This commit is contained in:
parent
21548376ba
commit
031fd9226b
|
|
@ -19,6 +19,9 @@ public class GridShippingDocumentBase : FruitBankGridBase<ShippingDocument>, IGr
|
||||||
AddMessageTag = SignalRTags.AddShippingDocument;
|
AddMessageTag = SignalRTags.AddShippingDocument;
|
||||||
UpdateMessageTag = SignalRTags.UpdateShippingDocument;
|
UpdateMessageTag = SignalRTags.UpdateShippingDocument;
|
||||||
|
|
||||||
|
// Set custom InfoPanel type
|
||||||
|
InfoPanelType = typeof(GridShippingDocumentInfoPanel);
|
||||||
|
|
||||||
//RemoveMessageTag = SignalRTags.;
|
//RemoveMessageTag = SignalRTags.;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
using AyCode.Blazor.Components.Components.Grids;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
|
namespace FruitBankHybrid.Shared.Components.Grids.ShippingDocuments;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Custom InfoPanel for ShippingDocument grid with customized header and footer
|
||||||
|
/// </summary>
|
||||||
|
public class GridShippingDocumentInfoPanel : MgInfoPanelTemplateBase
|
||||||
|
{
|
||||||
|
protected override RenderFragment? GetHeaderTemplate() => builder =>
|
||||||
|
{
|
||||||
|
builder.OpenElement(0, "div");
|
||||||
|
builder.AddAttribute(1, "class", "p-2 border-bottom");
|
||||||
|
builder.OpenElement(2, "h5");
|
||||||
|
builder.AddAttribute(3, "class", "mb-0");
|
||||||
|
builder.AddContent(4, "?? Szállítólevél részletei");
|
||||||
|
builder.CloseElement();
|
||||||
|
builder.CloseElement();
|
||||||
|
};
|
||||||
|
|
||||||
|
protected override RenderFragment? GetFooterTemplate() => builder =>
|
||||||
|
{
|
||||||
|
builder.OpenElement(0, "div");
|
||||||
|
builder.AddAttribute(1, "class", "p-2 border-top d-flex gap-2");
|
||||||
|
|
||||||
|
builder.OpenElement(2, "button");
|
||||||
|
builder.AddAttribute(3, "class", "btn btn-sm btn-outline-primary");
|
||||||
|
builder.AddContent(4, "??? Nyomtatás");
|
||||||
|
builder.CloseElement();
|
||||||
|
|
||||||
|
builder.OpenElement(5, "button");
|
||||||
|
builder.AddAttribute(6, "class", "btn btn-sm btn-outline-secondary");
|
||||||
|
builder.AddContent(7, "?? Export");
|
||||||
|
builder.CloseElement();
|
||||||
|
|
||||||
|
builder.CloseElement();
|
||||||
|
};
|
||||||
|
|
||||||
|
// GetColumnsTemplate() returns null by default ? uses auto-generated columns
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue