|
|
|
@ -1,9 +1,7 @@
|
|
|
|
|
using Connected.Annotations;
|
|
|
|
|
using Connected.Extensions;
|
|
|
|
|
using Connected.Extensions;
|
|
|
|
|
using Connected.Services;
|
|
|
|
|
using Connected.Utilities;
|
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
|
|
|
|
|
namespace Connected.Components;
|
|
|
|
|
|
|
|
|
@ -101,7 +99,6 @@ public partial class Drawer : UIComponent, IDisposable, INavigationEventReceiver
|
|
|
|
|
return Anchor.ToDescription();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private bool closeOnMouseLeave = false;
|
|
|
|
|
|
|
|
|
|
public async void OnMouseEnter()
|
|
|
|
@ -122,69 +119,6 @@ public partial class Drawer : UIComponent, IDisposable, INavigationEventReceiver
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnInitialized()
|
|
|
|
|
{
|
|
|
|
|
if (Variant != DrawerVariant.Temporary)
|
|
|
|
|
{
|
|
|
|
|
DrawerContainer?.Add(this);
|
|
|
|
|
}
|
|
|
|
|
base.OnInitialized();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
|
|
|
{
|
|
|
|
|
if (firstRender)
|
|
|
|
|
{
|
|
|
|
|
//await UpdateHeight();
|
|
|
|
|
var result = await Breakpointistener.Subscribe(UpdateBreakpointState);
|
|
|
|
|
//var currentBreakpoint = result.Breakpoint;
|
|
|
|
|
|
|
|
|
|
_breakpointListenerSubscriptionId = result.SubscriptionId;
|
|
|
|
|
|
|
|
|
|
var refresh = false;
|
|
|
|
|
|
|
|
|
|
if (_screenBreakpoint != result.Breakpoint) refresh = true;
|
|
|
|
|
_screenBreakpoint = result.Breakpoint;
|
|
|
|
|
if (_screenBreakpoint < Breakpoint && _open)
|
|
|
|
|
{
|
|
|
|
|
_keepInitialState = true;
|
|
|
|
|
await OpenChanged.InvokeAsync(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_isRendered = true;
|
|
|
|
|
if (Anchor == Anchor.Bottom || Anchor == Anchor.Top || _screenBreakpoint == Breakpoint.None)
|
|
|
|
|
{
|
|
|
|
|
refresh = true;
|
|
|
|
|
}
|
|
|
|
|
if (refresh) StateHasChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await base.OnAfterRenderAsync(firstRender);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
|
|
|
|
Dispose(true);
|
|
|
|
|
GC.SuppressFinalize(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int _disposeCount;
|
|
|
|
|
public virtual void Dispose(bool disposing)
|
|
|
|
|
{
|
|
|
|
|
if (Interlocked.Increment(ref _disposeCount) == 1)
|
|
|
|
|
{
|
|
|
|
|
if (disposing)
|
|
|
|
|
{
|
|
|
|
|
DrawerContainer?.Remove(this);
|
|
|
|
|
|
|
|
|
|
if (_breakpointListenerSubscriptionId != default)
|
|
|
|
|
{
|
|
|
|
|
Breakpointistener.Unsubscribe(_breakpointListenerSubscriptionId).AndForget();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Content placeholders
|
|
|
|
@ -427,4 +361,71 @@ public partial class Drawer : UIComponent, IDisposable, INavigationEventReceiver
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Lifecycle
|
|
|
|
|
|
|
|
|
|
protected override void OnInitialized()
|
|
|
|
|
{
|
|
|
|
|
if (Variant != DrawerVariant.Temporary)
|
|
|
|
|
{
|
|
|
|
|
DrawerContainer?.Add(this);
|
|
|
|
|
}
|
|
|
|
|
base.OnInitialized();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
|
|
|
{
|
|
|
|
|
if (firstRender)
|
|
|
|
|
{
|
|
|
|
|
//await UpdateHeight();
|
|
|
|
|
var result = await Breakpointistener.Subscribe(UpdateBreakpointState);
|
|
|
|
|
//var currentBreakpoint = result.Breakpoint;
|
|
|
|
|
|
|
|
|
|
_breakpointListenerSubscriptionId = result.SubscriptionId;
|
|
|
|
|
|
|
|
|
|
var refresh = false;
|
|
|
|
|
|
|
|
|
|
if (_screenBreakpoint != result.Breakpoint) refresh = true;
|
|
|
|
|
_screenBreakpoint = result.Breakpoint;
|
|
|
|
|
if (_screenBreakpoint < Breakpoint && _open)
|
|
|
|
|
{
|
|
|
|
|
_keepInitialState = true;
|
|
|
|
|
await OpenChanged.InvokeAsync(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_isRendered = true;
|
|
|
|
|
if (Anchor == Anchor.Bottom || Anchor == Anchor.Top || _screenBreakpoint == Breakpoint.None)
|
|
|
|
|
{
|
|
|
|
|
refresh = true;
|
|
|
|
|
}
|
|
|
|
|
if (refresh) StateHasChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await base.OnAfterRenderAsync(firstRender);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
|
|
|
|
Dispose(true);
|
|
|
|
|
GC.SuppressFinalize(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int _disposeCount;
|
|
|
|
|
public virtual void Dispose(bool disposing)
|
|
|
|
|
{
|
|
|
|
|
if (Interlocked.Increment(ref _disposeCount) == 1)
|
|
|
|
|
{
|
|
|
|
|
if (disposing)
|
|
|
|
|
{
|
|
|
|
|
DrawerContainer?.Remove(this);
|
|
|
|
|
|
|
|
|
|
if (_breakpointListenerSubscriptionId != default)
|
|
|
|
|
{
|
|
|
|
|
Breakpointistener.Unsubscribe(_breakpointListenerSubscriptionId).AndForget();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|