Skip to content

Commit 19590e5

Browse files
committed
1. 实体变更事件 EntityChangedEvent 添加变更值集合属性 ChangeValues.
2. EntityFrameworkCore 工作单元更新数据时发布实体变更事件携带变更值集合. 3. Utc日期格式Json转换器 `UtcDateTimeJsonConverter` 默认日期格式字符串支持时区. 4. 重构扩展属性实现. 5. 采用 @for 语法重构 `<util-autocomplete>` 循环方式 6. 采用 @for 语法重构 `<util-tag>` 循环方式 7. 采用 @for 语法重构 `<util-radio>` 循环方式 8. 采用 @for 语法重构 `<util-radio-group>` 循环方式 9. 补齐 `<util-alert>` 标签属性. 10. 补齐 `<util-drawer>` 标签属性. 11. 补齐 `<util-mention>` 标签属性. 12. 补齐 `<util-modal>` 标签属性. 13. 补齐 `<util-radio>` 标签属性. 14. 补齐 `<util-radio-group>` 标签属性. 15. 补齐 `<util-rate>` 标签属性. 16. 补齐 `<util-tree-select>` 标签属性. 17. 补齐 `<util-tree>` 标签属性. 18. 补齐 `<util-tree-view>` 标签属性.
1 parent f4c8603 commit 19590e5

File tree

116 files changed

+2459
-880
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+2459
-880
lines changed

build/version.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<VersionMajor>8</VersionMajor>
44
<VersionMinor>0</VersionMinor>
5-
<VersionPatch>18</VersionPatch>
5+
<VersionPatch>19</VersionPatch>
66
<VersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)</VersionPrefix>
77
<VersionSuffix></VersionSuffix>
88
</PropertyGroup>

src/Util.Core/SystemTextJson/DateTimeJsonConverter.cs

+2-4
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,10 @@ public DateTimeJsonConverter( string format ) {
2929
/// 读取数据
3030
/// </summary>
3131
public override DateTime Read( ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options ) {
32-
if ( reader.TokenType == JsonTokenType.String ) {
32+
if ( reader.TokenType == JsonTokenType.String )
3333
return Time.ToLocalTime( Util.Helpers.Convert.ToDateTime( reader.GetString() ) );
34-
}
35-
if ( reader.TryGetDateTime( out var date ) ) {
34+
if ( reader.TryGetDateTime( out var date ) )
3635
return Time.ToLocalTime( date );
37-
}
3836
return DateTime.MinValue;
3937
}
4038

src/Util.Core/SystemTextJson/UtcDateTimeJsonConverter.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ public class UtcDateTimeJsonConverter : JsonConverter<DateTime> {
1414
/// <summary>
1515
/// 初始化Utc日期格式Json转换器
1616
/// </summary>
17-
public UtcDateTimeJsonConverter() : this( "yyyy-MM-dd HH:mm:ss" ) {
17+
public UtcDateTimeJsonConverter() : this( "yyyy-MM-ddTHH:mm:sszzzz" ) {
1818
}
1919

2020
/// <summary>
2121
/// 初始化Utc日期格式Json转换器
2222
/// </summary>
23-
/// <param name="format">日期格式,默认值: yyyy-MM-dd HH:mm:ss</param>
23+
/// <param name="format">日期格式,默认值: yyyy-MM-ddTHH:mm:sszzzz</param>
2424
public UtcDateTimeJsonConverter( string format ) {
2525
_format = format;
2626
}

src/Util.Core/SystemTextJson/UtcNullableDateTimeJsonConverter.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ public class UtcNullableDateTimeJsonConverter : JsonConverter<DateTime?> {
1414
/// <summary>
1515
/// 初始化可空日期格式Json转换器
1616
/// </summary>
17-
public UtcNullableDateTimeJsonConverter() : this( "yyyy-MM-dd HH:mm:ss" ) {
17+
public UtcNullableDateTimeJsonConverter() : this( "yyyy-MM-ddTHH:mm:sszzzz" ) {
1818
}
1919

2020
/// <summary>
2121
/// 初始化可空日期格式Json转换器
2222
/// </summary>
23-
/// <param name="format">日期格式,默认值: yyyy-MM-dd HH:mm:ss</param>
23+
/// <param name="format">日期格式,默认值: yyyy-MM-ddTHH:mm:sszzzz</param>
2424
public UtcNullableDateTimeJsonConverter( string format ) {
2525
_format = format;
2626
}

src/Util.Data.Abstractions/Trees/TreeQueryParameter.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class TreeQueryParameter : QueryParameter, ITreeQueryParameter {
99
/// <summary>
1010
/// 初始化树形查询参数
1111
/// </summary>
12-
protected TreeQueryParameter() {
12+
public TreeQueryParameter() {
1313
Order = "SortId";
1414
}
1515

src/Util.Data.Core/01-Util.Data.Core.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</ItemGroup>
2828

2929
<ItemGroup>
30-
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.4.0" />
30+
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.4.2" />
3131
</ItemGroup>
3232

3333
<ItemGroup>

src/Util.Data.EntityFrameworkCore/UnitOfWorkBase.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -574,9 +574,9 @@ protected virtual byte[] GetVersion() {
574574
/// <summary>
575575
/// 添加实体变更事件
576576
/// </summary>
577-
protected virtual void AddEntityChangedEvent( object entity, EntityChangeType changeType ) {
577+
protected virtual void AddEntityChangedEvent( object entity, EntityChangeType changeType, ChangeValueCollection changeValues = null ) {
578578
var eventType = typeof( EntityChangedEvent<> ).MakeGenericType( entity.GetType() );
579-
var @event = Reflection.CreateInstance<IEvent>( eventType, entity, changeType );
579+
var @event = Reflection.CreateInstance<IEvent>( eventType, entity, changeType, changeValues );
580580
SaveAfterEvents.Add( @event );
581581
}
582582

@@ -619,7 +619,7 @@ protected virtual void AddEntityUpdatedEvent( EntityEntry entry ) {
619619
var changeValues = GetChangeValues( entry );
620620
var @event = CreateEntityEvent( typeof( EntityUpdatedEvent<> ), entity, changeValues );
621621
SaveAfterEvents.Add( @event );
622-
AddEntityChangedEvent( entity, EntityChangeType.Updated );
622+
AddEntityChangedEvent( entity, EntityChangeType.Updated, changeValues );
623623
}
624624

625625
#endregion

src/Util.Domain/Events/EntityChangedEvent.cs

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace Util.Domain.Events;
1+
using Util.Domain.Compare;
2+
3+
namespace Util.Domain.Events;
24

35
/// <summary>
46
/// 实体变更事件,当实体新增,修改,删除时均触发
@@ -10,9 +12,11 @@ public class EntityChangedEvent<TEntity> : IEvent {
1012
/// </summary>
1113
/// <param name="entity">实体</param>
1214
/// <param name="changeType">变更类型</param>
13-
public EntityChangedEvent( TEntity entity, EntityChangeType changeType ) {
15+
/// <param name="changeValues">变更值集合</param>
16+
public EntityChangedEvent( TEntity entity, EntityChangeType changeType, ChangeValueCollection changeValues = null ) {
1417
Entity = entity;
1518
ChangeType = changeType;
19+
ChangeValues = changeValues;
1620
}
1721

1822
/// <summary>
@@ -24,4 +28,9 @@ public EntityChangedEvent( TEntity entity, EntityChangeType changeType ) {
2428
/// 变更类型
2529
/// </summary>
2630
public EntityChangeType ChangeType { get; }
31+
32+
/// <summary>
33+
/// 变更值集合
34+
/// </summary>
35+
public ChangeValueCollection ChangeValues { get; }
2736
}

src/Util.Domain/ExtraPropertyDictionaryExtensions.cs

+7-14
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
using System.Text.Json;
2-
using Util.Dates;
32
using Util.Domain.Extending;
43
using Util.Helpers;
54

6-
namespace Util.Domain;
5+
namespace Util.Domain;
76

87
/// <summary>
98
/// 扩展属性字典扩展
@@ -16,16 +15,10 @@ public static class ExtraPropertyDictionaryExtensions {
1615
/// <param name="name">属性名</param>
1716
public static TProperty GetProperty<TProperty>( this ExtraPropertyDictionary source, string name ) {
1817
source.CheckNull( nameof( source ) );
19-
if( source.ContainsKey( name ) == false )
18+
if ( source.TryGetValue( name, out var value ) == false )
2019
return default;
21-
var value = source[name];
22-
if( value is JsonElement element ) {
23-
var date = Util.Helpers.Convert.ToDateTimeOrNull( element.GetRawText().Trim( '"' ) );
24-
if( date != null )
25-
value = date;
26-
}
27-
if ( value is DateTime dateValue && TimeOptions.IsUseUtc )
28-
value = Time.UtcToLocalTime( dateValue );
20+
if ( value is JsonElement element )
21+
return Util.Helpers.Json.ToObject<TProperty>( Util.Helpers.Json.ToJson( element ) );
2922
return Util.Helpers.Convert.To<TProperty>( value );
3023
}
3124

@@ -40,7 +33,7 @@ public static ExtraPropertyDictionary SetProperty( this ExtraPropertyDictionary
4033
source.RemoveProperty( name );
4134
if ( value == null )
4235
return source;
43-
source[name] = GetPropertyValue(source,value);
36+
source[name] = GetPropertyValue( source, value );
4437
return source;
4538
}
4639

@@ -50,7 +43,7 @@ public static ExtraPropertyDictionary SetProperty( this ExtraPropertyDictionary
5043
private static object GetPropertyValue( ExtraPropertyDictionary source, object value ) {
5144
if ( value is string && source.IsTrimString )
5245
return value.SafeString();
53-
if ( value is DateTime dateValue && TimeOptions.IsUseUtc )
46+
if ( value is DateTime dateValue )
5447
return Time.Normalize( dateValue );
5548
return value;
5649
}
@@ -62,7 +55,7 @@ private static object GetPropertyValue( ExtraPropertyDictionary source, object v
6255
/// <param name="name">属性名</param>
6356
public static ExtraPropertyDictionary RemoveProperty( this ExtraPropertyDictionary source, string name ) {
6457
source.CheckNull( nameof( source ) );
65-
if( source.ContainsKey( name ) )
58+
if ( source.ContainsKey( name ) )
6659
source.Remove( name );
6760
return source;
6861
}

src/Util.Events.MediatR/03-Util.Events.MediatR.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</ItemGroup>
2828

2929
<ItemGroup>
30-
<PackageReference Include="MediatR" Version="12.2.0" />
30+
<PackageReference Include="MediatR" Version="12.3.0" />
3131
</ItemGroup>
3232

3333
<ItemGroup>

src/Util.FileStorage.Aliyun/04-Util.FileStorage.Aliyun.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</ItemGroup>
2828

2929
<ItemGroup>
30-
<PackageReference Include="Aliyun.OSS.SDK.NetCore" Version="2.13.0" />
30+
<PackageReference Include="Aliyun.OSS.SDK.NetCore" Version="2.14.1" />
3131
</ItemGroup>
3232

3333
<ItemGroup>

src/Util.FileStorage.Minio/03-Util.FileStorage.Minio.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</ItemGroup>
2828

2929
<ItemGroup>
30-
<PackageReference Include="Minio" Version="6.0.2" />
30+
<PackageReference Include="Minio" Version="6.0.3" />
3131
</ItemGroup>
3232

3333
<ItemGroup>

src/Util.FileStorage/02-Util.FileStorage.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
</ItemGroup>
3232

3333
<ItemGroup>
34-
<PackageReference Include="FileSignatures" Version="5.0.1" />
34+
<PackageReference Include="FileSignatures" Version="5.0.2" />
3535
</ItemGroup>
3636
</Project>

src/Util.IdGenerator/10-Util.IdGenerator.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</ItemGroup>
2828

2929
<ItemGroup>
30-
<PackageReference Include="Nanoid" Version="3.0.0" />
30+
<PackageReference Include="Nanoid" Version="3.1.0" />
3131
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
3232
</ItemGroup>
3333

src/Util.Logging.Serilog/02-Util.Logging.Serilog.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828

2929
<ItemGroup>
3030
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
31-
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.0" />
32-
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
33-
<PackageReference Include="Serilog.Sinks.Seq" Version="7.0.1" />
31+
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.1" />
32+
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
33+
<PackageReference Include="Serilog.Sinks.Seq" Version="8.0.0" />
3434
</ItemGroup>
3535

3636
<ItemGroup>

src/Util.Microservices.Dapr/ServiceInvocations/DaprServiceInvocation.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ protected virtual async Task<ServiceResult<TResponse>> ToUnpackResult<TResponse>
381381
return await response.Content.ReadFromJsonAsync<ServiceResult<TResponse>>( Client.JsonSerializerOptions, cancellationToken );
382382
var objResult = await OnResultAction( response, Client.JsonSerializerOptions, cancellationToken );
383383
var result = objResult as ServiceResult<TResponse>;
384-
result.CheckNull( nameof( result ) );
384+
result!.CheckNull( nameof( result ) );
385385
return result;
386386
}
387387

src/Util.Microservices.Polly/02-Util.Microservices.Polly.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
</ItemGroup>
2727

2828
<ItemGroup>
29-
<PackageReference Include="Polly" Version="8.4.0" />
29+
<PackageReference Include="Polly" Version="8.4.1" />
3030
</ItemGroup>
3131

3232
<ItemGroup>

src/Util.Scheduling.Hangfire/03-Util.Scheduling.Hangfire.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</ItemGroup>
2828

2929
<ItemGroup>
30-
<PackageReference Include="Hangfire.AspNetCore" Version="1.8.12" />
30+
<PackageReference Include="Hangfire.AspNetCore" Version="1.8.14" />
3131
</ItemGroup>
3232

3333
<ItemGroup>

src/Util.Scheduling.Quartz/02-Util.Scheduling.Quartz.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
</ItemGroup>
2828

2929
<ItemGroup>
30-
<PackageReference Include="Quartz" Version="3.9.0" />
31-
<PackageReference Include="Quartz.Extensions.DependencyInjection" Version="3.9.0" />
30+
<PackageReference Include="Quartz" Version="3.10.0" />
31+
<PackageReference Include="Quartz.Extensions.DependencyInjection" Version="3.10.0" />
3232
</ItemGroup>
3333

3434
<ItemGroup>

src/Util.Templates.Razor/02-Util.Templates.Razor.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@
3838

3939
<ItemGroup>
4040
<PackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="6.0.31" />
41-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" />
41+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.10.0" />
4242
</ItemGroup>
4343
</Project>

src/Util.Ui.NgZorro/Components/Alerts/AlertTagHelper.cs

+13-5
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ public class AlertTagHelper : AngularTagHelperBase {
1717
/// </summary>
1818
private Config _config;
1919
/// <summary>
20-
/// [nzBanner],是否顶部公告,默认值: false
20+
/// [nzBanner],是否顶部公告, 类型: boolean, 默认值: false
2121
/// </summary>
2222
public string Banner { get; set; }
2323
/// <summary>
24-
/// [nzCloseable],是否可关闭
24+
/// [nzCloseable],是否可关闭,类型: boolean, 默认值: false
2525
/// </summary>
2626
public string Closeable { get; set; }
2727
/// <summary>
@@ -49,18 +49,22 @@ public class AlertTagHelper : AngularTagHelperBase {
4949
/// </summary>
5050
public string BindMessage { get; set; }
5151
/// <summary>
52-
/// [nzShowIcon],是否显示图标,默认值: false,nzBanner 模式下默认值为 true
52+
/// [nzShowIcon],是否显示图标, 类型: boolean, 默认值: false, nzBanner 模式下默认值为 true
5353
/// </summary>
5454
public string ShowIcon { get; set; }
5555
/// <summary>
56-
/// nzIconType,自定义图标类型,nzShowIcon 为 true 时有效
56+
/// nzIconType,自定义图标类型
5757
/// </summary>
5858
public AntDesignIcon IconType { get; set; }
5959
/// <summary>
60-
/// [nzIconType],自定义图标类型,nzShowIcon 为 true 时有效
60+
/// [nzIconType],自定义图标类型
6161
/// </summary>
6262
public string BindIconType { get; set; }
6363
/// <summary>
64+
/// [nzIcon],自定义图标,类型: string | TemplateRef&lt;void>
65+
/// </summary>
66+
public string Icon { get; set; }
67+
/// <summary>
6468
/// nzType,警告类型,指定警告提示的样式,可选值: 'success' | 'info' | 'warning' | 'error',默认值: 'info',nzBanner 模式下默认值为 'warning'
6569
/// </summary>
6670
public AlertType Type { get; set; }
@@ -69,6 +73,10 @@ public class AlertTagHelper : AngularTagHelperBase {
6973
/// </summary>
7074
public string BindType { get; set; }
7175
/// <summary>
76+
/// [nzAction],自定义操作项,类型: string | TemplateRef&lt;void>
77+
/// </summary>
78+
public string Action { get; set; }
79+
/// <summary>
7280
/// (nzOnClose),关闭事件,类型: EventEmitter&lt;void>
7381
/// </summary>
7482
public string OnClose { get; set; }

src/Util.Ui.NgZorro/Components/Alerts/Builders/AlertBuilder.cs

+19-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using Util.Ui.Angular.Configs;
33
using Util.Ui.NgZorro.Enums;
44

5-
namespace Util.Ui.NgZorro.Components.Alerts.Builders;
5+
namespace Util.Ui.NgZorro.Components.Alerts.Builders;
66

77
/// <summary>
88
/// 警告提示标签生成器
@@ -75,16 +75,23 @@ public AlertBuilder BindMessage( string value ) {
7575
/// 配置是否显示图标
7676
/// </summary>
7777
public AlertBuilder ShowIcon() {
78+
if ( _config.GetValue( UiConst.IconType ).IsEmpty() == false ||
79+
_config.GetValue( AngularConst.BindIconType ).IsEmpty() == false ||
80+
_config.GetValue( UiConst.Icon ).IsEmpty() == false ) {
81+
Attribute( "[nzShowIcon]", "true" );
82+
return this;
83+
}
7884
AttributeIfNotEmpty( "[nzShowIcon]", _config.GetValue( UiConst.ShowIcon ) );
7985
return this;
8086
}
8187

8288
/// <summary>
83-
/// 配置图标类型
89+
/// 配置图标
8490
/// </summary>
85-
public AlertBuilder IconType() {
91+
public AlertBuilder Icon() {
8692
AttributeIfNotEmpty( "nzIconType", _config.GetValue<AntDesignIcon?>( UiConst.IconType )?.Description() );
8793
AttributeIfNotEmpty( "[nzIconType]", _config.GetValue( AngularConst.BindIconType ) );
94+
AttributeIfNotEmpty( "[nzIcon]", _config.GetValue( UiConst.Icon ) );
8895
return this;
8996
}
9097

@@ -97,6 +104,14 @@ public AlertBuilder Type() {
97104
return this;
98105
}
99106

107+
/// <summary>
108+
/// 配置自定义操作项
109+
/// </summary>
110+
public AlertBuilder Action() {
111+
AttributeIfNotEmpty( "[nzAction]", _config.GetValue( UiConst.Action ) );
112+
return this;
113+
}
114+
100115
/// <summary>
101116
/// 配置事件
102117
/// </summary>
@@ -111,7 +126,7 @@ public AlertBuilder Events() {
111126
public override void Config() {
112127
base.ConfigBase( _config );
113128
Banner().Closeable().CloseText().Description()
114-
.Message().ShowIcon().IconType().Type()
129+
.Message().ShowIcon().Icon().Type().Action()
115130
.Events();
116131
}
117132
}

0 commit comments

Comments
 (0)