144 lines
3.9 KiB
Plaintext
144 lines
3.9 KiB
Plaintext
@using DevExpress.Blazor
|
|
|
|
<CascadingValue Value="this">
|
|
@if (_isFullscreen)
|
|
{
|
|
<DxWindow @bind-Visible="_isFullscreen"
|
|
ShowHeader="true"
|
|
HeaderText="@(_currentGrid?.Caption ?? "Grid")"
|
|
ShowCloseButton="true"
|
|
CloseOnEscape="true"
|
|
ShowFooter="false"
|
|
Scrollable="false"
|
|
Width="100vw"
|
|
Height="100vh"
|
|
CssClass="mg-fullscreen-window">
|
|
<BodyTemplate>
|
|
<div class="mg-fullscreen-content">
|
|
@RenderMainContent()
|
|
</div>
|
|
</BodyTemplate>
|
|
</DxWindow>
|
|
}
|
|
else
|
|
{
|
|
@RenderMainContent()
|
|
}
|
|
</CascadingValue>
|
|
|
|
@code {
|
|
private IInfoPanelBase? _infoPanelInstance;
|
|
private IMgGridBase? _currentGrid;
|
|
private bool _isFullscreen;
|
|
|
|
/// <summary>
|
|
/// The grid content to display in the left pane
|
|
/// </summary>
|
|
[Parameter]
|
|
public RenderFragment? GridContent { get; set; }
|
|
|
|
/// <summary>
|
|
/// InfoPanel content (e.g., GridShippingDocumentInfoPanel) to display in the right pane.
|
|
/// If not set, the default MgGridInfoPanel is used.
|
|
/// </summary>
|
|
[Parameter]
|
|
public RenderFragment? ChildContent { get; set; }
|
|
|
|
/// <summary>
|
|
/// Initial size of the InfoPanel pane. Default is "400px".
|
|
/// </summary>
|
|
[Parameter]
|
|
public string InfoPanelSize { get; set; } = "400px";
|
|
|
|
/// <summary>
|
|
/// Whether to show the InfoPanel. Default is true.
|
|
/// </summary>
|
|
[Parameter]
|
|
public bool ShowInfoPanel { get; set; } = true;
|
|
|
|
/// <summary>
|
|
/// Whether the wrapper is currently in fullscreen mode
|
|
/// </summary>
|
|
public bool IsFullscreen => _isFullscreen;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the InfoPanel instance for grid-InfoPanel communication
|
|
/// </summary>
|
|
public IInfoPanelBase? InfoPanelInstance
|
|
{
|
|
get => _infoPanelInstance;
|
|
set => _infoPanelInstance = value;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Registers an InfoPanel instance (called by child InfoPanel components)
|
|
/// </summary>
|
|
public void RegisterInfoPanel(IInfoPanelBase infoPanel)
|
|
{
|
|
_infoPanelInstance = infoPanel;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Registers the grid instance (called by MgGridBase)
|
|
/// </summary>
|
|
public void RegisterGrid(IMgGridBase grid)
|
|
{
|
|
_currentGrid = grid;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Toggles fullscreen mode
|
|
/// </summary>
|
|
public void ToggleFullscreen()
|
|
{
|
|
_isFullscreen = !_isFullscreen;
|
|
StateHasChanged();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Enters fullscreen mode
|
|
/// </summary>
|
|
public void EnterFullscreen()
|
|
{
|
|
_isFullscreen = true;
|
|
StateHasChanged();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Exits fullscreen mode
|
|
/// </summary>
|
|
public void ExitFullscreen()
|
|
{
|
|
_isFullscreen = false;
|
|
StateHasChanged();
|
|
}
|
|
|
|
private RenderFragment RenderMainContent() => __builder =>
|
|
{
|
|
if (ShowInfoPanel)
|
|
{
|
|
<DxSplitter Width="100%" Height="@(_isFullscreen ? "100%" : null)" CssClass="mg-grid-with-info-panel" Orientation="Orientation.Horizontal">
|
|
<Panes>
|
|
<DxSplitterPane>
|
|
@GridContent
|
|
</DxSplitterPane>
|
|
<DxSplitterPane Size="@InfoPanelSize" MinSize="0px" MaxSize="100%" AllowCollapse="true" CssClass="mg-info-panel-pane">
|
|
@if (ChildContent != null)
|
|
{
|
|
@ChildContent
|
|
}
|
|
else
|
|
{
|
|
<MgGridInfoPanel />
|
|
}
|
|
</DxSplitterPane>
|
|
</Panes>
|
|
</DxSplitter>
|
|
}
|
|
else
|
|
{
|
|
@GridContent
|
|
}
|
|
};
|
|
}
|