Skip to content

Commit 139753d

Browse files
committed
1. 表格单元格<util-td> 添加 tooltip 相关属性.
2. 新增Spa管道中间件,由于微软已放弃维护, 故从 Microsoft.AspNetCore.SpaServices 复制源码进行修改. 3. IAppBuilder 扩展方法 AddNgZorro ,新增 EnableWatchRazor 选项, 用于启用Razor监视服务 ,并默认开启. 4. WebApplication 扩展方法 UseNgZorro , 新增 isAutoStartAngularServer 参数,用于自动启动Angular服务器, 并默认开启. 5. 修复描述列表项 <util-descriptions-item> 显示数值类型不正确的bug. 6. 修复具有嵌套列的情况下表格设置加载列不正确的bug.
1 parent 66926b2 commit 139753d

File tree

66 files changed

+2144
-173
lines changed

Some content is hidden

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

66 files changed

+2144
-173
lines changed

build/version.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<VersionMajor>8</VersionMajor>
44
<VersionMinor>0</VersionMinor>
5-
<VersionPatch>8</VersionPatch>
5+
<VersionPatch>9</VersionPatch>
66
<VersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)</VersionPrefix>
77
<VersionSuffix></VersionSuffix>
88
</PropertyGroup>

readme.md

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -422,10 +422,6 @@ Util 配套代码生成器, 简单易用, 可解决大部分机械工作.
422422

423423
## Util Angular UI 特点
424424

425-
- ### 使用 Visual Studio 开发工具
426-
427-
前端开发一般使用 Visual Studio Code , 不过 Util Angular UI主要使用 Razor 页面,使用 Visual Studio 更方便.
428-
429425
- ### 组件扩展支持
430426

431427
除了支持 Ng Zorro 原生功能外,Util UI还对常用组件进行了扩展.
@@ -580,31 +576,11 @@ Util Angular UI 主要由 util-angular 和 Util.Ui.NgZorro 两个库提供支持
580576

581577
## Util Angular UI 已知缺陷
582578

583-
Util Angular UI 在提供大量支持的同时,也存在一些缺陷.
584-
585-
- ### 开发阶段运行比较缓慢
586-
587-
与 Visual Studio Code 相比,使用 Visual Studio 开发 Angular 项目要慢一些,如果使用了 Resharper 插件,则会更慢.
588-
589-
除开发工具影响外, Util Angular UI 在开发阶段需要启用 Angular JIT( 即时编译 ), 运行会变慢.
590-
591-
另外, Util Angular UI 在开发阶段需要访问 Razor 页面,每当项目启动,Angular 主模块加载的所有组件都会发出 Razor 页面请求.
592-
593-
不过运行缓慢仅存在于开发阶段,一旦发布,则与纯前端开发方式的运行速度相同.
594-
595-
- ### 无法使用 Angular 常规延迟加载方式
596-
597-
你不能使用 loadChildren 延迟加载模块,这是因为开发阶段组件的 templateUrl 指向 Razor 页面地址, 必须使用 Angular JIT 模式,等待运行时再获取组件模板.
598-
599-
这个问题从 Angular 13 开始出现, Angular 13弃用了传统的视图引擎, 使用 loadChildren 加载指向 Razor 页面地址的组件会报异常.
600-
601-
解决它的方法是使用微前端方案延迟加载模块, 当然你也可以回退到 Angular 13之前的版本.
602-
603-
在同一个 Util Angular UI 项目中,你必须把所有的子模块加载到主模块中,并配置微前端将子模块发布为可独立加载包.
579+
Util Angular UI 所有已知缺陷均已解决.
604580

605581
## Util Angular UI 适合你吗?
606582

607-
Util Angular UI 是为 .Net 全栈工程师准备的,如果你更喜欢使用 Visual Studio 开发,喜欢代码提示,喜欢更简洁的语法,希望开发的成本更低,它就适合你.
583+
Util Angular UI 是为 .Net 全栈工程师准备的,如果你喜欢更简洁的语法,希望开发的成本更低,它就适合你.
608584

609585
## 参考应用框架
610586

src/Util.AspNetCore/Helpers/Web.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,8 @@ public static async Task DownloadAsync( byte[] bytes, string fileName, Encoding
368368
fileName = fileName.Replace( " ", "" );
369369
fileName = UrlEncode( fileName, encoding );
370370
Response.ContentType = "application/octet-stream";
371-
Response.Headers.Add( "Content-Disposition", $"attachment; filename={fileName}" );
372-
Response.Headers.Add( "Content-Length", bytes.Length.ToString() );
371+
Response.Headers.Append( "Content-Disposition", $"attachment; filename={fileName}" );
372+
Response.Headers.Append( "Content-Length", bytes.Length.ToString() );
373373
await Response.Body.WriteAsync( bytes, 0, bytes.Length );
374374
}
375375

src/Util.Core/Helpers/Environment.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ public static class Environment {
2020
/// 换行符
2121
/// </summary>
2222
public static string NewLine => System.Environment.NewLine;
23+
/// <summary>
24+
/// 是否测试环境
25+
/// </summary>
26+
public static bool IsTest { get; set; }
2327

2428
/// <summary>
2529
/// 设置环境变量

src/Util.Core/Helpers/Url.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ public static string JoinPath( params string[] paths ) {
1616
return string.Empty;
1717
var firstPath = paths.First();
1818
var lastPath = paths.Last();
19+
string schema = string.Empty;
20+
if ( firstPath.StartsWith( "http:", StringComparison.OrdinalIgnoreCase ) )
21+
schema = "http://";
22+
if ( firstPath.StartsWith( "https:", StringComparison.OrdinalIgnoreCase ) )
23+
schema = "https://";
1924
paths = paths.Select( t => t.Trim( '/' ) ).ToArray();
2025
var result = Path.Combine( paths ).Replace( @"\", "/" );
2126
if ( paths.Any( path => path.StartsWith( "." ) ) ) {
@@ -26,6 +31,9 @@ public static string JoinPath( params string[] paths ) {
2631
result = $"/{result}";
2732
if ( lastPath.EndsWith( '/' ) )
2833
result = $"{result}/";
29-
return result;
34+
result = result.RemoveStart( "http:/" ).RemoveStart( "https:/" );
35+
if (schema.IsEmpty())
36+
return result;
37+
return schema + result.RemoveStart( "/" );
3038
}
3139
}

src/Util.Generators.Razor/RazorTemplate.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using Util.Generators.Templates;
33
using Util.Templates;
44

5-
namespace Util.Generators.Razor;
5+
namespace Util.Generators.Razor;
66

77
/// <summary>
88
/// Razor模板
@@ -82,8 +82,10 @@ protected virtual async Task<string> RenderResult( EntityContext context ) {
8282
/// </summary>
8383
/// <param name="context">实体上下文</param>
8484
/// <param name="result">渲染结果</param>
85-
protected virtual async Task WriteFile( EntityContext context,string result ) {
86-
if( context.Output.Path.IsEmpty() )
85+
protected virtual async Task WriteFile( EntityContext context, string result ) {
86+
if ( context.Output.Path.IsEmpty() )
87+
return;
88+
if ( result.IsEmpty() )
8789
return;
8890
await Util.Helpers.File.WriteAsync( context.Output.Path, result );
8991
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
</ItemGroup>
2828

2929
<ItemGroup>
30-
<PackageReference Include="Serilog.Extensions.Logging" Version="7.0.0" />
31-
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.0" />
30+
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
31+
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.0" />
3232
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
33-
<PackageReference Include="Serilog.Sinks.Seq" Version="5.2.3" />
33+
<PackageReference Include="Serilog.Sinks.Seq" Version="7.0.0" />
3434
</ItemGroup>
3535

3636
<ItemGroup>
Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Util.Ui.Angular.Configs;
22
using Util.Ui.Configs;
33

4-
namespace Util.Ui.Angular.Extensions;
4+
namespace Util.Ui.Angular.Extensions;
55

66
/// <summary>
77
/// 配置扩展
@@ -13,13 +13,30 @@ public static class ConfigExtensions {
1313
/// <param name="config">配置</param>
1414
public static Config CopyRemoveAttributes( this Config config ) {
1515
var result = config.Copy();
16-
result.RemoveAttribute( UiConst.Id );
17-
result.RemoveAttribute( AngularConst.RawId );
18-
result.RemoveAttribute( UiConst.Name );
19-
result.RemoveAttribute( AngularConst.BindName );
20-
result.RemoveAttribute( UiConst.Style );
21-
result.RemoveAttribute( UiConst.Class );
2216
result.OutputAttributes.Clear();
17+
result.AllAttributes.Clear();
18+
LoadConfig( config, result, UiConst.Required );
19+
LoadConfig( config, result, UiConst.RequiredMessage );
20+
LoadConfig( config, result, UiConst.Suffix );
21+
LoadConfig( config, result, AngularConst.BindSuffix );
22+
LoadConfig( config, result, UiConst.Extra );
23+
LoadConfig( config, result, AngularConst.BindExtra );
24+
LoadConfig( config, result, UiConst.ErrorTip );
25+
LoadConfig( config, result, AngularConst.BindErrorTip );
26+
LoadConfig( config, result, UiConst.SuccessTip );
27+
LoadConfig( config, result, AngularConst.BindSuccessTip );
28+
LoadConfig( config, result, UiConst.ValidatingTip );
29+
LoadConfig( config, result, AngularConst.BindValidatingTip );
30+
LoadConfig( config, result, UiConst.WarningTip );
31+
LoadConfig( config, result, AngularConst.BindWarningTip );
2332
return result;
2433
}
34+
35+
/// <summary>
36+
/// 加载配置
37+
/// </summary>
38+
private static void LoadConfig( Config from, Config to, string name ) {
39+
var value = from.GetValue( name );
40+
to.SetAttribute( name, value );
41+
}
2542
}

src/Util.Ui.NgZorro/AppBuilderExtensions.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ public static IAppBuilder AddNgZorro( this IAppBuilder builder, Action<NgZorroOp
3131
services.TryAddSingleton<IRazorWatchService, RazorWatchService>();
3232
services.TryAddSingleton<IPartViewPathResolver, PartViewPathResolver>();
3333
services.TryAddSingleton<IPartViewPathFinder, PartViewPathFinder>();
34+
if ( options.EnableWatchRazor )
35+
services.AddHostedService<WatchHostedService>();
3436
ConfigSpaStaticFiles( services, options );
3537
ConfigRazorOptions( services, options );
3638
ConfigNgZorroOptions( services, setupAction );
@@ -56,7 +58,11 @@ void Action( RazorOptions t ) {
5658
t.GenerateHtmlBasePath = options.GenerateHtmlBasePath;
5759
t.GenerateHtmlFolder = options.GenerateHtmlFolder;
5860
t.GenerateHtmlSuffix = options.GenerateHtmlSuffix;
61+
t.EnableWatchRazor = options.EnableWatchRazor;
62+
t.StartInitDelay = options.StartInitDelay;
5963
t.HtmlRenderDelayOnRazorChange = options.HtmlRenderDelayOnRazorChange;
64+
t.EnablePreheat = options.EnablePreheat;
65+
t.EnableOverrideHtml = options.EnableOverrideHtml;
6066
}
6167
services.Configure( (Action<RazorOptions>)Action );
6268
}

src/Util.Ui.NgZorro/Components/Buttons/ButtonGroupTagHelper.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using Microsoft.AspNetCore.Razor.TagHelpers;
22
using Util.Ui.Angular.TagHelpers;
3-
using Util.Ui.Configs;
43
using Util.Ui.NgZorro.Components.Buttons.Renders;
54
using Util.Ui.NgZorro.Enums;
65
using Util.Ui.Renders;

0 commit comments

Comments
 (0)