mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-04 21:17:36 +08:00
9739cd4161
* fix: unexpected behavior of Drawer(#1749) 1. The scroll bar of the body is enabled after closing one of the multiple drawers 2. Bad parameter NoAnimation. * chore: remove debug output * chore: add comments for ComponentStatus * fix: different behaviors in WASM and Server modes * chore: remove debug output
107 lines
3.7 KiB
C#
107 lines
3.7 KiB
C#
// Licensed to the .NET Foundation under one or more agreements.
|
||
// The .NET Foundation licenses this file to you under the MIT license.
|
||
// See the LICENSE file in the project root for more information.
|
||
|
||
using System;
|
||
|
||
namespace AntDesign
|
||
{
|
||
[Flags]
|
||
internal enum ComponentStatus : byte
|
||
{
|
||
Default = 0,
|
||
|
||
/// <summary>
|
||
/// 组件初始化中
|
||
/// Component initialization in progress
|
||
/// </summary>
|
||
Initing = 1,
|
||
|
||
/// <summary>
|
||
/// 组件初始化完毕
|
||
/// Component initialization completed
|
||
/// </summary>
|
||
Inited = 2,
|
||
|
||
/// <summary>
|
||
/// 用于在 parameter 属性中设置,表明组件正在第一次渲染中
|
||
/// Used to set in the parameter property, Indicates that the component is rendering for the first time
|
||
/// </summary>
|
||
Opening = 4,
|
||
|
||
/// <summary>
|
||
/// 一旦打开时经历过一次 OnAfterRender/OnAfterRenderAsync,就变成此状态
|
||
/// Once the component has experienced OnAfterRender/OnAfterRenderAsync once when it is opened, it becomes this state
|
||
/// </summary>
|
||
Opened = 8,
|
||
|
||
/// <summary>
|
||
/// 用于在 parameter 属性中设置,表明组件正在关闭中
|
||
/// Used to set in the parameter property, indicating that the component is closing
|
||
/// </summary>
|
||
Closing = 16,
|
||
|
||
/// <summary>
|
||
/// 一旦关闭时经历过一次 OnAfterRender/OnAfterRenderAsync,就变成此状态
|
||
/// Once OnAfterRender/OnAfterRenderAsync is experienced once when closing, it becomes this state
|
||
/// </summary>
|
||
Closed = 32,
|
||
|
||
/// <summary>
|
||
/// 用于在 parameter 属性中设置,表明组件正则销毁中、
|
||
/// Used to set in the parameter attribute, indicating that the component is in regular destruction
|
||
/// </summary>
|
||
Destroying = 64,
|
||
|
||
/// <summary>
|
||
/// 一旦销毁时经历过一次 OnAfterRender,就变成此状态
|
||
/// Once OnAfterRender/OnAfterRenderAsync is experienced once during destruction, it becomes this state
|
||
/// </summary>
|
||
Destroyed = 128
|
||
}
|
||
|
||
internal static class ComponentStatusExt
|
||
{
|
||
/// <summary>
|
||
/// return <paramref name="componentStatus"/> is <paramref name="status"/>
|
||
/// </summary>
|
||
/// <param name="componentStatus"></param>
|
||
/// <param name="status"></param>
|
||
/// <returns></returns>
|
||
public static bool Is(this ComponentStatus componentStatus, ComponentStatus status)
|
||
{
|
||
return componentStatus == status;
|
||
}
|
||
|
||
/// <summary>
|
||
/// Is ComponentStatus.Opening or ComponentStatus.Opened
|
||
/// </summary>
|
||
/// <param name="componentStatus"></param>
|
||
/// <returns></returns>
|
||
public static bool IsOpen(this ComponentStatus componentStatus)
|
||
{
|
||
return componentStatus == ComponentStatus.Opening || componentStatus == ComponentStatus.Opened;
|
||
}
|
||
|
||
/// <summary>
|
||
/// Is not ComponentStatus.Opening and is not ComponentStatus.Opened
|
||
/// </summary>
|
||
/// <param name="componentStatus"></param>
|
||
/// <returns></returns>
|
||
public static bool IsNotOpen(this ComponentStatus componentStatus)
|
||
{
|
||
return !IsOpen(componentStatus);
|
||
}
|
||
|
||
/// <summary>
|
||
/// Is ComponentStatus.Closing or ComponentStatus.Closed
|
||
/// </summary>
|
||
/// <param name="componentStatus"></param>
|
||
/// <returns></returns>
|
||
public static bool IsClose(this ComponentStatus componentStatus)
|
||
{
|
||
return componentStatus == ComponentStatus.Closing || componentStatus == ComponentStatus.Closed;
|
||
}
|
||
}
|
||
}
|