This commit is contained in:
James Yeung 2020-07-03 13:37:40 +08:00 коммит произвёл GitHub
Родитель e5fb98d09f
Коммит 2de927a0d1
13 изменённых файлов: 100 добавлений и 77 удалений

Просмотреть файл

@ -33,14 +33,13 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Ardalis.SmartEnum" Version="1.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.1.5" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="OneOf" Version="2.1.151" />
<PackageReference Include="Microsoft.Extensions.Http" Version="3.1.5" />
<PackageReference Include="Microsoft.Extensions.Http" Version="3.1.0" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' And '$(SolutionDir)'==''">

Просмотреть файл

@ -1,8 +1,6 @@
using Ardalis.SmartEnum;
namespace AntDesign
namespace AntDesign
{
public sealed class PlacementType : SmartEnum<PlacementType>
public sealed class PlacementType : EnumValue<PlacementType>
{
public static readonly PlacementType TopLeft = new PlacementType("topLeft", "up", "33% 100%", 0);
public static readonly PlacementType TopCenter = new PlacementType("topCenter", "up", "50% 100%", 1);

Просмотреть файл

@ -1,8 +1,6 @@
using Ardalis.SmartEnum;
namespace AntDesign
namespace AntDesign
{
public sealed class TriggerType : SmartEnum<TriggerType>
public sealed class TriggerType : EnumValue<TriggerType>
{
public static readonly TriggerType Click = new TriggerType(nameof(Click), 0);
public static readonly TriggerType Hover = new TriggerType(nameof(Hover), 1);

Просмотреть файл

@ -0,0 +1,51 @@
using System;
namespace AntDesign
{
public abstract class EnumValue<TEnum, TValue> :
IEquatable<EnumValue<TEnum, TValue>>,
IComparable<EnumValue<TEnum, TValue>>
where TEnum : EnumValue<TEnum, TValue>
where TValue : IEquatable<TValue>, IComparable<TValue>
{
public string Name { get; set; }
public TValue Value { get; set; }
protected EnumValue(string name, TValue value)
{
this.Name = name;
this.Value = value;
}
public bool Equals(EnumValue<TEnum, TValue> other)
{
if (ReferenceEquals(this, other))
return true;
if (other is null)
return false;
return Value.Equals(other.Value);
}
public int CompareTo(EnumValue<TEnum, TValue> other)
{
return Value.CompareTo(other.Value);
}
public override string ToString()
{
return Name;
}
}
public abstract class EnumValue<TEnum> :
EnumValue<TEnum, int>
where TEnum : EnumValue<TEnum, int>
{
protected EnumValue(string name, int value) :
base(name, value)
{
}
}
}

Просмотреть файл

@ -1,12 +1,9 @@
using Ardalis.SmartEnum;
namespace AntDesign
namespace AntDesign
{
public sealed class FormLayout
{
public static readonly string Horizontal = "Horizontal";
public static readonly string Vertical = "Vertical";
public static readonly string Inline = "Inline";
}
}

Просмотреть файл

@ -1,8 +1,6 @@
using Ardalis.SmartEnum;
namespace AntDesign
namespace AntDesign
{
public sealed class BreakpointType : SmartEnum<BreakpointType>
public sealed class BreakpointType : EnumValue<BreakpointType>
{
public static readonly BreakpointType Xs = new BreakpointType(nameof(Xs).ToLowerInvariant(), 1, 480);
public static readonly BreakpointType Sm = new BreakpointType(nameof(Sm).ToLowerInvariant(), 2, 576);

Просмотреть файл

@ -1,11 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
using Ardalis.SmartEnum;
namespace AntDesign
namespace AntDesign
{
public sealed class SiderTheme : SmartEnum<SiderTheme>
public sealed class SiderTheme : EnumValue<SiderTheme>
{
public static readonly SiderTheme Light = new SiderTheme(nameof(Light).ToLowerInvariant(), 1);
public static readonly SiderTheme Dark = new SiderTheme(nameof(Dark).ToLowerInvariant(), 2);

Просмотреть файл

@ -1,13 +1,10 @@
using System.Globalization;
using Ardalis.SmartEnum;
namespace AntDesign
namespace AntDesign
{
public sealed class AntMenuMode : SmartEnum<AntMenuMode>
public sealed class AntMenuMode : EnumValue<AntMenuMode>
{
public static readonly AntMenuMode Vertical = new AntMenuMode(nameof(Vertical).ToLower(CultureInfo.CurrentCulture), 1);
public static readonly AntMenuMode Horizontal = new AntMenuMode(nameof(Horizontal).ToLower(CultureInfo.CurrentCulture), 2);
public static readonly AntMenuMode Inline = new AntMenuMode(nameof(Inline).ToLower(CultureInfo.CurrentCulture), 3);
public static readonly AntMenuMode Vertical = new AntMenuMode(nameof(Vertical).ToLowerInvariant(), 1);
public static readonly AntMenuMode Horizontal = new AntMenuMode(nameof(Horizontal).ToLowerInvariant(), 2);
public static readonly AntMenuMode Inline = new AntMenuMode(nameof(Inline).ToLowerInvariant(), 3);
private AntMenuMode(string name, int value) : base(name, value)
{

Просмотреть файл

@ -1,12 +1,9 @@
using System.Globalization;
using Ardalis.SmartEnum;
namespace AntDesign
namespace AntDesign
{
public sealed class AntMenuTheme : SmartEnum<AntMenuTheme>
public sealed class AntMenuTheme : EnumValue<AntMenuTheme>
{
public static readonly AntMenuTheme Light = new AntMenuTheme(nameof(Light).ToLower(CultureInfo.CurrentCulture), 1);
public static readonly AntMenuTheme Dark = new AntMenuTheme(nameof(Dark).ToLower(CultureInfo.CurrentCulture), 2);
public static readonly AntMenuTheme Light = new AntMenuTheme(nameof(Light).ToLowerInvariant(), 1);
public static readonly AntMenuTheme Dark = new AntMenuTheme(nameof(Dark).ToLowerInvariant(), 2);
private AntMenuTheme(string name, int value) : base(name, value)
{

Просмотреть файл

@ -1,12 +1,10 @@
using Ardalis.SmartEnum;
namespace AntDesign
namespace AntDesign
{
public sealed class MenuMode : SmartEnum<MenuMode>
public sealed class MenuMode : EnumValue<MenuMode>
{
public static readonly MenuMode Vertical = new MenuMode(nameof(Vertical).ToLower(), 1);
public static readonly MenuMode Horizontal = new MenuMode(nameof(Horizontal).ToLower(), 2);
public static readonly MenuMode Inline = new MenuMode(nameof(Inline).ToLower(), 3);
public static readonly MenuMode Vertical = new MenuMode(nameof(Vertical).ToLowerInvariant(), 1);
public static readonly MenuMode Horizontal = new MenuMode(nameof(Horizontal).ToLowerInvariant(), 2);
public static readonly MenuMode Inline = new MenuMode(nameof(Inline).ToLowerInvariant(), 3);
private MenuMode(string name, int value) : base(name, value)
{

Просмотреть файл

@ -1,8 +1,6 @@
using Ardalis.SmartEnum;
namespace AntDesign
namespace AntDesign
{
public sealed class MenuTheme : SmartEnum<MenuTheme>
public sealed class MenuTheme : EnumValue<MenuTheme>
{
public static readonly MenuTheme Light = new MenuTheme(nameof(Light).ToLowerInvariant(), 1);
public static readonly MenuTheme Dark = new MenuTheme(nameof(Dark).ToLowerInvariant(), 2);

Просмотреть файл

@ -1,54 +1,57 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Ardalis.SmartEnum;
namespace AntDesign
namespace AntDesign
{
public sealed class ProgressSize : SmartEnum<ProgressSize>
public sealed class ProgressSize : EnumValue<ProgressSize>
{
public static readonly ProgressSize Small = new ProgressSize(nameof(Small), 1);
public static readonly ProgressSize Default = new ProgressSize(nameof(Default), 2);
private ProgressSize(string name, int value) : base(name.ToLowerInvariant(), value) { }
private ProgressSize(string name, int value) : base(name.ToLowerInvariant(), value)
{
}
}
public sealed class ProgressType : SmartEnum<ProgressType>
public sealed class ProgressType : EnumValue<ProgressType>
{
public static readonly ProgressType Line = new ProgressType(nameof(Line), 1);
public static readonly ProgressType Circle = new ProgressType(nameof(Circle), 2);
public static readonly ProgressType Dashboard = new ProgressType(nameof(Dashboard), 3);
private ProgressType(string name, int value) : base(name.ToLowerInvariant(), value) { }
private ProgressType(string name, int value) : base(name.ToLowerInvariant(), value)
{
}
}
public sealed class ProgressStatus : SmartEnum<ProgressStatus>
public sealed class ProgressStatus : EnumValue<ProgressStatus>
{
public static readonly ProgressStatus Success = new ProgressStatus(nameof(Success), 1);
public static readonly ProgressStatus Exception = new ProgressStatus(nameof(Exception), 2);
public static readonly ProgressStatus Normal = new ProgressStatus(nameof(Normal), 3);
public static readonly ProgressStatus Active = new ProgressStatus(nameof(Active), 4);
private ProgressStatus(string name, int value) : base(name.ToLowerInvariant(), value) { }
private ProgressStatus(string name, int value) : base(name.ToLowerInvariant(), value)
{
}
}
public sealed class ProgressStrokeLinecap : SmartEnum<ProgressStrokeLinecap>
public sealed class ProgressStrokeLinecap : EnumValue<ProgressStrokeLinecap>
{
public static readonly ProgressStrokeLinecap Round = new ProgressStrokeLinecap(nameof(Round), 1);
public static readonly ProgressStrokeLinecap Square = new ProgressStrokeLinecap(nameof(Square), 2);
private ProgressStrokeLinecap(string name, int value) : base(name.ToLowerInvariant(), value) { }
private ProgressStrokeLinecap(string name, int value) : base(name.ToLowerInvariant(), value)
{
}
}
public sealed class ProgressGapPosition : SmartEnum<ProgressGapPosition>
public sealed class ProgressGapPosition : EnumValue<ProgressGapPosition>
{
public static readonly ProgressGapPosition Top = new ProgressGapPosition(nameof(Top), 1);
public static readonly ProgressGapPosition Bottom = new ProgressGapPosition(nameof(Bottom), 2);
public static readonly ProgressGapPosition Left = new ProgressGapPosition(nameof(Left), 3);
public static readonly ProgressGapPosition Right = new ProgressGapPosition(nameof(Right), 4);
private ProgressGapPosition(string name, int value) : base(name.ToLowerInvariant(), value) { }
private ProgressGapPosition(string name, int value) : base(name.ToLowerInvariant(), value)
{
}
}
}

Просмотреть файл

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using Ardalis.SmartEnum;
namespace AntDesign
namespace AntDesign
{
public static class TransferDirection
{