diff --git a/build/version.props b/build/version.props
index 3381ff008..91869707f 100644
--- a/build/version.props
+++ b/build/version.props
@@ -2,7 +2,7 @@
8
0
- 15
+ 16
$(VersionMajor).$(VersionMinor).$(VersionPatch)
diff --git a/src/Util.Ui.Angular/Builders/AngularTagBuilder.cs b/src/Util.Ui.Angular/Builders/AngularTagBuilder.cs
index addb507d3..d4e0a3946 100644
--- a/src/Util.Ui.Angular/Builders/AngularTagBuilder.cs
+++ b/src/Util.Ui.Angular/Builders/AngularTagBuilder.cs
@@ -3,7 +3,7 @@
using Util.Ui.Configs;
using Util.Ui.Extensions;
-namespace Util.Ui.Angular.Builders;
+namespace Util.Ui.Angular.Builders;
///
/// Angular标签生成器
@@ -38,6 +38,7 @@ public override void ConfigBase( Config config ) {
base.ConfigBase( config );
this.Angular( config );
ConfigId( config );
+ ConfigOnContextmenu( config );
}
///
@@ -48,6 +49,13 @@ protected virtual void ConfigId( Config config ) {
this.Id( config );
}
+ ///
+ /// 配置右键上下文菜单事件
+ ///
+ protected virtual void ConfigOnContextmenu( Config config ) {
+ AttributeIfNotEmpty( "(contextmenu)", _config.GetValue( UiConst.OnContextmenu ) );
+ }
+
///
/// 配置内容元素
///
diff --git a/src/Util.Ui.Angular/Configs/AngularConst.cs b/src/Util.Ui.Angular/Configs/AngularConst.cs
index bc995ab24..cc3ab12cc 100644
--- a/src/Util.Ui.Angular/Configs/AngularConst.cs
+++ b/src/Util.Ui.Angular/Configs/AngularConst.cs
@@ -25,6 +25,10 @@ public static class AngularConst {
///
public const string NgSwitchDefault = "ng-switch-default";
///
+ /// *ngTemplateOutlet指令
+ ///
+ public const string NgTemplateOutlet = "ng-template-outlet";
+ ///
/// ngFor指令
///
public const string NgFor = "ng-for";
@@ -473,6 +477,10 @@ public static class AngularConst {
///
public const string BindSeparator = "bind-separator";
///
+ /// 查询参数处理方式
+ ///
+ public const string BindQueryParamsHandling = "bind-query-params-handling";
+ ///
/// 自动生成
///
public const string BindAutoGenerate = "bind-auto-generate";
diff --git a/src/Util.Ui.Angular/Enums/QueryParamsHandling.cs b/src/Util.Ui.Angular/Enums/QueryParamsHandling.cs
new file mode 100644
index 000000000..f3d8b1640
--- /dev/null
+++ b/src/Util.Ui.Angular/Enums/QueryParamsHandling.cs
@@ -0,0 +1,19 @@
+using System.ComponentModel;
+
+namespace Util.Ui.NgZorro.Enums;
+
+///
+/// 路由器链接查询参数处理方式
+///
+public enum QueryParamsHandling {
+ ///
+ /// merge, 将新参数与当前参数合并
+ ///
+ [Description( "merge" )]
+ Merge,
+ ///
+ /// preserve, 保留当前参数
+ ///
+ [Description( "preserve" )]
+ Preserve
+}
\ No newline at end of file
diff --git a/src/Util.Ui.Angular/Extensions/TagBuilderExtensions.cs b/src/Util.Ui.Angular/Extensions/TagBuilderExtensions.cs
index f4e1b85c8..6f3511966 100644
--- a/src/Util.Ui.Angular/Extensions/TagBuilderExtensions.cs
+++ b/src/Util.Ui.Angular/Extensions/TagBuilderExtensions.cs
@@ -16,7 +16,8 @@ public static class TagBuilderExtensions {
/// 生成器实例
/// 配置
public static TBuilder Angular( this TBuilder builder, Config config ) where TBuilder : TagBuilder {
- builder.NgIf( config )
+ builder
+ .NgIf( config )
.NgSwitch( config ).NgSwitchCase( config ).NgSwitchDefault( config )
.NgFor( config )
.NgClass( config )
diff --git a/src/Util.Ui.Angular/TagHelpers/AngularTagHelperBase.cs b/src/Util.Ui.Angular/TagHelpers/AngularTagHelperBase.cs
index c13334c8b..5cd2e6b44 100644
--- a/src/Util.Ui.Angular/TagHelpers/AngularTagHelperBase.cs
+++ b/src/Util.Ui.Angular/TagHelpers/AngularTagHelperBase.cs
@@ -50,4 +50,8 @@ public abstract class AngularTagHelperBase : TagHelperBase {
/// [acl],访问控制
///
public string BindAcl { get; set; }
+ ///
+ /// (contextmenu),右键上下文菜单事件,类型: EventEmitter<MouseEvent>
+ ///
+ public string OnContextmenu { get; set; }
}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Components/Base/ButtonBuilderBase.cs b/src/Util.Ui.NgZorro/Components/Base/ButtonBuilderBase.cs
index 57b71a306..7e2cd1688 100644
--- a/src/Util.Ui.NgZorro/Components/Base/ButtonBuilderBase.cs
+++ b/src/Util.Ui.NgZorro/Components/Base/ButtonBuilderBase.cs
@@ -126,17 +126,6 @@ public TBuilder Icon( AntDesignIcon icon ) {
return (TBuilder)this;
}
- ///
- /// 配置路由链接
- ///
- public TBuilder RouterLink() {
- AttributeIfNotEmpty( "routerLink", _config.GetValue( AngularConst.RouterLink ) );
- AttributeIfNotEmpty( "[routerLink]", _config.GetValue( AngularConst.BindRouterLink ) );
- AttributeIfNotEmpty( "routerLinkActive", _config.GetValue( AngularConst.RouterLinkActive ) );
- AttributeIfNotEmpty( "[routerLinkActive]", _config.GetValue( AngularConst.BindRouterLinkActive ) );
- return (TBuilder)this;
- }
-
///
/// 配置下拉菜单
///
@@ -714,7 +703,7 @@ public TBuilder OnVisibleChange() {
///
protected TBuilder ConfigButton() {
EnableExtend();
- return Type().Size().Shape().Disabled().Danger().Loading().Ghost().Block().Icon().RouterLink()
+ return Type().Size().Shape().Disabled().Danger().Loading().Ghost().Block().Icon()
.DropdownMenu().DropdownMenuPlacement().DropdownMenuTrigger().DropdownMenuClickHide()
.DropdownMenuVisible().DropdownMenuOverlayClassName().DropdownMenuOverlayStyle()
.SpaceItem().Tooltip( _config ).Popconfirm( _config ).Popover( _config )
@@ -725,7 +714,8 @@ protected TBuilder ConfigButton() {
.TextStart().TextStop().TextAdd().TextRemove()
.TextOpen().TextClose().TextSend().TextClear()
.TextImport().TextExport().TextReset().TextUnedit()
- .Text().OnClick().OnVisibleChange();
+ .Text()
+ .OnClick().OnVisibleChange();
}
///
@@ -791,8 +781,8 @@ protected void DisableButton() {
///
protected string GetFullscreenWrapClass() {
var className = _config.GetValue( UiConst.FullscreenWrapClass );
- if (className.IsEmpty()) {
- if(_config.Contains( UiConst.FullscreenPack ) || _config.Contains( UiConst.FullscreenTitle ) )
+ if ( className.IsEmpty() ) {
+ if ( _config.Contains( UiConst.FullscreenPack ) || _config.Contains( UiConst.FullscreenTitle ) )
return ",null";
return null;
}
@@ -804,7 +794,7 @@ protected string GetFullscreenWrapClass() {
///
protected string GetFullscreenPack() {
var isPack = _config.GetBoolValue( UiConst.FullscreenPack );
- if (isPack.IsEmpty()) {
+ if ( isPack.IsEmpty() ) {
if ( _config.Contains( UiConst.FullscreenTitle ) )
return ",true";
return null;
diff --git a/src/Util.Ui.NgZorro/Components/Base/ButtonTagHelperBase.cs b/src/Util.Ui.NgZorro/Components/Base/ButtonTagHelperBase.cs
index e4e53fb55..9fbb7f3b1 100644
--- a/src/Util.Ui.NgZorro/Components/Base/ButtonTagHelperBase.cs
+++ b/src/Util.Ui.NgZorro/Components/Base/ButtonTagHelperBase.cs
@@ -1,4 +1,5 @@
-using Util.Ui.NgZorro.Enums;
+using Util.Ui.Enums;
+using Util.Ui.NgZorro.Enums;
namespace Util.Ui.NgZorro.Components.Base;
@@ -23,7 +24,7 @@ public abstract class ButtonTagHelperBase : TooltipTagHelperBase {
///
public bool FullscreenPack { get; set; }
///
- /// 扩展属性,内容文本,支持i18n
+ /// 扩展属性,内容文本,支持多语言
///
public string Text { get; set; }
///
@@ -143,31 +144,15 @@ public abstract class ButtonTagHelperBase : TooltipTagHelperBase {
///
public bool TextUnedit { get; set; }
///
- /// routerLink,路由链接,当按钮类型为链接时可用
- ///
- public string RouterLink { get; set; }
- ///
- /// [routerLink],路由链接,当按钮类型为链接时可用
- ///
- public string BindRouterLink { get; set; }
- ///
- /// routerLinkActive,活动路由链接,设置当前活动路由链接的css类,当按钮类型为链接时可用
- ///
- public string RouterLinkActive { get; set; }
- ///
- /// [routerLinkActive],活动路由链接,设置当前活动路由链接的css类,当按钮类型为链接时可用
- ///
- public string BindRouterLinkActive { get; set; }
- ///
/// [nzDropdownMenu],设置下拉菜单
///
public string DropdownMenu { get; set; }
///
- /// nzPlacement,下拉菜单弹出位置
+ /// nzPlacement,下拉菜单弹出位置, 可选值: bottomLeft' | 'bottomCenter' | 'bottomRight' | 'topLeft' | 'topCenter' | 'topRight'
///
public DropdownMenuPlacement DropdownMenuPlacement { get; set; }
///
- /// [nzPlacement],下拉菜单弹出位置
+ /// [nzPlacement],下拉菜单弹出位置, 可选值: bottomLeft' | 'bottomCenter' | 'bottomRight' | 'topLeft' | 'topCenter' | 'topRight'
///
public string BindDropdownMenuPlacement { get; set; }
///
@@ -207,6 +192,70 @@ public abstract class ButtonTagHelperBase : TooltipTagHelperBase {
///
public bool SpaceItem { get; set; }
///
+ /// 扩展属性,是否查询表单链接,折叠时显示`展开`文本,展开时显示`收起`文本
+ ///
+ public bool IsSearch { get; set; }
+ ///
+ /// 扩展属性,显示表格设置,参数值为表格标识
+ ///
+ public string ShowTableSettings { get; set; }
+ ///
+ /// href,链接地址
+ ///
+ public string Href { get; set; }
+ ///
+ /// [href],链接地址
+ ///
+ public string BindHref { get; set; }
+ ///
+ /// target,链接打开目标, 可选值: '_self' | '_blank' | '_parent' | '_top'
+ ///
+ public ATarget Target { get; set; }
+ ///
+ /// [target],链接打开目标, 可选值: '_self' | '_blank' | '_parent' | '_top'
+ ///
+ public string BindTarget { get; set; }
+ ///
+ /// rel,指定当前文档与被链接文档的关系
+ ///
+ public string Rel { get; set; }
+ ///
+ /// [rel],指定当前文档与被链接文档的关系
+ ///
+ public string BindRel { get; set; }
+ ///
+ /// routerLink,路由链接地址
+ ///
+ public string RouterLink { get; set; }
+ ///
+ /// [routerLink],路由链接地址
+ ///
+ public string BindRouterLink { get; set; }
+ ///
+ /// routerLinkActive,设置当前活动路由链接的css类
+ ///
+ public string RouterLinkActive { get; set; }
+ ///
+ /// [routerLinkActive],设置当前活动路由链接的css类
+ ///
+ public string BindRouterLinkActive { get; set; }
+ ///
+ /// [queryParams],路由查询参数
+ ///
+ public string QueryParams { get; set; }
+ ///
+ /// queryParamsHandling,路由链接查询参数处理方式, 可选值: 'merge' | 'preserve', merge 将新参数与当前参数合并, preserve 保留当前参数.
+ ///
+ public QueryParamsHandling QueryParamsHandling { get; set; }
+ ///
+ /// [queryParamsHandling],路由链接查询参数处理方式, 可选值: 'merge' | 'preserve', merge 将新参数与当前参数合并, preserve 保留当前参数.
+ ///
+ public string BindQueryParamsHandling { get; set; }
+ ///
+ /// *nzTabLink nz-tab-link, 选项卡路由联动
+ ///
+ public string TabLink { get; set; }
+ ///
/// (click),单击事件
///
public string OnClick { get; set; }
diff --git a/src/Util.Ui.NgZorro/Components/Base/FormControlBuilderBase.cs b/src/Util.Ui.NgZorro/Components/Base/FormControlBuilderBase.cs
index 5e70effae..e1073a814 100644
--- a/src/Util.Ui.NgZorro/Components/Base/FormControlBuilderBase.cs
+++ b/src/Util.Ui.NgZorro/Components/Base/FormControlBuilderBase.cs
@@ -6,9 +6,10 @@
using Util.Ui.NgZorro.Components.Forms.Configs;
using Util.Ui.NgZorro.Components.Tables.Configs;
using Util.Ui.NgZorro.Configs;
+using Util.Ui.NgZorro.Extensions;
using Config = Util.Ui.Configs.Config;
-namespace Util.Ui.NgZorro.Components.Base;
+namespace Util.Ui.NgZorro.Components.Base;
///
/// 表单控件标签生成器基类
@@ -29,7 +30,7 @@ public abstract class FormControlBuilderBase : AngularTagBuilder where
/// 配置
/// 标签名称,范例:div
/// 渲染模式
- protected FormControlBuilderBase( Config config, string tagName, TagRenderMode renderMode = TagRenderMode.Normal ) : base( config,tagName, renderMode ) {
+ protected FormControlBuilderBase( Config config, string tagName, TagRenderMode renderMode = TagRenderMode.Normal ) : base( config, tagName, renderMode ) {
_config = config;
FormItemShareConfig = GetShareConfig();
}
@@ -150,6 +151,16 @@ public virtual TBuilder Pattern() {
return (TBuilder)this;
}
+ ///
+ /// 配置间距项
+ ///
+ public virtual TBuilder SpaceItem() {
+ if ( FormItemShareConfig.FormItemCreated )
+ return (TBuilder)this;
+ this.SpaceItem( FormItemShareConfig.SpaceItem );
+ return (TBuilder)this;
+ }
+
///
/// 配置表单属性
///
@@ -158,7 +169,7 @@ protected TBuilder ConfigForm() {
.Required().RequiredMessage()
.MinLength().MinLengthMessage()
.MaxLength().EmailMessage()
- .Pattern()
+ .Pattern().SpaceItem()
.TableEdit().ValidationExtend();
}
@@ -203,7 +214,7 @@ public TBuilder ValidationExtend() {
///
protected TBuilder AutocompleteOff() {
var options = NgZorroOptionsService.GetOptions();
- if( options.EnableAutocompleteOff )
+ if ( options.EnableAutocompleteOff )
Attribute( "autocomplete", "off" );
return (TBuilder)this;
}
diff --git a/src/Util.Ui.NgZorro/Components/Base/FormControlRenderBase.cs b/src/Util.Ui.NgZorro/Components/Base/FormControlRenderBase.cs
index 1839e0622..7b3516a0c 100644
--- a/src/Util.Ui.NgZorro/Components/Base/FormControlRenderBase.cs
+++ b/src/Util.Ui.NgZorro/Components/Base/FormControlRenderBase.cs
@@ -89,8 +89,10 @@ protected void SetControlId() {
///
protected virtual TagBuilder GetFormItem() {
TagBuilder builder = new EmptyContainerTagBuilder();
- if ( _config.Id == _shareConfig.Id && _shareConfig.AutoCreateFormItem == true )
- builder = new FormItemBuilder( _config.CopyRemoveAttributes() );
+ if (_config.Id == _shareConfig.Id && _shareConfig.AutoCreateFormItem == true) {
+ builder = new FormItemBuilder(_config.CopyRemoveAttributes());
+ _shareConfig.FormItemCreated = true;
+ }
builder.Config();
return builder;
}
diff --git a/src/Util.Ui.NgZorro/Components/Base/TooltipTagHelperBase.cs b/src/Util.Ui.NgZorro/Components/Base/TooltipTagHelperBase.cs
index 6b9045271..1619c4dbc 100644
--- a/src/Util.Ui.NgZorro/Components/Base/TooltipTagHelperBase.cs
+++ b/src/Util.Ui.NgZorro/Components/Base/TooltipTagHelperBase.cs
@@ -52,9 +52,13 @@ public abstract class TooltipTagHelperBase : AngularTagHelperBase {
///
public string BindTooltipTrigger { get; set; }
///
+ /// nzTooltipColor,扩展属性, 文字提示背景颜色
+ ///
+ public AntDesignColor TooltipColorType { get; set; }
+ ///
/// nzTooltipColor,文字提示背景颜色
///
- public AntDesignColor TooltipColor { get; set; }
+ public string TooltipColor { get; set; }
///
/// [nzTooltipColor],文字提示背景颜色
///
diff --git a/src/Util.Ui.NgZorro/Components/Buttons/ATagHelper.cs b/src/Util.Ui.NgZorro/Components/Buttons/ATagHelper.cs
new file mode 100644
index 000000000..807d60754
--- /dev/null
+++ b/src/Util.Ui.NgZorro/Components/Buttons/ATagHelper.cs
@@ -0,0 +1,23 @@
+using Microsoft.AspNetCore.Razor.TagHelpers;
+using Util.Ui.NgZorro.Components.Base;
+using Util.Ui.NgZorro.Components.Buttons.Renders;
+using Util.Ui.Renders;
+
+namespace Util.Ui.NgZorro.Components.Buttons;
+
+///
+/// 链接,生成的标签为<a></a>
+///
+[HtmlTargetElement( "util-a" )]
+public class ATagHelper : ButtonTagHelperBase {
+ ///
+ /// 扩展属性,是否危险状态,默认值: false
+ ///
+ public bool Danger { get; set; }
+
+ ///
+ protected override IRender GetRender( TagHelperContext context, TagHelperOutput output, TagHelperContent content ) {
+ var config = new Config( context, output, content );
+ return new ARender( config );
+ }
+}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Components/Links/Builders/ABuilder.cs b/src/Util.Ui.NgZorro/Components/Buttons/Builders/ABuilder.cs
similarity index 75%
rename from src/Util.Ui.NgZorro/Components/Links/Builders/ABuilder.cs
rename to src/Util.Ui.NgZorro/Components/Buttons/Builders/ABuilder.cs
index 2ab74a4df..425f8abfb 100644
--- a/src/Util.Ui.NgZorro/Components/Links/Builders/ABuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/Buttons/Builders/ABuilder.cs
@@ -1,153 +1,184 @@
-using Util.Ui.Angular.Configs;
-using Util.Ui.Angular.Extensions;
-using Util.Ui.Enums;
-using Util.Ui.NgZorro.Components.Base;
-using Util.Ui.NgZorro.Components.Icons.Builders;
-using Util.Ui.NgZorro.Configs;
-using Util.Ui.NgZorro.Directives.Tooltips;
-using Util.Ui.NgZorro.Enums;
-
-namespace Util.Ui.NgZorro.Components.Links.Builders;
-
-///
-/// a标签生成器
-///
-public class ABuilder : ButtonBuilderBase {
- ///
- /// 配置
- ///
- private readonly Config _config;
-
- ///
- /// 初始化a标签生成器
- ///
- public ABuilder( Config config ) : base( config, "a" ) {
- _config = config;
- }
-
- ///
- /// 配置链接地址
- ///
- public ABuilder Href() {
- AttributeIfNotEmpty( "href", _config.GetValue( UiConst.Href ) );
- AttributeIfNotEmpty( "[href]", _config.GetValue( AngularConst.BindHref ) );
- return this;
- }
-
- ///
- /// 配置链接打开目标
- ///
- public ABuilder Target() {
- AttributeIfNotEmpty( "target", _config.GetValue( UiConst.Target )?.Description() );
- AttributeIfNotEmpty( "[target]", _config.GetValue( AngularConst.BindTarget ) );
- return this;
- }
-
- ///
- /// 配置链接关系
- ///
- public ABuilder Rel() {
- AttributeIfNotEmpty( "rel", _config.GetValue( UiConst.Rel ) );
- AttributeIfNotEmpty( "[rel]", _config.GetValue( AngularConst.BindRel ) );
- return this;
- }
-
- ///
- /// 配置危险按钮
- ///
- public override ABuilder Danger() {
- var result = _config.GetValue( UiConst.Danger );
- if ( result == true ) {
- Class( "ant-btn-dangerous" );
- }
- return this;
- }
-
- ///
- /// 配置查询表单链接
- ///
- public ABuilder IsSearch() {
- var isSearch = _config.GetValue( UiConst.IsSearch );
- if ( isSearch != true )
- return this;
- this.OnClick( "expand=!expand" );
- var options = NgZorroOptionsService.GetOptions();
- if ( options.EnableI18n )
- AppendContent( "{{" + $"expand?('{I18nKeys.Collapse}'|i18n):('{I18nKeys.Expand}'|i18n)" + "}}" );
- else
- AppendContent( "{{expand?'收起':'展开'}}" );
- var icon = new IconBuilder( _config );
- icon.BindType( "expand?'up':'down'" );
- AppendContent( icon );
- return this;
- }
-
- ///
- /// 配置显示表格设置
- ///
- public ABuilder ShowTableSettings() {
- var tableId = _config.GetValue( UiConst.ShowTableSettings );
- if ( tableId.IsEmpty() )
- return this;
- this.OnClick( $"ts_{tableId}.show()" );
- Class( "card-tool-icon-btn" );
- var options = NgZorroOptionsService.GetOptions();
- this.TooltipTitle( options.EnableI18n ? "util.tableSettings" : "表格设置" );
- var icon = new IconBuilder( _config );
- icon.Type( AntDesignIcon.Setting );
- AppendContent( icon );
- return this;
- }
-
- ///
- /// 配置
- ///
- public override void Config() {
- base.Config();
- ConfigButton().Href().Target().Rel().RouterLink().DropdownMenu()
- .DropdownMenuPlacement().IsSearch().ShowTableSettings();
- Fullscreen();
- }
-
- ///
- /// 配置全屏
- ///
- public ABuilder Fullscreen() {
- var value = _config.GetValue( UiConst.Fullscreen );
- if ( value.IsEmpty() )
- return this;
- this.OnClick( $"{GetButtonExtendId()}.fullscreen({value}{GetFullscreenWrapClass()}{GetFullscreenPack()}{GetFullscreenTitle()})" );
- Class( "card-tool-icon-btn" );
- AppendContent( GetFullscreenIcon() );
- AppendContent( GetFullscreenExitIcon() );
- var options = NgZorroOptionsService.GetOptions();
- if (options.EnableI18n) {
- this.BindTooltipTitle( $"({GetButtonExtendId()}.isFullscreen?'util.fullscreenExit':'util.fullscreen')|i18n" );
- return this;
- }
- this.BindTooltipTitle( $"{GetButtonExtendId()}.isFullscreen?'退出全屏':'全屏'" );
- return this;
- }
-
- ///
- /// 获取全屏图标
- ///
- private IconBuilder GetFullscreenIcon() {
- var icon = new IconBuilder( _config );
- icon.Theme( IconTheme.Outline );
- icon.Type( AntDesignIcon.Fullscreen );
- icon.NgIf( $"!{GetButtonExtendId()}.isFullscreen" );
- return icon;
- }
-
- ///
- /// 获取退出全屏图标
- ///
- private IconBuilder GetFullscreenExitIcon() {
- var icon = new IconBuilder( _config );
- icon.Theme( IconTheme.Outline );
- icon.Type( AntDesignIcon.FullscreenExit );
- icon.NgIf( $"{GetButtonExtendId()}.isFullscreen" );
- return icon;
- }
+using Util.Ui.Angular.Configs;
+using Util.Ui.Angular.Extensions;
+using Util.Ui.Enums;
+using Util.Ui.NgZorro.Components.Base;
+using Util.Ui.NgZorro.Components.Icons.Builders;
+using Util.Ui.NgZorro.Configs;
+using Util.Ui.NgZorro.Directives.Tooltips;
+using Util.Ui.NgZorro.Enums;
+
+namespace Util.Ui.NgZorro.Components.Buttons.Builders;
+
+///
+/// a标签生成器
+///
+public class ABuilder : ButtonBuilderBase {
+ ///
+ /// 配置
+ ///
+ private readonly Config _config;
+
+ ///
+ /// 初始化a标签生成器
+ ///
+ public ABuilder( Config config ) : base( config, "a" ) {
+ _config = config;
+ }
+
+ ///
+ /// 配置链接地址
+ ///
+ public ABuilder Href() {
+ AttributeIfNotEmpty( "href", _config.GetValue( UiConst.Href ) );
+ AttributeIfNotEmpty( "[href]", _config.GetValue( AngularConst.BindHref ) );
+ return this;
+ }
+
+ ///
+ /// 配置链接打开目标
+ ///
+ public ABuilder Target() {
+ AttributeIfNotEmpty( "target", _config.GetValue( UiConst.Target )?.Description() );
+ AttributeIfNotEmpty( "[target]", _config.GetValue( AngularConst.BindTarget ) );
+ return this;
+ }
+
+ ///
+ /// 配置链接关系
+ ///
+ public ABuilder Rel() {
+ AttributeIfNotEmpty( "rel", _config.GetValue( UiConst.Rel ) );
+ AttributeIfNotEmpty( "[rel]", _config.GetValue( AngularConst.BindRel ) );
+ return this;
+ }
+
+ ///
+ /// 配置路由链接
+ ///
+ public ABuilder RouterLink() {
+ AttributeIfNotEmpty( "routerLink", _config.GetValue( AngularConst.RouterLink ) );
+ AttributeIfNotEmpty( "[routerLink]", _config.GetValue( AngularConst.BindRouterLink ) );
+ AttributeIfNotEmpty( "routerLinkActive", _config.GetValue( AngularConst.RouterLinkActive ) );
+ AttributeIfNotEmpty( "[routerLinkActive]", _config.GetValue( AngularConst.BindRouterLinkActive ) );
+ AttributeIfNotEmpty( "[queryParams]", _config.GetValue( UiConst.QueryParams ) );
+ AttributeIfNotEmpty( "queryParamsHandling", _config.GetValue( UiConst.QueryParamsHandling )?.Description() );
+ AttributeIfNotEmpty( "[queryParamsHandling]", _config.GetValue( AngularConst.BindQueryParamsHandling ) );
+ return this;
+ }
+
+ ///
+ /// 配置选项卡路由联动
+ ///
+ public ABuilder TabLink() {
+ var value = _config.GetValue( UiConst.TabLink );
+ if ( value.IsEmpty() && _config.Contains( UiConst.TabLink ) )
+ value = "true";
+ if ( value.IsEmpty() )
+ return this;
+ if ( value == "true" )
+ value = string.Empty;
+ Attribute( "*nzTabLink", value );
+ Attribute( "nz-tab-link" );
+ return this;
+ }
+
+ ///
+ /// 配置危险按钮
+ ///
+ public override ABuilder Danger() {
+ var result = _config.GetValue( UiConst.Danger );
+ if ( result == true ) {
+ Class( "ant-btn-dangerous" );
+ }
+ return this;
+ }
+
+ ///
+ /// 配置查询表单链接
+ ///
+ public ABuilder IsSearch() {
+ var isSearch = _config.GetValue( UiConst.IsSearch );
+ if ( isSearch != true )
+ return this;
+ this.OnClick( "expand=!expand" );
+ var options = NgZorroOptionsService.GetOptions();
+ if ( options.EnableI18n )
+ AppendContent( "{{" + $"expand?('{I18nKeys.Collapse}'|i18n):('{I18nKeys.Expand}'|i18n)" + "}}" );
+ else
+ AppendContent( "{{expand?'收起':'展开'}}" );
+ var icon = new IconBuilder( _config );
+ icon.BindType( "expand?'up':'down'" );
+ AppendContent( icon );
+ return this;
+ }
+
+ ///
+ /// 配置显示表格设置
+ ///
+ public ABuilder ShowTableSettings() {
+ var tableId = _config.GetValue( UiConst.ShowTableSettings );
+ if ( tableId.IsEmpty() )
+ return this;
+ this.OnClick( $"ts_{tableId}.show()" );
+ Class( "card-tool-icon-btn" );
+ var options = NgZorroOptionsService.GetOptions();
+ this.TooltipTitle( options.EnableI18n ? "util.tableSettings" : "表格设置" );
+ var icon = new IconBuilder( _config );
+ icon.Type( AntDesignIcon.Setting );
+ AppendContent( icon );
+ return this;
+ }
+
+ ///
+ /// 配置
+ ///
+ public override void Config() {
+ base.Config();
+ ConfigButton().Href().Target().Rel().RouterLink().TabLink()
+ .DropdownMenu().DropdownMenuPlacement()
+ .IsSearch().ShowTableSettings();
+ Fullscreen();
+ }
+
+ ///
+ /// 配置全屏
+ ///
+ public ABuilder Fullscreen() {
+ var value = _config.GetValue( UiConst.Fullscreen );
+ if ( value.IsEmpty() )
+ return this;
+ this.OnClick( $"{GetButtonExtendId()}.fullscreen({value}{GetFullscreenWrapClass()}{GetFullscreenPack()}{GetFullscreenTitle()})" );
+ Class( "card-tool-icon-btn" );
+ AppendContent( GetFullscreenIcon() );
+ AppendContent( GetFullscreenExitIcon() );
+ var options = NgZorroOptionsService.GetOptions();
+ if (options.EnableI18n) {
+ this.BindTooltipTitle( $"({GetButtonExtendId()}.isFullscreen?'util.fullscreenExit':'util.fullscreen')|i18n" );
+ return this;
+ }
+ this.BindTooltipTitle( $"{GetButtonExtendId()}.isFullscreen?'退出全屏':'全屏'" );
+ return this;
+ }
+
+ ///
+ /// 获取全屏图标
+ ///
+ private IconBuilder GetFullscreenIcon() {
+ var icon = new IconBuilder( _config );
+ icon.Theme( IconTheme.Outline );
+ icon.Type( AntDesignIcon.Fullscreen );
+ icon.NgIf( $"!{GetButtonExtendId()}.isFullscreen" );
+ return icon;
+ }
+
+ ///
+ /// 获取退出全屏图标
+ ///
+ private IconBuilder GetFullscreenExitIcon() {
+ var icon = new IconBuilder( _config );
+ icon.Theme( IconTheme.Outline );
+ icon.Type( AntDesignIcon.FullscreenExit );
+ icon.NgIf( $"{GetButtonExtendId()}.isFullscreen" );
+ return icon;
+ }
}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Components/Links/Renders/ARender.cs b/src/Util.Ui.NgZorro/Components/Buttons/Renders/ARender.cs
similarity index 87%
rename from src/Util.Ui.NgZorro/Components/Links/Renders/ARender.cs
rename to src/Util.Ui.NgZorro/Components/Buttons/Renders/ARender.cs
index f1c32121b..d039ff8b6 100644
--- a/src/Util.Ui.NgZorro/Components/Links/Renders/ARender.cs
+++ b/src/Util.Ui.NgZorro/Components/Buttons/Renders/ARender.cs
@@ -1,58 +1,58 @@
-using Util.Ui.Builders;
-using Util.Ui.NgZorro.Components.Forms.Configs;
-using Util.Ui.NgZorro.Components.Links.Builders;
-using Util.Ui.Renders;
-
-namespace Util.Ui.NgZorro.Components.Links.Renders;
-
-///
-/// 链接渲染器
-///
-public class ARender : RenderBase {
- ///
- /// 配置
- ///
- private readonly Config _config;
-
- ///
- /// 初始化链接渲染器
- ///
- /// 配置
- public ARender( Config config ) {
- _config = config;
- }
-
- ///
- /// 获取标签生成器
- ///
- protected override TagBuilder GetTagBuilder() {
- if ( IsHide() )
- return new EmptyTagBuilder();
- var builder = new ABuilder( _config );
- builder.Config();
- return builder;
- }
-
- ///
- /// 是否隐藏标签
- ///
- private bool IsHide() {
- var isSearch = _config.GetValue( UiConst.IsSearch );
- if ( isSearch != true )
- return false;
- var formShareConfig = GetFormShareConfig();
- return formShareConfig.GetConditionCount() <= formShareConfig.SearchFormShowNumber;
- }
-
- ///
- /// 获取表单共享配置
- ///
- public FormShareConfig GetFormShareConfig() {
- return _config.GetValueFromItems() ?? new FormShareConfig();
- }
-
- ///
- public override IHtmlContent Clone() {
- return new ARender( _config.Copy() );
- }
+using Util.Ui.Builders;
+using Util.Ui.NgZorro.Components.Buttons.Builders;
+using Util.Ui.NgZorro.Components.Forms.Configs;
+using Util.Ui.Renders;
+
+namespace Util.Ui.NgZorro.Components.Buttons.Renders;
+
+///
+/// 链接渲染器
+///
+public class ARender : RenderBase {
+ ///
+ /// 配置
+ ///
+ private readonly Config _config;
+
+ ///
+ /// 初始化链接渲染器
+ ///
+ /// 配置
+ public ARender( Config config ) {
+ _config = config;
+ }
+
+ ///
+ /// 获取标签生成器
+ ///
+ protected override TagBuilder GetTagBuilder() {
+ if ( IsHide() )
+ return new EmptyTagBuilder();
+ var builder = new ABuilder( _config );
+ builder.Config();
+ return builder;
+ }
+
+ ///
+ /// 是否隐藏标签
+ ///
+ private bool IsHide() {
+ var isSearch = _config.GetValue( UiConst.IsSearch );
+ if ( isSearch != true )
+ return false;
+ var formShareConfig = GetFormShareConfig();
+ return formShareConfig.GetConditionCount() <= formShareConfig.SearchFormShowNumber;
+ }
+
+ ///
+ /// 获取表单共享配置
+ ///
+ private FormShareConfig GetFormShareConfig() {
+ return _config.GetValueFromItems() ?? new FormShareConfig();
+ }
+
+ ///
+ public override IHtmlContent Clone() {
+ return new ARender( _config.Copy() );
+ }
}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Components/Buttons/Renders/ButtonRender.cs b/src/Util.Ui.NgZorro/Components/Buttons/Renders/ButtonRender.cs
index f865a4291..e45e6ef8f 100644
--- a/src/Util.Ui.NgZorro/Components/Buttons/Renders/ButtonRender.cs
+++ b/src/Util.Ui.NgZorro/Components/Buttons/Renders/ButtonRender.cs
@@ -1,10 +1,10 @@
using Util.Ui.Builders;
using Util.Ui.NgZorro.Components.Buttons.Builders;
-using Util.Ui.NgZorro.Components.Links.Builders;
+using Util.Ui.NgZorro.Components.Forms.Configs;
using Util.Ui.NgZorro.Enums;
using Util.Ui.Renders;
-namespace Util.Ui.NgZorro.Components.Buttons.Renders;
+namespace Util.Ui.NgZorro.Components.Buttons.Renders;
///
/// 按钮渲染器
@@ -37,9 +37,11 @@ protected override TagBuilder GetTagBuilder() {
/// 创建标签生成器
///
private TagBuilder CreateTagBuilder() {
- if( GetButtonType() == ButtonType.Link )
- return new ABuilder( _config );
- return new ButtonBuilder( _config );
+ if ( GetButtonType() != ButtonType.Link )
+ return new ButtonBuilder( _config );
+ if ( IsHide() )
+ return new EmptyTagBuilder();
+ return new ABuilder( _config );
}
///
@@ -49,6 +51,24 @@ private TagBuilder CreateTagBuilder() {
return _config.GetValue( UiConst.Type );
}
+ ///
+ /// 是否隐藏标签
+ ///
+ private bool IsHide() {
+ var isSearch = _config.GetValue( UiConst.IsSearch );
+ if ( isSearch != true )
+ return false;
+ var formShareConfig = GetFormShareConfig();
+ return formShareConfig.GetConditionCount() <= formShareConfig.SearchFormShowNumber;
+ }
+
+ ///
+ /// 获取表单共享配置
+ ///
+ private FormShareConfig GetFormShareConfig() {
+ return _config.GetValueFromItems() ?? new FormShareConfig();
+ }
+
///
public override IHtmlContent Clone() {
return new ButtonRender( _config.Copy() );
diff --git a/src/Util.Ui.NgZorro/Components/Cards/Builders/CardBuilder.cs b/src/Util.Ui.NgZorro/Components/Cards/Builders/CardBuilder.cs
index 9834f12e7..3d07bd435 100644
--- a/src/Util.Ui.NgZorro/Components/Cards/Builders/CardBuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/Cards/Builders/CardBuilder.cs
@@ -5,7 +5,7 @@
using Util.Ui.NgZorro.Enums;
using Util.Ui.NgZorro.Extensions;
-namespace Util.Ui.NgZorro.Components.Cards.Builders;
+namespace Util.Ui.NgZorro.Components.Cards.Builders;
///
/// 卡片标签生成器
@@ -20,7 +20,7 @@ public class CardBuilder : AngularTagBuilder {
/// 初始化卡片标签生成器
///
/// 配置
- public CardBuilder( Config config ) : base( config,"nz-card" ) {
+ public CardBuilder( Config config ) : base( config, "nz-card" ) {
_config = config;
}
@@ -106,7 +106,7 @@ public CardBuilder Loading() {
///
public CardBuilder Type() {
var type = _config.GetValue( UiConst.Type );
- if( type == CardType.Inner )
+ if ( type == CardType.Inner )
Attribute( "nzType", "inner" );
AttributeIfNotEmpty( "[nzType]", _config.GetValue( AngularConst.BindType ) );
return this;
@@ -136,6 +136,7 @@ public override void Config() {
base.Config();
Title().Actions().BodyStyle().Borderless().Cover().Extra()
.Hoverable().Loading().Type().Size()
+ .SpaceItem( _config )
.Event();
}
}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Components/Cards/CardTagHelper.cs b/src/Util.Ui.NgZorro/Components/Cards/CardTagHelper.cs
index 0e536109a..a1d3d6302 100644
--- a/src/Util.Ui.NgZorro/Components/Cards/CardTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/Cards/CardTagHelper.cs
@@ -64,6 +64,10 @@ public class CardTagHelper : AngularTagHelperBase {
///
public string BindSize { get; set; }
///
+ /// *nzSpaceItem,值为 true 时设置为间距项,放入 <util-space> 中使用
+ ///
+ public bool SpaceItem { get; set; }
+ ///
/// (click),单击事件
///
public string OnClick { get; set; }
diff --git a/src/Util.Ui.NgZorro/Components/Checkboxes/Renders/CheckboxRender.cs b/src/Util.Ui.NgZorro/Components/Checkboxes/Renders/CheckboxRender.cs
index fde21f97b..40adf9645 100644
--- a/src/Util.Ui.NgZorro/Components/Checkboxes/Renders/CheckboxRender.cs
+++ b/src/Util.Ui.NgZorro/Components/Checkboxes/Renders/CheckboxRender.cs
@@ -1,5 +1,4 @@
using Util.Ui.Builders;
-using Util.Ui.Configs;
using Util.Ui.Extensions;
using Util.Ui.NgZorro.Components.Base;
using Util.Ui.NgZorro.Components.Checkboxes.Builders;
diff --git a/src/Util.Ui.NgZorro/Components/Checkboxes/Renders/CheckboxWrapperRender.cs b/src/Util.Ui.NgZorro/Components/Checkboxes/Renders/CheckboxWrapperRender.cs
index 5f08367b8..f865bb070 100644
--- a/src/Util.Ui.NgZorro/Components/Checkboxes/Renders/CheckboxWrapperRender.cs
+++ b/src/Util.Ui.NgZorro/Components/Checkboxes/Renders/CheckboxWrapperRender.cs
@@ -1,5 +1,4 @@
using Util.Ui.Builders;
-using Util.Ui.Configs;
using Util.Ui.Extensions;
using Util.Ui.NgZorro.Components.Base;
using Util.Ui.NgZorro.Components.Checkboxes.Builders;
diff --git a/src/Util.Ui.NgZorro/Components/Containers/Builders/ContainerBuilder.cs b/src/Util.Ui.NgZorro/Components/Containers/Builders/ContainerBuilder.cs
index 38d6dd282..4ee03049b 100644
--- a/src/Util.Ui.NgZorro/Components/Containers/Builders/ContainerBuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/Containers/Builders/ContainerBuilder.cs
@@ -1,4 +1,6 @@
using Util.Ui.Angular.Builders;
+using Util.Ui.Angular.Configs;
+using Util.Ui.NgZorro.Extensions;
namespace Util.Ui.NgZorro.Components.Containers.Builders;
@@ -19,6 +21,14 @@ public ContainerBuilder( Config config ) : base( config, "ng-container" ) {
_config = config;
}
+ ///
+ /// 配置模板出口
+ ///
+ public ContainerBuilder NgTemplateOutlet() {
+ AttributeIfNotEmpty( "*ngTemplateOutlet", _config.GetValue( AngularConst.NgTemplateOutlet ) );
+ return this;
+ }
+
///
/// 配置提及建议
///
@@ -32,6 +42,6 @@ public ContainerBuilder MentionSuggestion() {
///
public override void Config() {
base.Config();
- MentionSuggestion();
+ NgTemplateOutlet().MentionSuggestion().SpaceItem( _config );
}
}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Components/Containers/ContainerTagHelper.cs b/src/Util.Ui.NgZorro/Components/Containers/ContainerTagHelper.cs
index d4e04f539..6b4af6e1e 100644
--- a/src/Util.Ui.NgZorro/Components/Containers/ContainerTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/Containers/ContainerTagHelper.cs
@@ -11,9 +11,17 @@ namespace Util.Ui.NgZorro.Components.Containers;
[HtmlTargetElement( "util-container" )]
public class ContainerTagHelper : AngularTagHelperBase {
///
- /// *nzMentionSuggestion,提及建议渲染模板,范例: *nzMentionSuggestion="let item"
+ /// *ngTemplateOutlet,模板出口
+ ///
+ public string NgTemplateOutlet { get; set; }
+ ///
+ /// *nzMentionSuggestion,提及建议渲染模板
///
public string MentionSuggestion { get; set; }
+ ///
+ /// *nzSpaceItem,值为 true 时设置为间距项,放入 <util-space> 中使用
+ ///
+ public bool SpaceItem { get; set; }
///
protected override IRender GetRender( TagHelperContext context, TagHelperOutput output, TagHelperContent content ) {
diff --git a/src/Util.Ui.NgZorro/Components/Dividers/Builders/DividerBuilder.cs b/src/Util.Ui.NgZorro/Components/Dividers/Builders/DividerBuilder.cs
index 246839c6a..227f15fdd 100644
--- a/src/Util.Ui.NgZorro/Components/Dividers/Builders/DividerBuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/Dividers/Builders/DividerBuilder.cs
@@ -50,8 +50,6 @@ public DividerBuilder Type() {
/// 配置文字
///
public DividerBuilder Text() {
- if ( _config.Content.IsEmpty() == false )
- return this;
SetText( _config.GetValue( UiConst.Text ) );
AttributeIfNotEmpty( "[nzText]", _config.GetValue( AngularConst.BindText ) );
return this;
diff --git a/src/Util.Ui.NgZorro/Components/Dropdowns/Builders/DropdownMenuBuilder.cs b/src/Util.Ui.NgZorro/Components/Dropdowns/Builders/DropdownMenuBuilder.cs
index 580bb2195..95d073eaa 100644
--- a/src/Util.Ui.NgZorro/Components/Dropdowns/Builders/DropdownMenuBuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/Dropdowns/Builders/DropdownMenuBuilder.cs
@@ -2,6 +2,7 @@
using Util.Ui.Angular.Configs;
using Util.Ui.Builders;
using Util.Ui.Extensions;
+using Util.Ui.NgZorro.Components.Dropdowns.Configs;
namespace Util.Ui.NgZorro.Components.Dropdowns.Builders;
@@ -35,8 +36,8 @@ protected override void ConfigId( Config config ) {
/// 配置内容元素
///
protected override void ConfigContent( Config config ) {
- var notCreateUl = config.GetValue( UiConst.NotCreateUl );
- if ( notCreateUl == true ) {
+ var shareConfig = GetShareConfig();
+ if ( shareConfig.AutoCreateUl == false ) {
config.Content.AppendTo( this );
return;
}
@@ -47,6 +48,13 @@ protected override void ConfigContent( Config config ) {
_config.Content.AppendTo( ulBuilder );
}
+ ///
+ /// 获取下拉菜单共享配置
+ ///
+ private DropdownMenuShareConfig GetShareConfig() {
+ return _config.GetValueFromItems() ?? new DropdownMenuShareConfig();
+ }
+
///
/// 创建ul标签生成器
///
diff --git a/src/Util.Ui.NgZorro/Components/Dropdowns/Configs/DropdownMenuShareConfig.cs b/src/Util.Ui.NgZorro/Components/Dropdowns/Configs/DropdownMenuShareConfig.cs
new file mode 100644
index 000000000..864e88132
--- /dev/null
+++ b/src/Util.Ui.NgZorro/Components/Dropdowns/Configs/DropdownMenuShareConfig.cs
@@ -0,0 +1,11 @@
+namespace Util.Ui.NgZorro.Components.Dropdowns.Configs;
+
+///
+/// 下拉菜单共享配置
+///
+public class DropdownMenuShareConfig {
+ ///
+ /// 自动创建 ul
+ ///
+ public bool? AutoCreateUl { get; set; }
+}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Components/Dropdowns/DropdownMenuTagHelper.cs b/src/Util.Ui.NgZorro/Components/Dropdowns/DropdownMenuTagHelper.cs
index c792b664e..63fe20280 100644
--- a/src/Util.Ui.NgZorro/Components/Dropdowns/DropdownMenuTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/Dropdowns/DropdownMenuTagHelper.cs
@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Razor.TagHelpers;
using Util.Ui.Angular.TagHelpers;
+using Util.Ui.NgZorro.Components.Dropdowns.Helpers;
using Util.Ui.NgZorro.Components.Dropdowns.Renders;
using Util.Ui.Renders;
@@ -11,21 +12,29 @@ namespace Util.Ui.NgZorro.Components.Dropdowns;
[HtmlTargetElement( "util-dropdown-menu" )]
public class DropdownMenuTagHelper : AngularTagHelperBase {
///
- /// [nzSelectable],是否允许选中,默认值:false,注意:该属性设置在<ul nz-menu></ul>上
+ /// 配置
///
- public string Selectable { get; set; }
+ private Config _config;
+
///
- /// 默认情况下会创建<ul nz-menu></ul>,设置为 true 则不会创建ul标签,生成的下拉菜单标签为 <nz-dropdown-menu></nz-dropdown-menu>
+ /// [nzSelectable],是否允许选中,默认值:false,注意:该属性设置在<ul nz-menu></ul>上
///
- public bool NotCreateUl { get; set; }
+ public string Selectable { get; set; }
///
/// (nzClick),单击菜单项事件处理函数,注意:该属性设置在<ul nz-menu></ul>上
///
public string OnClick { get; set; }
+ ///
+ protected override void ProcessBefore( TagHelperContext context, TagHelperOutput output ) {
+ _config = new Config( context, output );
+ var service = new DropdownMenuService( _config );
+ service.Init();
+ }
+
///
protected override IRender GetRender( TagHelperContext context, TagHelperOutput output, TagHelperContent content ) {
- var config = new Config( context, output, content );
- return new DropdownMenuRender( config );
+ _config.Content = content;
+ return new DropdownMenuRender( _config );
}
}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Components/Dropdowns/Helpers/DropdownMenuService.cs b/src/Util.Ui.NgZorro/Components/Dropdowns/Helpers/DropdownMenuService.cs
new file mode 100644
index 000000000..5a7679a88
--- /dev/null
+++ b/src/Util.Ui.NgZorro/Components/Dropdowns/Helpers/DropdownMenuService.cs
@@ -0,0 +1,57 @@
+using Util.Ui.NgZorro.Components.Dropdowns.Configs;
+
+namespace Util.Ui.NgZorro.Components.Dropdowns.Helpers;
+
+///
+/// 下拉菜单共享服务
+///
+public class DropdownMenuService {
+ ///
+ /// 配置
+ ///
+ private readonly Config _config;
+ ///
+ /// 下拉菜单共享配置
+ ///
+ private DropdownMenuShareConfig _shareConfig;
+
+ ///
+ /// 初始化表单项共享服务
+ ///
+ /// 配置
+ public DropdownMenuService( Config config ) {
+ _config = config;
+ }
+
+ ///
+ /// 设置自动创建 ul
+ ///
+ /// 是否自动创建
+ public void AutoCreateUl( bool value ) {
+ if ( _shareConfig.AutoCreateUl == false )
+ return;
+ _shareConfig.AutoCreateUl = value;
+ }
+
+ ///
+ /// 初始化
+ ///
+ public void Init() {
+ InitShareConfig();
+ }
+
+ ///
+ /// 初始化
+ ///
+ private void InitShareConfig() {
+ _shareConfig = GetShareConfig();
+ _config.SetValueToItems( _shareConfig );
+ }
+
+ ///
+ /// 获取下拉菜单共享配置
+ ///
+ private DropdownMenuShareConfig GetShareConfig() {
+ return _config.GetValueFromItems() ?? new DropdownMenuShareConfig();
+ }
+}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Components/Dropdowns/Renders/DropdownMenuRender.cs b/src/Util.Ui.NgZorro/Components/Dropdowns/Renders/DropdownMenuRender.cs
index e8334ffbf..80714c958 100644
--- a/src/Util.Ui.NgZorro/Components/Dropdowns/Renders/DropdownMenuRender.cs
+++ b/src/Util.Ui.NgZorro/Components/Dropdowns/Renders/DropdownMenuRender.cs
@@ -1,5 +1,4 @@
using Util.Ui.Builders;
-using Util.Ui.Configs;
using Util.Ui.NgZorro.Components.Dropdowns.Builders;
using Util.Ui.Renders;
diff --git a/src/Util.Ui.NgZorro/Components/Forms/Configs/FormItemShareConfig.cs b/src/Util.Ui.NgZorro/Components/Forms/Configs/FormItemShareConfig.cs
index acc173500..66777535e 100644
--- a/src/Util.Ui.NgZorro/Components/Forms/Configs/FormItemShareConfig.cs
+++ b/src/Util.Ui.NgZorro/Components/Forms/Configs/FormItemShareConfig.cs
@@ -9,6 +9,10 @@ public class FormItemShareConfig : FormShareConfig {
///
public string Id { get; set; }
///
+ /// nz-form-item 已创建
+ ///
+ public bool FormItemCreated { get; set; }
+ ///
/// 自动创建nz-form-item
///
public bool? AutoCreateFormItem { get; set; }
@@ -33,9 +37,9 @@ public class FormItemShareConfig : FormShareConfig {
///
public string BindLabelText { get; set; }
///
- /// 是否间距项
+ /// [nzErrorTip]
///
- public bool SpaceItem { get; set; }
+ public string BindErrorTip { get; set; }
///
/// 是否存在额外提示
///
@@ -73,7 +77,7 @@ public class FormItemShareConfig : FormShareConfig {
///
public string NgIf { get; set; }
///
- /// [nzErrorTip]
+ /// 是否间距项
///
- public string BindErrorTip { get; set; }
+ public bool SpaceItem { get; set; }
}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Components/Forms/FormItemTagHelper.cs b/src/Util.Ui.NgZorro/Components/Forms/FormItemTagHelper.cs
index a68e98add..e0184c5e0 100644
--- a/src/Util.Ui.NgZorro/Components/Forms/FormItemTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/Forms/FormItemTagHelper.cs
@@ -22,6 +22,7 @@ protected override void ProcessBefore( TagHelperContext context, TagHelperOutput
var service = new FormItemShareService( _config );
service.Init();
service.AutoCreateFormItem( false );
+ service.Created();
}
///
diff --git a/src/Util.Ui.NgZorro/Components/Forms/Helpers/FormItemShareService.cs b/src/Util.Ui.NgZorro/Components/Forms/Helpers/FormItemShareService.cs
index cabc3e89f..2eec3cb5c 100644
--- a/src/Util.Ui.NgZorro/Components/Forms/Helpers/FormItemShareService.cs
+++ b/src/Util.Ui.NgZorro/Components/Forms/Helpers/FormItemShareService.cs
@@ -25,6 +25,13 @@ public FormItemShareService( Config config ) {
_config = config;
}
+ ///
+ /// 设置 nz-form-item 已创建
+ ///
+ public void Created() {
+ _shareConfig.FormItemCreated = true;
+ }
+
///
/// 初始化控件Id
///
diff --git a/src/Util.Ui.NgZorro/Components/Icons/Builders/IconBuilder.cs b/src/Util.Ui.NgZorro/Components/Icons/Builders/IconBuilder.cs
index 98ac53fc8..89a908e69 100644
--- a/src/Util.Ui.NgZorro/Components/Icons/Builders/IconBuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/Icons/Builders/IconBuilder.cs
@@ -7,7 +7,7 @@
using Util.Ui.NgZorro.Directives.Tooltips;
using Util.Ui.NgZorro.Enums;
-namespace Util.Ui.NgZorro.Components.Icons.Builders;
+namespace Util.Ui.NgZorro.Components.Icons.Builders;
///
/// 图标标签生成器
@@ -34,7 +34,7 @@ public IconBuilder Icon() {
AttributeIfNotEmpty( "nzType", _config.GetValue( UiConst.Icon )?.Description() );
return this;
}
-
+
///
/// 配置图标类型
///
@@ -49,7 +49,7 @@ public IconBuilder Type() {
public IconBuilder Type( AntDesignIcon? type ) {
return Type( type?.Description() );
}
-
+
///
/// 配置图标类型
///
@@ -81,7 +81,7 @@ public IconBuilder Theme() {
public IconBuilder Theme( IconTheme? theme ) {
return Theme( theme?.Description() );
}
-
+
///
/// 配置图标主题
///
@@ -104,7 +104,10 @@ public IconBuilder BindTheme( string theme ) {
/// 配置双色图标主题色
///
public IconBuilder Color() {
- if( _config.Contains( AntDesignConst.TwotoneColor ) || _config.Contains( AntDesignConst.BindTwotoneColor ) )
+ var value = _config.GetValue( AntDesignConst.TwotoneColorType )?.Description();
+ if ( value.IsEmpty() == false )
+ _config.SetAttribute( AntDesignConst.TwotoneColor, value );
+ if ( _config.Contains( AntDesignConst.TwotoneColor ) || _config.Contains( AntDesignConst.BindTwotoneColor ) )
Attribute( "nzTheme", IconTheme.Twotone.Description() );
AttributeIfNotEmpty( "nzTwotoneColor", _config.GetValue( AntDesignConst.TwotoneColor ) );
AttributeIfNotEmpty( "[nzTwotoneColor]", _config.GetValue( AntDesignConst.BindTwotoneColor ) );
diff --git a/src/Util.Ui.NgZorro/Components/Icons/IconTagHelper.cs b/src/Util.Ui.NgZorro/Components/Icons/IconTagHelper.cs
index 6ba3766eb..455cc51dd 100644
--- a/src/Util.Ui.NgZorro/Components/Icons/IconTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/Icons/IconTagHelper.cs
@@ -36,6 +36,10 @@ public class IconTagHelper : TooltipTagHelperBase {
///
public string Rotate { get; set; }
///
+ /// nzTwotoneColor,扩展属性, 双色图标主题色,注意:仅适用双色图标主题
+ ///
+ public AntDesignColor TwotoneColorType { get; set; }
+ ///
/// nzTwotoneColor,双色图标主题色,注意:仅适用双色图标主题
///
public string TwotoneColor { get; set; }
diff --git a/src/Util.Ui.NgZorro/Components/Inputs/Builders/InputBuilder.cs b/src/Util.Ui.NgZorro/Components/Inputs/Builders/InputBuilder.cs
index 0b8821336..bbdc1c639 100644
--- a/src/Util.Ui.NgZorro/Components/Inputs/Builders/InputBuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/Inputs/Builders/InputBuilder.cs
@@ -2,6 +2,7 @@
using Util.Ui.NgZorro.Enums;
using Util.Ui.NgZorro.Components.Base;
using Util.Ui.NgZorro.Components.Inputs.Configs;
+using Util.Ui.NgZorro.Extensions;
namespace Util.Ui.NgZorro.Components.Inputs.Builders;
@@ -64,7 +65,7 @@ private void SetSize() {
var shareConfig = GetInputGroupShareConfig();
if ( shareConfig.Size == null )
return;
- if ( shareConfig.IsInputGroupCreated )
+ if ( shareConfig.InputGroupCreated )
return;
AttributeIfNotEmpty( "nzSize", shareConfig.Size?.Description() );
}
@@ -76,7 +77,7 @@ private void SetBindSize() {
var shareConfig = GetInputGroupShareConfig();
if ( shareConfig.BindSize.IsEmpty() )
return;
- if ( shareConfig.IsInputGroupCreated )
+ if ( shareConfig.InputGroupCreated )
return;
AttributeIfNotEmpty( "[nzSize]", shareConfig.BindSize );
}
@@ -97,7 +98,7 @@ private void SetStatus() {
var shareConfig = GetInputGroupShareConfig();
if ( shareConfig.Status == null )
return;
- if ( shareConfig.IsInputGroupCreated )
+ if ( shareConfig.InputGroupCreated )
return;
AttributeIfNotEmpty( "nzStatus", shareConfig.Status?.Description() );
}
@@ -109,7 +110,7 @@ private void SetBindStatus() {
var shareConfig = GetInputGroupShareConfig();
if ( shareConfig.BindStatus.IsEmpty() )
return;
- if ( shareConfig.IsInputGroupCreated )
+ if ( shareConfig.InputGroupCreated )
return;
AttributeIfNotEmpty( "[nzStatus]", shareConfig.BindStatus );
}
@@ -179,7 +180,9 @@ public override InputBuilder Required() {
///
public InputBuilder Events() {
OnInput( _config.GetValue( UiConst.OnInput ) );
- OnEnter( _config.GetValue( UiConst.OnEnter ) );
+ AttributeIfNotEmpty( "(blur)", _config.GetValue( UiConst.OnBlur ) );
+ AttributeIfNotEmpty( "(keyup.enter)", _config.GetValue( UiConst.OnKeyupEnter ) );
+ AttributeIfNotEmpty( "(keydown.enter)", _config.GetValue( UiConst.OnKeydownEnter ) );
return this;
}
@@ -191,14 +194,6 @@ public InputBuilder OnInput( string value ) {
return this;
}
- ///
- /// 回车事件
- ///
- public InputBuilder OnEnter( string value ) {
- AttributeIfNotEmpty( "(keyup.enter)", value );
- return this;
- }
-
///
/// 配置
///
@@ -210,4 +205,17 @@ public override void Config() {
.ValidatePhone().ValidateIdCard()
.Events().AutocompleteOff();
}
+
+ ///
+ /// 配置间距项
+ ///
+ public override InputBuilder SpaceItem() {
+ if ( FormItemShareConfig.FormItemCreated )
+ return this;
+ var inputGroupShareConfig = GetInputGroupShareConfig();
+ if ( inputGroupShareConfig.InputGroupCreated )
+ return this;
+ this.SpaceItem( FormItemShareConfig.SpaceItem );
+ return this;
+ }
}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Components/Inputs/Builders/InputGroupBuilder.cs b/src/Util.Ui.NgZorro/Components/Inputs/Builders/InputGroupBuilder.cs
index 96ff973c5..50d1d8f15 100644
--- a/src/Util.Ui.NgZorro/Components/Inputs/Builders/InputGroupBuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/Inputs/Builders/InputGroupBuilder.cs
@@ -6,6 +6,8 @@
using Util.Ui.Builders;
using Util.Ui.NgZorro.Components.Icons.Builders;
using Util.Ui.NgZorro.Components.Templates.Builders;
+using Util.Ui.NgZorro.Extensions;
+using Util.Ui.NgZorro.Components.Forms.Configs;
namespace Util.Ui.NgZorro.Components.Inputs.Builders;
@@ -191,6 +193,24 @@ public InputGroupBuilder Compact() {
return this;
}
+ ///
+ /// 配置间距项
+ ///
+ public InputGroupBuilder SpaceItem() {
+ var formItemShareConfig = GetShareConfig();
+ if ( formItemShareConfig.FormItemCreated )
+ return this;
+ this.SpaceItem( formItemShareConfig.SpaceItem );
+ return this;
+ }
+
+ ///
+ /// 获取表单项共享配置
+ ///
+ private FormItemShareConfig GetShareConfig() {
+ return _config.GetValueFromItems() ?? new FormItemShareConfig();
+ }
+
///
/// 配置
///
@@ -198,9 +218,9 @@ public override void Config() {
base.ConfigBase( _config );
AddOnBefore().AddOnAfter().AddOnBeforeIcon().AddOnAfterIcon()
.Prefix().Suffix().PrefixIcon().SuffixIcon()
- .Search().Size().Status().Compact();
+ .Search().Size().Status().Compact().SpaceItem();
Class( _shareConfig.Class );
- PostBuilder = GetSuffixTemplate();
+ AppendContent( GetSuffixTemplate() );
}
///
diff --git a/src/Util.Ui.NgZorro/Components/Inputs/Builders/TextareaBuilder.cs b/src/Util.Ui.NgZorro/Components/Inputs/Builders/TextareaBuilder.cs
index 00e9537d8..59c776dcb 100644
--- a/src/Util.Ui.NgZorro/Components/Inputs/Builders/TextareaBuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/Inputs/Builders/TextareaBuilder.cs
@@ -1,7 +1,9 @@
using Util.Ui.Angular.Configs;
using Util.Ui.NgZorro.Components.Base;
+using Util.Ui.NgZorro.Components.Inputs.Configs;
using Util.Ui.NgZorro.Components.Inputs.Helpers;
using Util.Ui.NgZorro.Enums;
+using Util.Ui.NgZorro.Extensions;
namespace Util.Ui.NgZorro.Components.Inputs.Builders;
@@ -110,7 +112,9 @@ public TextareaBuilder Autocomplete() {
///
public TextareaBuilder Events() {
OnInput( _config.GetValue( UiConst.OnInput ) );
- OnEnter( _config.GetValue( UiConst.OnEnter ) );
+ AttributeIfNotEmpty( "(blur)", _config.GetValue( UiConst.OnBlur ) );
+ AttributeIfNotEmpty( "(keyup.enter)", _config.GetValue( UiConst.OnKeyupEnter ) );
+ AttributeIfNotEmpty( "(keydown.enter)", _config.GetValue( UiConst.OnKeydownEnter ) );
return this;
}
@@ -122,14 +126,6 @@ public TextareaBuilder OnInput( string value ) {
return this;
}
- ///
- /// 回车事件
- ///
- public TextareaBuilder OnEnter( string value ) {
- AttributeIfNotEmpty( "(keyup.enter)", value );
- return this;
- }
-
///
/// 配置
///
@@ -143,4 +139,24 @@ public override void Config() {
.MaxLength()
.ValidationExtend().AutocompleteOff();
}
+
+ ///
+ /// 配置间距项
+ ///
+ public override TextareaBuilder SpaceItem() {
+ if ( FormItemShareConfig.FormItemCreated )
+ return this;
+ var inputGroupShareConfig = GetInputGroupShareConfig();
+ if ( inputGroupShareConfig.InputGroupCreated )
+ return this;
+ this.SpaceItem( FormItemShareConfig.SpaceItem );
+ return this;
+ }
+
+ ///
+ /// 获取输入框组合共享配置
+ ///
+ private InputGroupShareConfig GetInputGroupShareConfig() {
+ return _config.GetValueFromItems() ?? new InputGroupShareConfig();
+ }
}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Components/Inputs/Configs/InputGroupShareConfig.cs b/src/Util.Ui.NgZorro/Components/Inputs/Configs/InputGroupShareConfig.cs
index 11fa859e7..312925023 100644
--- a/src/Util.Ui.NgZorro/Components/Inputs/Configs/InputGroupShareConfig.cs
+++ b/src/Util.Ui.NgZorro/Components/Inputs/Configs/InputGroupShareConfig.cs
@@ -9,7 +9,7 @@ public class InputGroupShareConfig {
///
/// 是否已创建 nz-input-group
///
- public bool IsInputGroupCreated { get; set; }
+ public bool InputGroupCreated { get; set; }
///
/// 自动创建nz-input-group
///
@@ -110,4 +110,8 @@ public class InputGroupShareConfig {
/// 样式类
///
public string Class { get; set; }
+ ///
+ /// ngIf*
+ ///
+ public string NgIf { get; set; }
}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Components/Inputs/Helpers/InputGroupShareService.cs b/src/Util.Ui.NgZorro/Components/Inputs/Helpers/InputGroupShareService.cs
index 38877cbcd..97ba36d39 100644
--- a/src/Util.Ui.NgZorro/Components/Inputs/Helpers/InputGroupShareService.cs
+++ b/src/Util.Ui.NgZorro/Components/Inputs/Helpers/InputGroupShareService.cs
@@ -30,7 +30,7 @@ public InputGroupShareService( Config config ) {
/// 设置nz-input-group已创建
///
public void Created() {
- _shareConfig.IsInputGroupCreated = true;
+ _shareConfig.InputGroupCreated = true;
}
///
@@ -66,6 +66,7 @@ public void Init() {
InitShareConfig();
SetShareConfig();
AutoCreateInputGroup();
+ SetNgIf();
}
///
@@ -211,4 +212,17 @@ private bool IsAutoCreateInputGroup() {
return true;
return false;
}
+
+ ///
+ /// 设置ngIf*
+ ///
+ private void SetNgIf() {
+ var value = _config.GetValueFromAttributes( AngularConst.NgIf );
+ if ( value.IsEmpty() )
+ return;
+ if ( _shareConfig.AllowClear == false )
+ return;
+ _shareConfig.NgIf = value;
+ _config.RemoveAttribute( AngularConst.NgIf );
+ }
}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Components/Inputs/Helpers/InputService.cs b/src/Util.Ui.NgZorro/Components/Inputs/Helpers/InputService.cs
index 16370efe1..45800791d 100644
--- a/src/Util.Ui.NgZorro/Components/Inputs/Helpers/InputService.cs
+++ b/src/Util.Ui.NgZorro/Components/Inputs/Helpers/InputService.cs
@@ -13,7 +13,7 @@ public class InputService {
///
/// 输入框组样式类
///
- private string _inputGroupClass;
+ private readonly string _inputGroupClass;
///
/// 初始化输入框服务
diff --git a/src/Util.Ui.NgZorro/Components/Inputs/InputTagHelper.cs b/src/Util.Ui.NgZorro/Components/Inputs/InputTagHelper.cs
index dfcea8565..ebd9c5301 100644
--- a/src/Util.Ui.NgZorro/Components/Inputs/InputTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/Inputs/InputTagHelper.cs
@@ -189,9 +189,17 @@ public class InputTagHelper : FormControlTagHelperBase {
///
public string OnInput { get; set; }
///
- /// (keyup.enter),按下回车键事件
+ /// (blur),失去焦点事件
///
- public string OnEnter { get; set; }
+ public string OnBlur { get; set; }
+ ///
+ /// (keyup.enter),按下回车键事件,按键被松开时触发
+ ///
+ public string OnKeyupEnter { get; set; }
+ ///
+ /// (keydown.enter),按下回车键事件,按键被按下时触发
+ ///
+ public string OnKeydownEnter { get; set; }
///
protected override void ProcessBefore( TagHelperContext context, TagHelperOutput output ) {
diff --git a/src/Util.Ui.NgZorro/Components/Inputs/Renders/InputGroupRender.cs b/src/Util.Ui.NgZorro/Components/Inputs/Renders/InputGroupRender.cs
index 8e6fc07e1..9b0adb9d1 100644
--- a/src/Util.Ui.NgZorro/Components/Inputs/Renders/InputGroupRender.cs
+++ b/src/Util.Ui.NgZorro/Components/Inputs/Renders/InputGroupRender.cs
@@ -1,9 +1,13 @@
-using Util.Ui.Builders;
+using Util.Ui.Angular.Configs;
+using Util.Ui.Angular.Extensions;
+using Util.Ui.Builders;
using Util.Ui.Extensions;
using Util.Ui.NgZorro.Components.Base;
+using Util.Ui.NgZorro.Components.Containers.Builders;
using Util.Ui.NgZorro.Components.Inputs.Builders;
+using Util.Ui.NgZorro.Components.Inputs.Configs;
-namespace Util.Ui.NgZorro.Components.Inputs.Renders;
+namespace Util.Ui.NgZorro.Components.Inputs.Renders;
///
/// 输入框组合渲染器
@@ -26,10 +30,36 @@ public InputGroupRender( Config config ) : base( config ) {
/// 添加表单控件
///
protected override void AppendControl( TagBuilder formControlBuilder ) {
+ var container = GetContainerBuilder();
var builder = new InputGroupBuilder( _config );
builder.Config();
_config.Content.AppendTo( builder );
- formControlBuilder.AppendContent( builder );
+ container.AppendContent( builder );
+ formControlBuilder.AppendContent( container );
+ }
+
+ ///
+ /// 获取容器生成器
+ ///
+ public TagBuilder GetContainerBuilder() {
+ TagBuilder container = new EmptyContainerTagBuilder();
+ var ngIf = _config.GetValue( AngularConst.NgIf );
+ var shareConfig = GetInputGroupShareConfig();
+ if ( ngIf.IsEmpty() )
+ ngIf = shareConfig.NgIf;
+ if ( ngIf.IsEmpty() )
+ return container;
+ _config.RemoveAttribute( AngularConst.NgIf );
+ container = new ContainerBuilder( _config );
+ container.NgIf( ngIf );
+ return container;
+ }
+
+ ///
+ /// 获取输入框组合共享配置
+ ///
+ private InputGroupShareConfig GetInputGroupShareConfig() {
+ return _config.GetValueFromItems() ?? new InputGroupShareConfig();
}
///
diff --git a/src/Util.Ui.NgZorro/Components/Inputs/Renders/InputRenderBase.cs b/src/Util.Ui.NgZorro/Components/Inputs/Renders/InputRenderBase.cs
index 0932965fe..4e6b1650b 100644
--- a/src/Util.Ui.NgZorro/Components/Inputs/Renders/InputRenderBase.cs
+++ b/src/Util.Ui.NgZorro/Components/Inputs/Renders/InputRenderBase.cs
@@ -1,5 +1,8 @@
-using Util.Ui.Builders;
+using Util.Ui.Angular.Configs;
+using Util.Ui.Angular.Extensions;
+using Util.Ui.Builders;
using Util.Ui.NgZorro.Components.Base;
+using Util.Ui.NgZorro.Components.Containers.Builders;
using Util.Ui.NgZorro.Components.Inputs.Builders;
using Util.Ui.NgZorro.Components.Inputs.Configs;
using Util.Ui.NgZorro.Components.Mentions.Configs;
@@ -24,21 +27,40 @@ protected InputRenderBase( Config config ) : base( config ) {
_config = config;
}
+ ///
+ /// 初始化
+ ///
+ protected override void Init() {
+ SetControlId();
+ }
+
///
/// 添加表单控件
///
protected override void AppendControl( TagBuilder formControlBuilder ) {
+ var container = GetInputGroupContainerBuilder();
var inputGroup = GetInputGroup();
var input = GetInput();
inputGroup.AppendContent( input );
- formControlBuilder.AppendContent( inputGroup );
+ container.AppendContent( inputGroup );
+ formControlBuilder.AppendContent( container );
}
///
- /// 初始化
+ /// 获取容器生成器
///
- protected override void Init() {
- SetControlId();
+ public TagBuilder GetInputGroupContainerBuilder() {
+ TagBuilder container = new EmptyContainerTagBuilder();
+ var ngIf = _config.GetValue( AngularConst.NgIf );
+ var shareConfig = GetInputGroupShareConfig();
+ if ( ngIf.IsEmpty() )
+ ngIf = shareConfig.NgIf;
+ if ( ngIf.IsEmpty() )
+ return container;
+ _config.RemoveAttribute( AngularConst.NgIf );
+ container = new ContainerBuilder( _config );
+ container.NgIf( ngIf );
+ return container;
}
///
@@ -68,9 +90,9 @@ private bool IsPassword() {
/// 获取输入框组合
///
private TagBuilder GetInputGroup() {
- if (NeedCreateInputGroup()) {
+ if ( NeedCreateInputGroup() ) {
var shareConfig = GetInputGroupShareConfig();
- shareConfig.IsInputGroupCreated = true;
+ shareConfig.InputGroupCreated = true;
return GetInputGroupBuilder();
}
return new EmptyContainerTagBuilder();
@@ -87,7 +109,7 @@ protected virtual bool NeedCreateInputGroup() {
return true;
if ( IsAllowClear() )
return true;
- if( IsPassword() )
+ if ( IsPassword() )
return true;
return false;
}
@@ -139,7 +161,7 @@ protected string GetNgModelId() {
/// 是否需要导出ngModel
///
private bool NeedExportNgModel() {
- if( IsAllowClear() )
+ if ( IsAllowClear() )
return true;
return false;
}
@@ -159,7 +181,7 @@ private void AddInputExtendDirective( TagBuilder builder ) {
/// 是否需要添加输入框扩展指令
///
private bool NeedAddInputExtendDirective() {
- if( IsPassword() )
+ if ( IsPassword() )
return true;
return false;
}
@@ -179,7 +201,7 @@ private void AddPasswordType( TagBuilder builder ) {
///
private void ConfigMentionTrigger( TagBuilder builder ) {
var shareConfig = _config.GetValueFromItems();
- if( shareConfig == null )
+ if ( shareConfig == null )
return;
builder.Attribute( "nzMentionTrigger" );
}
diff --git a/src/Util.Ui.NgZorro/Components/Inputs/TextareaTagHelper.cs b/src/Util.Ui.NgZorro/Components/Inputs/TextareaTagHelper.cs
index f9f26800b..13b41f734 100644
--- a/src/Util.Ui.NgZorro/Components/Inputs/TextareaTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/Inputs/TextareaTagHelper.cs
@@ -105,9 +105,17 @@ public class TextareaTagHelper : FormControlTagHelperBase {
///
public string OnInput { get; set; }
///
- /// (keyup.enter),按下回车键事件
+ /// (blur),失去焦点事件
///
- public string OnEnter { get; set; }
+ public string OnBlur { get; set; }
+ ///
+ /// (keyup.enter),按下回车键事件,按键被松开时触发
+ ///
+ public string OnKeyupEnter { get; set; }
+ ///
+ /// (keydown.enter),按下回车键事件,按键被按下时触发
+ ///
+ public string OnKeydownEnter { get; set; }
///
/// 渲染前操作
diff --git a/src/Util.Ui.NgZorro/Components/Links/ATagHelper.cs b/src/Util.Ui.NgZorro/Components/Links/ATagHelper.cs
deleted file mode 100644
index d5469a262..000000000
--- a/src/Util.Ui.NgZorro/Components/Links/ATagHelper.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using Microsoft.AspNetCore.Razor.TagHelpers;
-using Util.Ui.Enums;
-using Util.Ui.NgZorro.Components.Base;
-using Util.Ui.NgZorro.Components.Links.Renders;
-using Util.Ui.Renders;
-
-namespace Util.Ui.NgZorro.Components.Links;
-
-///
-/// 链接,生成的标签为<a></a>
-///
-[HtmlTargetElement( "util-a" )]
-public class ATagHelper : ButtonTagHelperBase {
- ///
- /// href,链接地址
- ///
- public string Href { get; set; }
- ///
- /// [href],链接地址
- ///
- public string BindHref { get; set; }
- ///
- /// target,链接打开目标
- ///
- public ATarget Target { get; set; }
- ///
- /// [target],链接打开目标
- ///
- public string BindTarget { get; set; }
- ///
- /// rel,指定当前文档与被链接文档的关系
- ///
- public string Rel { get; set; }
- ///
- /// [rel],指定当前文档与被链接文档的关系
- ///
- public string BindRel { get; set; }
- ///
- /// 扩展属性,是否危险状态
- ///
- public bool Danger { get; set; }
- ///
- /// 扩展属性,是否查询表单链接,折叠时显示展开文本,展开时显示收起文本
- ///
- public bool IsSearch { get; set; }
- ///
- /// 扩展属性,显示表格设置,参数值为表格标识
- ///
- public string ShowTableSettings { get; set; }
-
- ///
- protected override IRender GetRender( TagHelperContext context, TagHelperOutput output, TagHelperContent content ) {
- var config = new Config( context, output, content );
- return new ARender( config );
- }
-}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Components/Menus/Builders/MenuGroupBuilder.cs b/src/Util.Ui.NgZorro/Components/Menus/Builders/MenuGroupBuilder.cs
index 45b71d66e..b69e37133 100644
--- a/src/Util.Ui.NgZorro/Components/Menus/Builders/MenuGroupBuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/Menus/Builders/MenuGroupBuilder.cs
@@ -2,6 +2,8 @@
using Util.Ui.Angular.Configs;
using Util.Ui.Builders;
using Util.Ui.Extensions;
+using Util.Ui.NgZorro.Configs;
+using Util.Ui.NgZorro.Extensions;
namespace Util.Ui.NgZorro.Components.Menus.Builders;
@@ -27,11 +29,23 @@ public MenuGroupBuilder( Config config ) : base( config,"li" ) {
/// 配置标题
///
public MenuGroupBuilder Title() {
- AttributeIfNotEmpty( "nzTitle", _config.GetValue( UiConst.Title ) );
+ SetTitle( _config.GetValue( UiConst.Title ) );
AttributeIfNotEmpty( "[nzTitle]", _config.GetValue( AngularConst.BindTitle ) );
return this;
}
+ ///
+ /// 设置标题
+ ///
+ private void SetTitle( string value ) {
+ var options = NgZorroOptionsService.GetOptions();
+ if ( options.EnableI18n ) {
+ this.AttributeByI18n( "[nzTitle]", value );
+ return;
+ }
+ AttributeIfNotEmpty( "nzTitle", value );
+ }
+
///
/// 配置
///
diff --git a/src/Util.Ui.NgZorro/Components/Menus/Builders/MenuItemBuilder.cs b/src/Util.Ui.NgZorro/Components/Menus/Builders/MenuItemBuilder.cs
index 0160a17fa..2b5cd8a6f 100644
--- a/src/Util.Ui.NgZorro/Components/Menus/Builders/MenuItemBuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/Menus/Builders/MenuItemBuilder.cs
@@ -2,9 +2,11 @@
using Util.Ui.Angular.Extensions;
using Util.Ui.NgZorro.Components.Icons.Builders;
using Util.Ui.NgZorro.Configs;
-using Util.Ui.NgZorro.Extensions;
+using Util.Ui.NgZorro.Directives.Popconfirms;
+using Util.Ui.NgZorro.Directives.Popover;
+using Util.Ui.NgZorro.Directives.Tooltips;
-namespace Util.Ui.NgZorro.Components.Menus.Builders;
+namespace Util.Ui.NgZorro.Components.Menus.Builders;
///
/// 菜单项标签生成器
@@ -18,7 +20,7 @@ public class MenuItemBuilder : AngularTagBuilder {
///
/// 初始化菜单项标签生成器
///
- public MenuItemBuilder( Config config ) : base( config,"li" ) {
+ public MenuItemBuilder( Config config ) : base( config, "li" ) {
_config = config;
base.Attribute( "nz-menu-item" );
}
@@ -112,10 +114,16 @@ public MenuItemBuilder Text() {
if ( text.IsEmpty() )
return this;
if ( options.EnableI18n ) {
- this.AppendContentByI18n( text );
+ var result = new StringBuilder();
+ result.Append( "" );
+ result.Append( "{{" );
+ result.Append( $"'{text}'|i18n" );
+ result.Append( "}}" );
+ result.Append( "" );
+ AppendContent( result.ToString() );
return this;
}
- AppendContent( text );
+ AppendContent( $"{text}" );
return this;
}
@@ -165,6 +173,14 @@ public MenuItemBuilder Icon() {
return this;
}
+ ///
+ /// 配置左内边距
+ ///
+ public MenuItemBuilder PaddingLeft() {
+ AttributeIfNotEmpty( "[nzPaddingLeft]", _config.GetValue( UiConst.PaddingLeft ) );
+ return this;
+ }
+
///
/// 配置事件
///
@@ -178,8 +194,10 @@ public MenuItemBuilder Events() {
///
public override void Config() {
base.Config();
+ this.Tooltip( _config ).Popover( _config ).Popconfirm( _config );
Icon();
TextUpdate().TextDelete().TextDetail().TextEnable().TextDisable().Text().
- Disabled().Selected().Danger().MatchRouter().Events();
+ Disabled().Selected().Danger().MatchRouter().PaddingLeft()
+ .Events();
}
}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Components/Menus/Builders/SubMenuBuilder.cs b/src/Util.Ui.NgZorro/Components/Menus/Builders/SubMenuBuilder.cs
index 3519c7eeb..33ffa8e8b 100644
--- a/src/Util.Ui.NgZorro/Components/Menus/Builders/SubMenuBuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/Menus/Builders/SubMenuBuilder.cs
@@ -2,7 +2,9 @@
using Util.Ui.Angular.Configs;
using Util.Ui.Builders;
using Util.Ui.Extensions;
+using Util.Ui.NgZorro.Configs;
using Util.Ui.NgZorro.Enums;
+using Util.Ui.NgZorro.Extensions;
namespace Util.Ui.NgZorro.Components.Menus.Builders;
@@ -28,11 +30,23 @@ public SubMenuBuilder( Config config ) : base( config,"li" ) {
/// 配置标题
///
public SubMenuBuilder Title() {
- AttributeIfNotEmpty( "nzTitle", _config.GetValue( UiConst.Title ) );
+ SetTitle( _config.GetValue( UiConst.Title ) );
AttributeIfNotEmpty( "[nzTitle]", _config.GetValue( AngularConst.BindTitle ) );
return this;
}
+ ///
+ /// 设置标题
+ ///
+ private void SetTitle( string value ) {
+ var options = NgZorroOptionsService.GetOptions();
+ if ( options.EnableI18n ) {
+ this.AttributeByI18n( "[nzTitle]", value );
+ return;
+ }
+ AttributeIfNotEmpty( "nzTitle", value );
+ }
+
///
/// 配置禁用
///
@@ -68,6 +82,23 @@ public SubMenuBuilder MenuClassName() {
return this;
}
+ ///
+ /// 配置菜单弹出位置
+ ///
+ public SubMenuBuilder Placement() {
+ AttributeIfNotEmpty( "nzPlacement", _config.GetValue( UiConst.Placement )?.Description() );
+ AttributeIfNotEmpty( "[nzPlacement]", _config.GetValue( AngularConst.BindPlacement ) );
+ return this;
+ }
+
+ ///
+ /// 配置左内边距
+ ///
+ public SubMenuBuilder PaddingLeft() {
+ AttributeIfNotEmpty( "[nzPaddingLeft]", _config.GetValue( UiConst.PaddingLeft ) );
+ return this;
+ }
+
///
/// 配置事件
///
@@ -81,7 +112,8 @@ public SubMenuBuilder Events() {
///
public override void Config() {
base.Config();
- Title().Disabled().Icon().Open().MenuClassName().Events();
+ Title().Disabled().Icon().Open().MenuClassName().Placement().PaddingLeft()
+ .Events();
}
///
diff --git a/src/Util.Ui.NgZorro/Components/Menus/MenuGroupTagHelper.cs b/src/Util.Ui.NgZorro/Components/Menus/MenuGroupTagHelper.cs
index b661d9674..c1c1acbd3 100644
--- a/src/Util.Ui.NgZorro/Components/Menus/MenuGroupTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/Menus/MenuGroupTagHelper.cs
@@ -11,7 +11,7 @@ namespace Util.Ui.NgZorro.Components.Menus;
[HtmlTargetElement( "util-menu-group" )]
public class MenuGroupTagHelper : AngularTagHelperBase {
///
- /// nzTitle,标题
+ /// nzTitle,标题,支持多语言
///
public string Title { get; set; }
///
diff --git a/src/Util.Ui.NgZorro/Components/Menus/MenuItemTagHelper.cs b/src/Util.Ui.NgZorro/Components/Menus/MenuItemTagHelper.cs
index c46760d21..d2b205aec 100644
--- a/src/Util.Ui.NgZorro/Components/Menus/MenuItemTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/Menus/MenuItemTagHelper.cs
@@ -1,5 +1,5 @@
using Microsoft.AspNetCore.Razor.TagHelpers;
-using Util.Ui.Angular.TagHelpers;
+using Util.Ui.NgZorro.Components.Base;
using Util.Ui.NgZorro.Components.Menus.Renders;
using Util.Ui.NgZorro.Enums;
using Util.Ui.Renders;
@@ -10,9 +10,9 @@ namespace Util.Ui.NgZorro.Components.Menus;
/// 菜单项,生成的标签为<li nz-menu-item></li>
///
[HtmlTargetElement( "util-menu-item")]
-public class MenuItemTagHelper : AngularTagHelperBase {
+public class MenuItemTagHelper : TooltipTagHelperBase {
///
- /// 扩展属性,内容文本,支持i18n
+ /// 扩展属性,内容文本,支持多语言
///
public string Text { get; set; }
///
@@ -60,7 +60,11 @@ public class MenuItemTagHelper : AngularTagHelperBase {
///
public string MatchRouterExact { get; set; }
///
- /// (click),单击事件处理函数
+ /// [nzPaddingLeft],左内边距,单位: 像素, 类型: number
+ ///
+ public string PaddingLeft { get; set; }
+ ///
+ /// (click),单击事件
///
public string OnClick { get; set; }
diff --git a/src/Util.Ui.NgZorro/Components/Menus/MenuTagHelper.cs b/src/Util.Ui.NgZorro/Components/Menus/MenuTagHelper.cs
index acc82762d..1267c5c26 100644
--- a/src/Util.Ui.NgZorro/Components/Menus/MenuTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/Menus/MenuTagHelper.cs
@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Razor.TagHelpers;
using Util.Ui.Angular.TagHelpers;
+using Util.Ui.NgZorro.Components.Dropdowns.Helpers;
using Util.Ui.NgZorro.Components.Menus.Renders;
using Util.Ui.NgZorro.Enums;
using Util.Ui.Renders;
@@ -11,6 +12,11 @@ namespace Util.Ui.NgZorro.Components.Menus;
///
[HtmlTargetElement( "util-menu")]
public class MenuTagHelper : AngularTagHelperBase {
+ ///
+ /// 配置
+ ///
+ private Config _config;
+
///
/// nzMode,菜单模式,支持垂直、水平、和内嵌模式三种,可选值: 'vertical' | 'horizontal' | 'inline',默认值: 'vertical'
///
@@ -20,41 +26,41 @@ public class MenuTagHelper : AngularTagHelperBase {
///
public string BindMode { get; set; }
///
- /// [nzSelectable],是否允许选中,默认值:true
+ /// [nzSelectable],是否允许选中,类型: boolean, 默认值:true
///
public string Selectable { get; set; }
///
- /// nzTheme,主题颜色,可选值: 'light' | 'dark'
+ /// nzTheme,主题颜色,可选值: 'light' | 'dark', 默认值: 'light'
///
public MenuTheme Theme { get; set; }
///
- /// [nzTheme],主题颜色,可选值: 'light' | 'dark'
+ /// [nzTheme],主题颜色,可选值: 'light' | 'dark', 默认值: 'light'
///
public string BindTheme { get; set; }
///
- /// [nzInlineCollapsed],内嵌模式时菜单是否折叠
- ///
- public bool InlineCollapsed { get; set; }
- ///
- /// [nzInlineCollapsed],内嵌模式时菜单是否折叠
+ /// [nzInlineCollapsed],菜单是否收起,内嵌模式 `nzMode='inline'` 有效, 类型: boolean
///
- public string BindInlineCollapsed { get; set; }
+ public string InlineCollapsed { get; set; }
///
- /// [nzInlineIndent],内嵌模式时菜单缩进宽度,默认值:24
+ /// [nzInlineIndent],菜单缩进宽度,内嵌模式 `nzMode='inline'` 有效, 类型: number, 默认值:24
///
- public int InlineIndent { get; set; }
+ public string InlineIndent { get; set; }
///
- /// [nzInlineIndent],内嵌模式时菜单缩进宽度,默认值:24
- ///
- public string BindInlineIndent { get; set; }
- ///
- /// (nzClick),单击菜单项事件处理函数
+ /// (nzClick),点击菜单项事件,类型: EventEmitter<NzMenuItemDirective>
///
public string OnClick { get; set; }
+ ///
+ protected override void ProcessBefore( TagHelperContext context, TagHelperOutput output ) {
+ _config = new Config( context, output );
+ var service = new DropdownMenuService( _config );
+ service.Init();
+ service.AutoCreateUl( false );
+ }
+
///
protected override IRender GetRender( TagHelperContext context, TagHelperOutput output, TagHelperContent content ) {
- var config = new Config( context, output, content );
- return new MenuRender( config );
+ _config.Content = content;
+ return new MenuRender( _config );
}
}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Components/Menus/SubMenuTagHelper.cs b/src/Util.Ui.NgZorro/Components/Menus/SubMenuTagHelper.cs
index adf38764a..cbd1675f2 100644
--- a/src/Util.Ui.NgZorro/Components/Menus/SubMenuTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/Menus/SubMenuTagHelper.cs
@@ -12,7 +12,7 @@ namespace Util.Ui.NgZorro.Components.Menus;
[HtmlTargetElement( "util-submenu" )]
public class SubMenuTagHelper : AngularTagHelperBase {
///
- /// nzTitle,标题
+ /// nzTitle,标题,支持多语言
///
public string Title { get; set; }
///
@@ -36,7 +36,7 @@ public class SubMenuTagHelper : AngularTagHelperBase {
///
public string Open { get; set; }
///
- /// [(nzOpen)],是否展开
+ /// [(nzOpen)],是否展开, 默认值: false
///
public string BindonOpen { get; set; }
///
@@ -48,7 +48,19 @@ public class SubMenuTagHelper : AngularTagHelperBase {
///
public string BindMenuClassName { get; set; }
///
- /// (nzOpenChange),展开变更事件
+ /// nzPlacement,菜单弹出位置, 可选值: bottomLeft' | 'bottomCenter' | 'bottomRight' | 'topLeft' | 'topCenter' | 'topRight', 默认值: 'bottomLeft'
+ ///
+ public DropdownMenuPlacement Placement { get; set; }
+ ///
+ /// [nzPlacement],菜单弹出位置, 可选值: bottomLeft' | 'bottomCenter' | 'bottomRight' | 'topLeft' | 'topCenter' | 'topRight', 默认值: 'bottomLeft'
+ ///
+ public string BindPlacement { get; set; }
+ ///
+ /// [nzPaddingLeft],左内边距,单位: 像素, 类型: number
+ ///
+ public string PaddingLeft { get; set; }
+ ///
+ /// (nzOpenChange),展开状态变化事件, 类型: EventEmitter<boolean>
///
public string OnOpenChange { get; set; }
diff --git a/src/Util.Ui.NgZorro/Components/Progresses/Builders/ProgressBuilder.cs b/src/Util.Ui.NgZorro/Components/Progresses/Builders/ProgressBuilder.cs
index 7159a7495..c44b26de3 100644
--- a/src/Util.Ui.NgZorro/Components/Progresses/Builders/ProgressBuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/Progresses/Builders/ProgressBuilder.cs
@@ -1,5 +1,8 @@
using Util.Ui.Angular.Builders;
using Util.Ui.Angular.Configs;
+using Util.Ui.NgZorro.Directives.Popconfirms;
+using Util.Ui.NgZorro.Directives.Popover;
+using Util.Ui.NgZorro.Directives.Tooltips;
using Util.Ui.NgZorro.Enums;
namespace Util.Ui.NgZorro.Components.Progresses.Builders;
@@ -30,6 +33,15 @@ public ProgressBuilder Type() {
return this;
}
+ ///
+ /// 配置尺寸
+ ///
+ public ProgressBuilder Size() {
+ AttributeIfNotEmpty( "nzSize", _config.GetValue( UiConst.Size )?.Description() );
+ AttributeIfNotEmpty( "[nzSize]", _config.GetValue( AngularConst.BindSize ) );
+ return this;
+ }
+
///
/// 配置格式化函数
///
@@ -76,6 +88,7 @@ public ProgressBuilder StrokeLinecap() {
/// 配置颜色
///
public ProgressBuilder StrokeColor() {
+ AttributeIfNotEmpty( "nzStrokeColor", _config.GetValue( UiConst.StrokeColorType )?.Description() );
AttributeIfNotEmpty( "nzStrokeColor", _config.GetValue( UiConst.StrokeColor ) );
AttributeIfNotEmpty( "[nzStrokeColor]", _config.GetValue( AngularConst.BindStrokeColor ) );
return this;
@@ -135,7 +148,8 @@ public ProgressBuilder GapPosition() {
///
public override void Config() {
base.Config();
- Type().Format().Percent().ShowInfo().Status().StrokeLinecap()
+ this.Tooltip( _config ).Popover( _config ).Popconfirm( _config );
+ Type().Size().Format().Percent().ShowInfo().Status().StrokeLinecap()
.StrokeColor().SuccessPercent().StrokeWidth().Steps().Width()
.GapDegree().GapPosition();
}
diff --git a/src/Util.Ui.NgZorro/Components/Progresses/ProgressTagHelper.cs b/src/Util.Ui.NgZorro/Components/Progresses/ProgressTagHelper.cs
index 457d0d19c..3e0a07365 100644
--- a/src/Util.Ui.NgZorro/Components/Progresses/ProgressTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/Progresses/ProgressTagHelper.cs
@@ -1,5 +1,5 @@
using Microsoft.AspNetCore.Razor.TagHelpers;
-using Util.Ui.Angular.TagHelpers;
+using Util.Ui.NgZorro.Components.Base;
using Util.Ui.NgZorro.Components.Progresses.Renders;
using Util.Ui.NgZorro.Enums;
using Util.Ui.Renders;
@@ -10,7 +10,7 @@ namespace Util.Ui.NgZorro.Components.Progresses;
/// 进度条,生成的标签为<nz-progress></nz-progress>
///
[HtmlTargetElement( "util-progress" )]
-public class ProgressTagHelper : AngularTagHelperBase {
+public class ProgressTagHelper : TooltipTagHelperBase {
///
/// nzType,进度条类型,可选值: 'line' | 'circle' | 'dashboard',默认值: 'line'
///
@@ -20,6 +20,14 @@ public class ProgressTagHelper : AngularTagHelperBase {
///
public string BindType { get; set; }
///
+ /// nzSize,尺寸,可选值: 'default' | 'small' ,默认值: 'default'
+ ///
+ public ProgressSize Size { get; set; }
+ ///
+ /// [nzSize],尺寸,可选值: 'default' | 'small' ,默认值: 'default'
+ ///
+ public string BindSize { get; set; }
+ ///
/// [nzFormat],格式化函数,用于自定义显示内容,类型: (percent: number) => string | TemplateRef<{ $implicit: number }>,默认值: percent => percent + '%'
///
public string Format { get; set; }
@@ -48,6 +56,10 @@ public class ProgressTagHelper : AngularTagHelperBase {
///
public string BindStrokeLinecap { get; set; }
///
+ /// nzStrokeColor,扩展属性, 进度条颜色
+ ///
+ public AntDesignColor StrokeColorType { get; set; }
+ ///
/// nzStrokeColor,进度条颜色,传入对象时为渐变,类型: string | { from: string; to: string: direction: string; [percent: string]: string }
///
public string StrokeColor { get; set; }
diff --git a/src/Util.Ui.NgZorro/Components/Results/Builders/ResultBuilder.cs b/src/Util.Ui.NgZorro/Components/Results/Builders/ResultBuilder.cs
index 67d024184..af9bc3e28 100644
--- a/src/Util.Ui.NgZorro/Components/Results/Builders/ResultBuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/Results/Builders/ResultBuilder.cs
@@ -1,6 +1,5 @@
using Util.Ui.Angular.Builders;
using Util.Ui.Angular.Configs;
-using Util.Ui.Configs;
using Util.Ui.NgZorro.Enums;
namespace Util.Ui.NgZorro.Components.Results.Builders;
diff --git a/src/Util.Ui.NgZorro/Components/Results/Builders/ResultContentBuilder.cs b/src/Util.Ui.NgZorro/Components/Results/Builders/ResultContentBuilder.cs
index 41e85478d..5f180c6a4 100644
--- a/src/Util.Ui.NgZorro/Components/Results/Builders/ResultContentBuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/Results/Builders/ResultContentBuilder.cs
@@ -1,5 +1,4 @@
using Util.Ui.Angular.Builders;
-using Util.Ui.Configs;
namespace Util.Ui.NgZorro.Components.Results.Builders;
diff --git a/src/Util.Ui.NgZorro/Components/Results/Builders/ResultIconBuilder.cs b/src/Util.Ui.NgZorro/Components/Results/Builders/ResultIconBuilder.cs
new file mode 100644
index 000000000..b5710b96c
--- /dev/null
+++ b/src/Util.Ui.NgZorro/Components/Results/Builders/ResultIconBuilder.cs
@@ -0,0 +1,22 @@
+using Util.Ui.Angular.Builders;
+
+namespace Util.Ui.NgZorro.Components.Results.Builders;
+
+///
+/// 结果图标标签生成器
+///
+public class ResultIconBuilder : AngularTagBuilder {
+ ///
+ /// 配置
+ ///
+ private readonly Config _config;
+
+ ///
+ /// 初始化结果图标标签生成器
+ ///
+ /// 配置
+ public ResultIconBuilder( Config config ) : base( config,"div" ) {
+ _config = config;
+ base.Attribute( "nz-result-icon" );
+ }
+}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Components/Results/Builders/ResultSubtitleBuilder.cs b/src/Util.Ui.NgZorro/Components/Results/Builders/ResultSubtitleBuilder.cs
index 30b415544..57afb332c 100644
--- a/src/Util.Ui.NgZorro/Components/Results/Builders/ResultSubtitleBuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/Results/Builders/ResultSubtitleBuilder.cs
@@ -1,5 +1,4 @@
using Util.Ui.Angular.Builders;
-using Util.Ui.Configs;
namespace Util.Ui.NgZorro.Components.Results.Builders;
diff --git a/src/Util.Ui.NgZorro/Components/Results/Builders/ResultTitleBuilder.cs b/src/Util.Ui.NgZorro/Components/Results/Builders/ResultTitleBuilder.cs
index 93312b7db..55692bb78 100644
--- a/src/Util.Ui.NgZorro/Components/Results/Builders/ResultTitleBuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/Results/Builders/ResultTitleBuilder.cs
@@ -1,5 +1,4 @@
using Util.Ui.Angular.Builders;
-using Util.Ui.Configs;
namespace Util.Ui.NgZorro.Components.Results.Builders;
diff --git a/src/Util.Ui.NgZorro/Components/Results/Renders/ResultIconRender.cs b/src/Util.Ui.NgZorro/Components/Results/Renders/ResultIconRender.cs
new file mode 100644
index 000000000..9c30d9bd4
--- /dev/null
+++ b/src/Util.Ui.NgZorro/Components/Results/Renders/ResultIconRender.cs
@@ -0,0 +1,37 @@
+using Util.Ui.Builders;
+using Util.Ui.NgZorro.Components.Results.Builders;
+using Util.Ui.Renders;
+
+namespace Util.Ui.NgZorro.Components.Results.Renders;
+
+///
+/// 结果图标渲染器
+///
+public class ResultIconRender : RenderBase {
+ ///
+ /// 配置
+ ///
+ private readonly Config _config;
+
+ ///
+ /// 初始化结果图标渲染器
+ ///
+ /// 配置
+ public ResultIconRender( Config config ) {
+ _config = config;
+ }
+
+ ///
+ /// 获取标签生成器
+ ///
+ protected override TagBuilder GetTagBuilder() {
+ var builder = new ResultIconBuilder( _config );
+ builder.Config();
+ return builder;
+ }
+
+ ///
+ public override IHtmlContent Clone() {
+ return new ResultIconRender( _config.Copy() );
+ }
+}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Components/Results/Renders/ResultTitleRender.cs b/src/Util.Ui.NgZorro/Components/Results/Renders/ResultTitleRender.cs
index c6eddd161..90562da1f 100644
--- a/src/Util.Ui.NgZorro/Components/Results/Renders/ResultTitleRender.cs
+++ b/src/Util.Ui.NgZorro/Components/Results/Renders/ResultTitleRender.cs
@@ -1,5 +1,4 @@
using Util.Ui.Builders;
-using Util.Ui.Configs;
using Util.Ui.NgZorro.Components.Results.Builders;
using Util.Ui.Renders;
diff --git a/src/Util.Ui.NgZorro/Components/Results/ResultContentTagHelper.cs b/src/Util.Ui.NgZorro/Components/Results/ResultContentTagHelper.cs
index 969c07163..c19009e28 100644
--- a/src/Util.Ui.NgZorro/Components/Results/ResultContentTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/Results/ResultContentTagHelper.cs
@@ -6,7 +6,7 @@
namespace Util.Ui.NgZorro.Components.Results;
///
-/// 结果内容,生成的标签为<div nz-result-content></div>
+/// 结果内容区,生成的标签为<div nz-result-content></div>
///
[HtmlTargetElement( "util-result-content" )]
public class ResultContentTagHelper : AngularTagHelperBase {
diff --git a/src/Util.Ui.NgZorro/Components/Results/ResultIconTagHelper.cs b/src/Util.Ui.NgZorro/Components/Results/ResultIconTagHelper.cs
new file mode 100644
index 000000000..5953d5c10
--- /dev/null
+++ b/src/Util.Ui.NgZorro/Components/Results/ResultIconTagHelper.cs
@@ -0,0 +1,18 @@
+using Microsoft.AspNetCore.Razor.TagHelpers;
+using Util.Ui.Angular.TagHelpers;
+using Util.Ui.NgZorro.Components.Results.Renders;
+using Util.Ui.Renders;
+
+namespace Util.Ui.NgZorro.Components.Results;
+
+///
+/// 结果图标区,生成的标签为<div nz-result-icon></div>
+///
+[HtmlTargetElement( "util-result-icon" )]
+public class ResultIconTagHelper : AngularTagHelperBase {
+ ///
+ protected override IRender GetRender( TagHelperContext context, TagHelperOutput output, TagHelperContent content ) {
+ var config = new Config( context, output, content );
+ return new ResultIconRender( config );
+ }
+}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Components/Results/ResultSubtitleTagHelper.cs b/src/Util.Ui.NgZorro/Components/Results/ResultSubtitleTagHelper.cs
index 3deb58a3e..b8e11af74 100644
--- a/src/Util.Ui.NgZorro/Components/Results/ResultSubtitleTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/Results/ResultSubtitleTagHelper.cs
@@ -6,7 +6,7 @@
namespace Util.Ui.NgZorro.Components.Results;
///
-/// 结果副标题,生成的标签为<div nz-result-subtitle></div>
+/// 结果副标题区,生成的标签为<div nz-result-subtitle></div>
///
[HtmlTargetElement( "util-result-subtitle" )]
public class ResultSubtitleTagHelper : AngularTagHelperBase {
diff --git a/src/Util.Ui.NgZorro/Components/Results/ResultTitleTagHelper.cs b/src/Util.Ui.NgZorro/Components/Results/ResultTitleTagHelper.cs
index e1712c6a1..bf1322317 100644
--- a/src/Util.Ui.NgZorro/Components/Results/ResultTitleTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/Results/ResultTitleTagHelper.cs
@@ -6,7 +6,7 @@
namespace Util.Ui.NgZorro.Components.Results;
///
-/// 结果标题,生成的标签为<div nz-result-title></div>
+/// 结果标题区,生成的标签为<div nz-result-title></div>
///
[HtmlTargetElement( "util-result-title" )]
public class ResultTitleTagHelper : AngularTagHelperBase {
diff --git a/src/Util.Ui.NgZorro/Components/Spaces/Builders/SpaceBuilder.cs b/src/Util.Ui.NgZorro/Components/Spaces/Builders/SpaceBuilder.cs
index 4034517e1..4ad8fbac6 100644
--- a/src/Util.Ui.NgZorro/Components/Spaces/Builders/SpaceBuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/Spaces/Builders/SpaceBuilder.cs
@@ -1,6 +1,5 @@
using Util.Ui.Angular.Builders;
using Util.Ui.Angular.Configs;
-using Util.Ui.Configs;
using Util.Ui.NgZorro.Enums;
namespace Util.Ui.NgZorro.Components.Spaces.Builders;
@@ -49,11 +48,27 @@ public SpaceBuilder Align() {
return this;
}
+ ///
+ /// 配置设置分隔符
+ ///
+ public SpaceBuilder Split() {
+ AttributeIfNotEmpty( "[nzSplit]", _config.GetValue( UiConst.Split ) );
+ return this;
+ }
+
+ ///
+ /// 配置自动换行
+ ///
+ public SpaceBuilder Wrap() {
+ AttributeIfNotEmpty( "[nzWrap]", _config.GetValue( UiConst.Wrap ) );
+ return this;
+ }
+
///
/// 配置
///
public override void Config() {
base.Config();
- Size().Direction().Align();
+ Size().Direction().Align().Split().Wrap();
}
}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Components/Spaces/SpaceTagHelper.cs b/src/Util.Ui.NgZorro/Components/Spaces/SpaceTagHelper.cs
index 63f6b32c7..4889b15ef 100644
--- a/src/Util.Ui.NgZorro/Components/Spaces/SpaceTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/Spaces/SpaceTagHelper.cs
@@ -12,11 +12,11 @@ namespace Util.Ui.NgZorro.Components.Spaces;
[HtmlTargetElement( "util-space")]
public class SpaceTagHelper : AngularTagHelperBase {
///
- /// nzSize,间距大小,可选值: 'small' | 'middle' | 'large'
+ /// nzSize,间距大小,可选值: 'small' | 'middle' | 'large', 默认值: small
///
public SpaceSize Size { get; set; }
///
- /// [nzSize],间距大小,可选值: 'small' | 'middle' | 'large'
+ /// [nzSize],间距大小,可选值: 'small' | 'middle' | 'large', 默认值: small
///
public string BindSize { get; set; }
///
@@ -35,6 +35,14 @@ public class SpaceTagHelper : AngularTagHelperBase {
/// [nzAlign],对齐方式,可选值: 'start' | 'end' | 'center' | 'baseline'
///
public string BindAlign { get; set; }
+ ///
+ /// [nzSplit],设置分隔符,类型: TemplateRef<void>
+ ///
+ public string Split { get; set; }
+ ///
+ /// [nzWrap],是否自动换行,仅在 `nzDirection` 为 `horizontal` 时有效,类型: boolean , 默认值: false
+ ///
+ public string Wrap { get; set; }
///
protected override IRender GetRender( TagHelperContext context, TagHelperOutput output, TagHelperContent content ) {
diff --git a/src/Util.Ui.NgZorro/Components/Tabs/Builders/TabBuilder.cs b/src/Util.Ui.NgZorro/Components/Tabs/Builders/TabBuilder.cs
index 98fae3c78..4facfebfd 100644
--- a/src/Util.Ui.NgZorro/Components/Tabs/Builders/TabBuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/Tabs/Builders/TabBuilder.cs
@@ -1,6 +1,5 @@
using Util.Ui.Angular.Builders;
using Util.Ui.Angular.Configs;
-using Util.Ui.Configs;
using Util.Ui.Extensions;
using Util.Ui.NgZorro.Components.Templates.Builders;
using Util.Ui.NgZorro.Configs;
@@ -84,7 +83,6 @@ public TabBuilder CloseIcon() {
///
public TabBuilder Events() {
AttributeIfNotEmpty( "(nzClick)", _config.GetValue( UiConst.OnClick ) );
- AttributeIfNotEmpty( "(nzContextmenu)", _config.GetValue( UiConst.OnContextmenu ) );
AttributeIfNotEmpty( "(nzSelect)", _config.GetValue( UiConst.OnSelect ) );
AttributeIfNotEmpty( "(nzDeselect)", _config.GetValue( UiConst.OnDeselect ) );
return this;
@@ -113,4 +111,11 @@ protected override void ConfigContent( Config config ) {
config.Content.AppendTo( templateBuilder );
SetContent( templateBuilder );
}
+
+ ///
+ /// 配置右键上下文菜单事件
+ ///
+ protected override void ConfigOnContextmenu( Config config ) {
+ AttributeIfNotEmpty( "(nzContextmenu)", _config.GetValue( UiConst.OnContextmenu ) );
+ }
}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Components/Tabs/Builders/TabSetBuilder.cs b/src/Util.Ui.NgZorro/Components/Tabs/Builders/TabSetBuilder.cs
index 619d89ff9..de3c61592 100644
--- a/src/Util.Ui.NgZorro/Components/Tabs/Builders/TabSetBuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/Tabs/Builders/TabSetBuilder.cs
@@ -146,6 +146,15 @@ public TabSetBuilder AddIcon() {
return this;
}
+ ///
+ /// 配置关闭按钮图标
+ ///
+ public TabSetBuilder CloseIcon() {
+ AttributeIfNotEmpty( "nzCloseIcon", _config.GetValue( UiConst.CloseIcon )?.Description() );
+ AttributeIfNotEmpty( "[nzCloseIcon]", _config.GetValue( AngularConst.BindCloseIcon ) );
+ return this;
+ }
+
///
/// 配置事件
///
@@ -165,7 +174,7 @@ public override void Config() {
SelectedIndex().Animated().Size().Type()
.TabBarExtraContent().TabBarStyle().TabPosition().TabBarGutter()
.HideAll().LinkRouter().LinkExact().CanDeactivate().Centered()
- .HideAdd().AddIcon()
+ .HideAdd().AddIcon().CloseIcon()
.Events();
}
}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Components/Tabs/TabSetTagHelper.cs b/src/Util.Ui.NgZorro/Components/Tabs/TabSetTagHelper.cs
index bbf513917..d684e81f3 100644
--- a/src/Util.Ui.NgZorro/Components/Tabs/TabSetTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/Tabs/TabSetTagHelper.cs
@@ -24,11 +24,11 @@ public class TabSetTagHelper : AngularTagHelperBase {
///
public string Animated { get; set; }
///
- /// nzSize,标签大小,可选值: 'large' | 'small' | 'default',默认值: 'default'
+ /// nzSize,标签尺寸,可选值: 'large' | 'small' | 'default',默认值: 'default'
///
public TabSize Size { get; set; }
///
- /// [nzSize],标签大小,可选值: 'large' | 'small' | 'default',默认值: 'default'
+ /// [nzSize],标签尺寸,可选值: 'large' | 'small' | 'default',默认值: 'default'
///
public string BindSize { get; set; }
///
@@ -56,7 +56,7 @@ public class TabSetTagHelper : AngularTagHelperBase {
///
public string BindType { get; set; }
///
- /// [nzTabBarGutter],标签间隙
+ /// [nzTabBarGutter],标签间隙, 类型: number
///
public string TabBarGutter { get; set; }
///
@@ -92,6 +92,14 @@ public class TabSetTagHelper : AngularTagHelperBase {
///
public string BindAddIcon { get; set; }
///
+ /// nzCloseIcon,关闭按钮图标,当 nzType 为 'editable-card' 时有效,类型: string | TemplateRef<void>
+ ///
+ public AntDesignIcon CloseIcon { get; set; }
+ ///
+ /// [nzCloseIcon],关闭按钮图标,当 nzType 为 'editable-card' 时有效,类型: string | TemplateRef<void>
+ ///
+ public string BindCloseIcon { get; set; }
+ ///
/// (nzSelectedIndexChange),选中标签索引变化事件,类型: EventEmitter<number>
///
public string OnSelectedIndexChange { get; set; }
@@ -100,11 +108,11 @@ public class TabSetTagHelper : AngularTagHelperBase {
///
public string OnSelectChange { get; set; }
///
- /// (nzAdd),添加标签事件,点击添加按钮时触发
+ /// (nzAdd),添加标签事件,点击添加按钮时触发, nzType='editable-card' 时有效
///
public string OnAdd { get; set; }
///
- /// (nzClose),关闭标签事件,点击删除按钮时触发,类型: EventEmitter<{ index: number }>
+ /// (nzClose),关闭标签事件,点击删除按钮时触发, nzType='editable-card' 时有效, 类型: EventEmitter<{ index: number }>
///
public string OnClose { get; set; }
diff --git a/src/Util.Ui.NgZorro/Components/Tabs/TabTagHelper.cs b/src/Util.Ui.NgZorro/Components/Tabs/TabTagHelper.cs
index 6dd41471b..a1566cc07 100644
--- a/src/Util.Ui.NgZorro/Components/Tabs/TabTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/Tabs/TabTagHelper.cs
@@ -4,19 +4,19 @@
using Util.Ui.NgZorro.Enums;
using Util.Ui.Renders;
-namespace Util.Ui.NgZorro.Components.Tabs;
+namespace Util.Ui.NgZorro.Components.Tabs;
///
-/// 标签页子标签,生成的标签为<nz-tab></nz-tab>
+/// 标签页选项卡,生成的标签为<nz-tab></nz-tab>
///
[HtmlTargetElement( "util-tab" )]
public class TabTagHelper : AngularTagHelperBase {
///
- /// 扩展属性,是否延迟加载,设置为true则创建ng-template包装内容
+ /// 扩展属性,是否延迟加载,设置为 true 则创建 ng-template 包装内容
///
public bool Lazy { get; set; }
///
- /// nzTitle,标题,支持i18n
+ /// nzTitle,标题,支持多语言
///
public string Title { get; set; }
///
@@ -48,10 +48,6 @@ public class TabTagHelper : AngularTagHelperBase {
///
public string OnClick { get; set; }
///
- /// (nzContextmenu),右键上下文菜单事件,类型: EventEmitter<MouseEvent>
- ///
- public string OnContextmenu { get; set; }
- ///
/// (nzSelect),选中事件,类型: EventEmitter<void>
///
public string OnSelect { get; set; }
diff --git a/src/Util.Ui.NgZorro/Components/Tags/Builders/TagContainerTagBuilder.cs b/src/Util.Ui.NgZorro/Components/Tags/Builders/TagContainerTagBuilder.cs
index 7d9aae612..7090fb376 100644
--- a/src/Util.Ui.NgZorro/Components/Tags/Builders/TagContainerTagBuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/Tags/Builders/TagContainerTagBuilder.cs
@@ -1,6 +1,5 @@
using Util.Ui.Angular.Builders;
using Util.Ui.Angular.Configs;
-using Util.Ui.NgZorro.Enums;
namespace Util.Ui.NgZorro.Components.Tags.Builders;
@@ -21,8 +20,10 @@ public class TagContainerTagBuilder : AngularTagBuilder {
/// 初始化标签标签生成器
///
/// 配置
- public TagContainerTagBuilder( Config config ) : base( config, "ng-container" ) {
+ /// 标识
+ public TagContainerTagBuilder( Config config, string id ) : base( config, "ng-container" ) {
_config = config;
+ _id = id;
}
///
@@ -49,6 +50,7 @@ public TagContainerTagBuilder Events() {
AttributeIfNotEmpty( "(onLoad)", _config.GetValue( UiConst.OnLoad ) );
AttributeIfNotEmpty( "(selectedTextChange)", _config.GetValue( UiConst.OnSelectedTextChange ) );
AttributeIfNotEmpty( "(selectedValueChange)", _config.GetValue( UiConst.OnSelectedValueChange ) );
+ AttributeIfNotEmpty( "(allSelectedChange)", _config.GetValue( UiConst.OnAllSelectedChange ) );
return this;
}
diff --git a/src/Util.Ui.NgZorro/Components/Tags/Builders/TagTagBuilder.cs b/src/Util.Ui.NgZorro/Components/Tags/Builders/TagTagBuilder.cs
index 514c2b058..bae1a81fc 100644
--- a/src/Util.Ui.NgZorro/Components/Tags/Builders/TagTagBuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/Tags/Builders/TagTagBuilder.cs
@@ -60,16 +60,25 @@ public TagTagBuilder Checked() {
/// 配置颜色
///
public TagTagBuilder Color() {
- AttributeIfNotEmpty( "nzColor", _config.GetValue( UiConst.ColorType )?.Description() );
+ AttributeIfNotEmpty( "nzColor", _config.GetValue( UiConst.ColorType )?.Description() );
AttributeIfNotEmpty( "nzColor", _config.GetValue( UiConst.Color ) );
AttributeIfNotEmpty( "[nzColor]", _config.GetValue( AngularConst.BindColor ) );
return this;
}
+ ///
+ /// 配置边框
+ ///
+ public TagTagBuilder Bordered() {
+ AttributeIfNotEmpty( "[nzBordered]", _config.GetValue( UiConst.Bordered ) );
+ return this;
+ }
+
///
/// 配置事件
///
public TagTagBuilder Events() {
+ AttributeIfNotEmpty( "(click)", _config.GetValue( UiConst.OnClick ) );
AttributeIfNotEmpty( "(nzOnClose)", _config.GetValue( UiConst.OnClose ) );
AttributeIfNotEmpty( "(nzCheckedChange)", _config.GetValue( UiConst.OnCheckedChange ) );
return this;
@@ -128,7 +137,7 @@ public TagTagBuilder Text() {
///
public override void Config() {
base.Config();
- Mode().Checked().Color().Events();
+ Mode().Checked().Color().Bordered().Events();
TextEnabled().TextNotEnabled().Text();
SetForeach();
SetChecked();
@@ -139,7 +148,7 @@ public override void Config() {
///
private void SetForeach() {
if(IsEnableExtend)
- this.NgFor( $"let item of {ExtendId}.data" );
+ this.NgFor( $"let item of {ExtendId}.options" );
}
///
diff --git a/src/Util.Ui.NgZorro/Components/Tags/Renders/TagRender.cs b/src/Util.Ui.NgZorro/Components/Tags/Renders/TagRender.cs
index aea6a9ba6..da505ced9 100644
--- a/src/Util.Ui.NgZorro/Components/Tags/Renders/TagRender.cs
+++ b/src/Util.Ui.NgZorro/Components/Tags/Renders/TagRender.cs
@@ -1,9 +1,10 @@
using Util.Ui.Angular.Configs;
using Util.Ui.Builders;
using Util.Ui.NgZorro.Components.Tags.Builders;
+using Util.Ui.NgZorro.Configs;
using Util.Ui.Renders;
-namespace Util.Ui.NgZorro.Components.Tags.Renders;
+namespace Util.Ui.NgZorro.Components.Tags.Renders;
///
/// 标签渲染器
@@ -26,7 +27,9 @@ public TagRender( Config config ) {
/// 获取标签生成器
///
protected override TagBuilder GetTagBuilder() {
- var containerTagBuilder = new TagContainerTagBuilder( _config );
+ var config = _config.Copy();
+ config.RemoveAttribute( UiConst.Id );
+ var containerTagBuilder = new TagContainerTagBuilder( config, _config.GetValue( UiConst.Id ) );
containerTagBuilder.Config();
TagBuilder container = IsEnableExtend() ? containerTagBuilder : new EmptyContainerTagBuilder();
var builder = new TagTagBuilder( _config, IsEnableExtend(), containerTagBuilder.ExtendId );
@@ -39,7 +42,7 @@ protected override TagBuilder GetTagBuilder() {
/// 是否启用基础扩展
///
public bool IsEnableExtend() {
- if( GetEnableExtend() == false )
+ if ( GetEnableExtend() == false )
return false;
return GetEnableExtend() == true ||
GetUrl().IsEmpty() == false ||
diff --git a/src/Util.Ui.NgZorro/Components/Tags/TagTagHelper.cs b/src/Util.Ui.NgZorro/Components/Tags/TagTagHelper.cs
index 754fe20e3..0c40ce740 100644
--- a/src/Util.Ui.NgZorro/Components/Tags/TagTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/Tags/TagTagHelper.cs
@@ -23,11 +23,11 @@ public class TagTagHelper : AngularTagHelperBase {
///
public ModelExpression For { get; set; }
///
- /// 扩展属性,是否启用扩展指令,当设置Url或Data属性时自动启用,默认为 false
+ /// 扩展属性,是否启用扩展指令,当设置 url 或 data 属性时自动启用,默认为 false
///
public bool EnableExtend { get; set; }
///
- /// 扩展属性 [autoLoad],初始化时是否自动加载数据,默认为true,设置成false则手工加载
+ /// 扩展属性 [autoLoad],初始化时是否自动加载数据,默认为 true,设置成 false 手工加载
///
public bool AutoLoad { get; set; }
///
@@ -35,11 +35,11 @@ public class TagTagHelper : AngularTagHelperBase {
///
public string AllSelected { get; set; }
///
- /// 扩展属性 [(selectedText)],选中标签文本,多个标签文本使用逗号分隔
+ /// 扩展属性 [(selectedText)],选中标签文本,多个标签文本使用 | 分隔
///
public string SelectedText { get; set; }
///
- /// 扩展属性 [(selectedValue)],选中标签值,多个标签值使用逗号分隔
+ /// 扩展属性 [(selectedValue)],选中标签值,多个标签值使用 , 分隔
///
public string SelectedValue { get; set; }
///
@@ -87,9 +87,9 @@ public class TagTagHelper : AngularTagHelperBase {
///
public string BindonChecked { get; set; }
///
- /// nzColor,颜色枚举类型
+ /// nzColor,扩展属性, 颜色类型
///
- public AntDesignColor ColorType { get; set; }
+ public TagColor ColorType { get; set; }
///
/// nzColor,颜色
///
@@ -99,6 +99,14 @@ public class TagTagHelper : AngularTagHelperBase {
///
public string BindColor { get; set; }
///
+ /// [nzBordered],是否有边框, 类型: boolean, 默认值: true
+ ///
+ public string Bordered { get; set; }
+ ///
+ /// (click),单击事件
+ ///
+ public string OnClick { get; set; }
+ ///
/// (nzOnClose),关闭事件,在 nzMode="closable" 时可用,类型: EventEmitter<MouseEvent>
///
public string OnClose { get; set; }
@@ -111,13 +119,17 @@ public class TagTagHelper : AngularTagHelperBase {
///
public string OnLoad { get; set; }
///
- /// 扩展事件 (selectedTextChange),选中文本变更事件,类型: EventEmitter<string>,参数为选中标签的文本,以逗号分隔
+ /// 扩展事件 (selectedTextChange),选中文本变化事件,类型: EventEmitter<string>,参数为选中标签的文本,以 | 分隔
///
public string OnSelectedTextChange { get; set; }
///
- /// 扩展事件 (selectedValueChange),选中值变更事件,类型: EventEmitter<string>,参数为选中标签的值,以逗号分隔
+ /// 扩展事件 (selectedValueChange),选中值变化事件,类型: EventEmitter<string>,参数为选中标签的值,以 , 分隔
///
public string OnSelectedValueChange { get; set; }
+ ///
+ /// 扩展事件 (allSelectedChange),全部选中状态变化事件,类型: EventEmitter<boolean>
+ ///
+ public string OnAllSelectedChange { get; set; }
///
protected override void ProcessBefore( TagHelperContext context, TagHelperOutput output ) {
diff --git a/src/Util.Ui.NgZorro/Components/Templates/TemplateTagHelper.cs b/src/Util.Ui.NgZorro/Components/Templates/TemplateTagHelper.cs
index 8dd87a2be..6b44a58e0 100644
--- a/src/Util.Ui.NgZorro/Components/Templates/TemplateTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/Templates/TemplateTagHelper.cs
@@ -11,7 +11,7 @@ namespace Util.Ui.NgZorro.Components.Templates;
[HtmlTargetElement( "util-template" )]
public class TemplateTagHelper : AngularTagHelperBase {
///
- /// 扩展属性 nz-tab,选项卡是否延迟加载
+ /// 扩展属性 nz-tab,选项卡是否延迟加载, 默认值: false
///
public bool Tab { get; set; }
diff --git a/src/Util.Ui.NgZorro/Components/Timelines/Builders/TimelineItemBuilder.cs b/src/Util.Ui.NgZorro/Components/Timelines/Builders/TimelineItemBuilder.cs
index 7d8c33d06..1f3df992b 100644
--- a/src/Util.Ui.NgZorro/Components/Timelines/Builders/TimelineItemBuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/Timelines/Builders/TimelineItemBuilder.cs
@@ -1,6 +1,5 @@
using Util.Ui.Angular.Builders;
using Util.Ui.Angular.Configs;
-using Util.Ui.Configs;
using Util.Ui.NgZorro.Enums;
namespace Util.Ui.NgZorro.Components.Timelines.Builders;
@@ -25,6 +24,7 @@ public TimelineItemBuilder( Config config ) : base( config,"nz-timeline-item" )
/// 配置颜色
///
public TimelineItemBuilder Color() {
+ AttributeIfNotEmpty( "nzColor", _config.GetValue( UiConst.ColorType )?.Description() );
AttributeIfNotEmpty( "nzColor", _config.GetValue( UiConst.Color ) );
AttributeIfNotEmpty( "[nzColor]", _config.GetValue( AngularConst.BindColor ) );
return this;
@@ -47,11 +47,20 @@ public TimelineItemBuilder Position() {
return this;
}
+ ///
+ /// 配置标签
+ ///
+ public TimelineItemBuilder Label() {
+ AttributeIfNotEmpty( "nzLabel", _config.GetValue( UiConst.Label ) );
+ AttributeIfNotEmpty( "[nzLabel]", _config.GetValue( AngularConst.BindLabel ) );
+ return this;
+ }
+
///
/// 配置
///
public override void Config() {
base.Config();
- Color().Dot().Position();
+ Color().Dot().Position().Label();
}
}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Components/Timelines/TimelineItemTagHelper.cs b/src/Util.Ui.NgZorro/Components/Timelines/TimelineItemTagHelper.cs
index de95a951a..2c956c35e 100644
--- a/src/Util.Ui.NgZorro/Components/Timelines/TimelineItemTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/Timelines/TimelineItemTagHelper.cs
@@ -11,6 +11,10 @@ namespace Util.Ui.NgZorro.Components.Timelines;
///
[HtmlTargetElement( "util-timeline-item" )]
public class TimelineItemTagHelper : AngularTagHelperBase {
+ ///
+ /// nzColor,扩展属性,指定圆圈颜色
+ ///
+ public AntDesignColor ColorType { get; set; }
///
/// nzColor,指定圆圈颜色,范例: 'blue' | 'red' | 'green' | 'gray' ,默认值: 'blue'
///
@@ -31,6 +35,14 @@ public class TimelineItemTagHelper : AngularTagHelperBase {
/// [nzPosition],自定义节点位置,仅当时间轴的 nzMode 为 custom 时有效,可选值: 'left' | 'right'
///
public string BindPosition { get; set; }
+ ///
+ /// nzLabel,设置标签,用于单独显示时间
+ ///
+ public string Label { get; set; }
+ ///
+ /// [nzLabel],设置标签,用于单独显示时间, 类型: string | TemplateRef<void>
+ ///
+ public string BindLabel { get; set; }
///
protected override IRender GetRender( TagHelperContext context, TagHelperOutput output, TagHelperContent content ) {
diff --git a/src/Util.Ui.NgZorro/Components/Timelines/TimelineTagHelper.cs b/src/Util.Ui.NgZorro/Components/Timelines/TimelineTagHelper.cs
index b0f70a5d5..84a3825ba 100644
--- a/src/Util.Ui.NgZorro/Components/Timelines/TimelineTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/Timelines/TimelineTagHelper.cs
@@ -12,19 +12,19 @@ namespace Util.Ui.NgZorro.Components.Timelines;
[HtmlTargetElement( "util-timeline" )]
public class TimelineTagHelper : AngularTagHelperBase {
///
- /// nzPending,指定最后一个幽灵节点是否存在或内容,类型: string | boolean | TemplateRef<void>,默认值: false
+ /// nzPending,设置幽灵节点的内容,幽灵节点显示在最后
///
public string Pending { get; set; }
///
- /// [nzPending],指定最后一个幽灵节点是否存在或内容,类型: string | boolean | TemplateRef<void>,默认值: false
+ /// [nzPending],设置幽灵节点的内容,幽灵节点显示在最后,如果设置为 true 则显示默认幽灵节点,也可使用模板进行内容定制, 类型: string | boolean | TemplateRef<void>,默认值: false
///
public string BindPending { get; set; }
///
- /// nzPendingDot,当最后一个幽灵节点存在時,指定其时间图点,类型: string | TemplateRef<void>,默认值: <i nz-icon nzType="loading"></i>
+ /// nzPendingDot,设置幽灵节点时间轴点
///
public string PendingDot { get; set; }
///
- /// [nzPendingDot],当最后一个幽灵节点存在時,指定其时间图点,类型: string | TemplateRef<void>,默认值: <i nz-icon nzType="loading"></i>
+ /// [nzPendingDot],设置幽灵节点时间轴点,类型: string | TemplateRef<void>,默认值: <i nz-icon nzType="loading"></i>
///
public string BindPendingDot { get; set; }
///
@@ -32,11 +32,11 @@ public class TimelineTagHelper : AngularTagHelperBase {
///
public string Reverse { get; set; }
///
- /// nzMode,模式,可以改变时间轴和内容的相对位置,可选值: 'left' | 'alternate' | 'right' | 'custom'
+ /// nzMode,显示模式,可以改变时间轴和内容的相对位置,可选值: 'left' | 'alternate' | 'right' | 'custom'
///
public TimelineMode Mode { get; set; }
///
- /// [nzMode],模式,可以改变时间轴和内容的相对位置,可选值: 'left' | 'alternate' | 'right' | 'custom'
+ /// [nzMode],显示模式,可以改变时间轴和内容的相对位置,可选值: 'left' | 'alternate' | 'right' | 'custom'
///
public string BindMode { get; set; }
diff --git a/src/Util.Ui.NgZorro/Components/Trees/Builders/TreeBuilder.cs b/src/Util.Ui.NgZorro/Components/Trees/Builders/TreeBuilder.cs
index 5f31592fe..615aeb2ea 100644
--- a/src/Util.Ui.NgZorro/Components/Trees/Builders/TreeBuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/Trees/Builders/TreeBuilder.cs
@@ -282,7 +282,6 @@ public TreeBuilder VirtualMinBufferPx() {
public TreeBuilder Events() {
AttributeIfNotEmpty( "(nzClick)", _config.GetValue( UiConst.OnClick ) );
AttributeIfNotEmpty( "(nzDblClick)", _config.GetValue( UiConst.OnDblClick ) );
- AttributeIfNotEmpty( "(nzContextMenu)", _config.GetValue( UiConst.OnContextmenu ) );
AttributeIfNotEmpty( "(nzCheckBoxChange)", _config.GetValue( UiConst.OnCheckBoxChange ) );
OnExpandChange( _config.GetValue( UiConst.OnExpandChange ) );
AttributeIfNotEmpty( "(nzSearchValueChange)", _config.GetValue( UiConst.OnSearchValueChange ) );
@@ -331,4 +330,11 @@ private void ConfigDefault() {
.SelectedKeys( $"{ExtendId}.selectedKeys" )
.OnExpandChange( $"{ExtendId}.expandChange($event)" );
}
+
+ ///
+ /// 配置右键上下文菜单事件
+ ///
+ protected override void ConfigOnContextmenu( Config config ) {
+ AttributeIfNotEmpty( "(nzContextMenu)", _config.GetValue( UiConst.OnContextmenu ) );
+ }
}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Components/Trees/TreeTagHelper.cs b/src/Util.Ui.NgZorro/Components/Trees/TreeTagHelper.cs
index f7e813b26..29ff617f3 100644
--- a/src/Util.Ui.NgZorro/Components/Trees/TreeTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/Trees/TreeTagHelper.cs
@@ -190,7 +190,7 @@ public class TreeTagHelper : AngularTagHelperBase {
///
/// (nzContextMenu),上下文菜单事件,右键点击树节点时触发,类型: EventEmitter<NzFormatEmitEvent>
///
- public string OnContextmenu { get; set; }
+ public new string OnContextmenu { get; set; }
///
/// (nzCheckBoxChange),树节点复选框选中状态变化事件,点击树节点复选框时触发,类型: EventEmitter<NzFormatEmitEvent>
///
diff --git a/src/Util.Ui.NgZorro/Components/Typographies/Renders/SpanRender.cs b/src/Util.Ui.NgZorro/Components/Typographies/Renders/SpanRender.cs
index 80265bef8..f7bbab51e 100644
--- a/src/Util.Ui.NgZorro/Components/Typographies/Renders/SpanRender.cs
+++ b/src/Util.Ui.NgZorro/Components/Typographies/Renders/SpanRender.cs
@@ -43,7 +43,6 @@ protected void ConfigHtml( TagBuilder builder ) {
///
/// 标签生成器
protected override void ConfigEvents( TagBuilder builder ) {
- builder.AttributeIfNotEmpty( "(contextmenu)", _config.GetValue( UiConst.OnContextmenu ) );
}
///
diff --git a/src/Util.Ui.NgZorro/Components/Typographies/Renders/TypographyRender.cs b/src/Util.Ui.NgZorro/Components/Typographies/Renders/TypographyRender.cs
index 123875f54..d59da5089 100644
--- a/src/Util.Ui.NgZorro/Components/Typographies/Renders/TypographyRender.cs
+++ b/src/Util.Ui.NgZorro/Components/Typographies/Renders/TypographyRender.cs
@@ -6,6 +6,7 @@
using Util.Ui.NgZorro.Directives.Popover;
using Util.Ui.NgZorro.Directives.Tooltips;
using Util.Ui.NgZorro.Enums;
+using Util.Ui.NgZorro.Extensions;
using Util.Ui.Renders;
namespace Util.Ui.NgZorro.Components.Typographies.Renders;
@@ -55,7 +56,7 @@ protected override TagBuilder GetTagBuilder() {
ConfigEvents();
Config( _builder );
_builder.Angular( _config );
- _builder.Tooltip( _config ).Popconfirm( _config ).Popover( _config );
+ _builder.Tooltip( _config ).Popconfirm( _config ).Popover( _config ).SpaceItem( _config );
_builder.ConfigBase( _config );
ConfigContent( _builder );
return _builder;
diff --git a/src/Util.Ui.NgZorro/Components/Typographies/SpanTagHelper.cs b/src/Util.Ui.NgZorro/Components/Typographies/SpanTagHelper.cs
index 3ca0401fa..188f2b9fb 100644
--- a/src/Util.Ui.NgZorro/Components/Typographies/SpanTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/Typographies/SpanTagHelper.cs
@@ -28,10 +28,6 @@ public class SpanTagHelper : TypographyTagHelper {
/// [innerHTML], 设置Html
///
public string BindHtml { get; set; }
- ///
- /// (contextmenu),上下文菜单事件
- ///
- public string OnContextmenu { get; set; }
///
protected override bool IsEnableTypography() {
diff --git a/src/Util.Ui.NgZorro/Components/Typographies/TypographyTagHelper.cs b/src/Util.Ui.NgZorro/Components/Typographies/TypographyTagHelper.cs
index 358b981f5..ede8af3ff 100644
--- a/src/Util.Ui.NgZorro/Components/Typographies/TypographyTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/Typographies/TypographyTagHelper.cs
@@ -100,6 +100,10 @@ public abstract class TypographyTagHelper : TooltipTagHelperBase {
///
public string BindonContent { get; set; }
///
+ /// *nzSpaceItem,值为 true 时设置为间距项,放入 <util-space> 中使用
+ ///
+ public bool SpaceItem { get; set; }
+ ///
/// (nzContentChange),当用户提交编辑内容时触发
///
public string OnContentChange { get; set; }
diff --git a/src/Util.Ui.NgZorro/Components/Upload/Builders/UploadBuilder.cs b/src/Util.Ui.NgZorro/Components/Upload/Builders/UploadBuilder.cs
index f335856c1..91ce98308 100644
--- a/src/Util.Ui.NgZorro/Components/Upload/Builders/UploadBuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/Upload/Builders/UploadBuilder.cs
@@ -2,6 +2,7 @@
using Util.Ui.Angular.Configs;
using Util.Ui.Angular.Extensions;
using Util.Ui.NgZorro.Components.Buttons.Builders;
+using Util.Ui.NgZorro.Components.Forms.Configs;
using Util.Ui.NgZorro.Components.Inputs.Builders;
using Util.Ui.NgZorro.Configs;
using Util.Ui.NgZorro.Enums;
@@ -304,6 +305,24 @@ public UploadBuilder Model() {
return this;
}
+ ///
+ /// 配置间距项
+ ///
+ public UploadBuilder SpaceItem() {
+ var shareConfig = GetShareConfig();
+ if ( shareConfig.FormItemCreated )
+ return this;
+ this.SpaceItem( shareConfig.SpaceItem );
+ return this;
+ }
+
+ ///
+ /// 获取表单项共享配置
+ ///
+ private FormItemShareConfig GetShareConfig() {
+ return _config.GetValueFromItems() ?? new FormItemShareConfig();
+ }
+
///
/// 配置
///
@@ -317,7 +336,7 @@ public override void Config() {
.Remove().Download().TransformFile()
.IconRender().FileListRender()
.Events();
- Model();
+ Model().SpaceItem();
AddButton();
EnableExtend();
}
diff --git a/src/Util.Ui.NgZorro/Components/Upload/Helpers/UploadService.cs b/src/Util.Ui.NgZorro/Components/Upload/Helpers/UploadService.cs
index 6a7a63380..63dea0997 100644
--- a/src/Util.Ui.NgZorro/Components/Upload/Helpers/UploadService.cs
+++ b/src/Util.Ui.NgZorro/Components/Upload/Helpers/UploadService.cs
@@ -1,5 +1,4 @@
-using Util.Ui.Configs;
-using Util.Ui.NgZorro.Components.Forms.Helpers;
+using Util.Ui.NgZorro.Components.Forms.Helpers;
namespace Util.Ui.NgZorro.Components.Upload.Helpers;
diff --git a/src/Util.Ui.NgZorro/Components/WaterMarks/Builders/WaterMarkBuilder.cs b/src/Util.Ui.NgZorro/Components/WaterMarks/Builders/WaterMarkBuilder.cs
index 237c202d4..ce676a01b 100644
--- a/src/Util.Ui.NgZorro/Components/WaterMarks/Builders/WaterMarkBuilder.cs
+++ b/src/Util.Ui.NgZorro/Components/WaterMarks/Builders/WaterMarkBuilder.cs
@@ -1,6 +1,7 @@
using Util.Ui.Angular.Builders;
using Util.Ui.Angular.Configs;
using Util.Ui.NgZorro.Components.WaterMarks.Helpers;
+using Util.Ui.NgZorro.Enums;
namespace Util.Ui.NgZorro.Components.WaterMarks.Builders;
@@ -91,7 +92,7 @@ private string GetFont() {
if ( result.IsEmpty() == false )
return result;
var fontType = new FontType {
- Color = _config.GetValue( UiConst.FontColor ),
+ Color = GetFontColor(),
FontSize = _config.GetValue( UiConst.FontSize ),
FontWeight = _config.GetValue( UiConst.FontWeight ),
FontFamily = _config.GetValue( UiConst.FontFamily ),
@@ -103,6 +104,14 @@ private string GetFont() {
return result;
}
+ ///
+ /// 获取字体颜色
+ ///
+ private string GetFontColor() {
+ var result = _config.GetValue( UiConst.FontColor );
+ return result.IsEmpty() ? _config.GetValue( UiConst.FontColorType )?.Description() : result;
+ }
+
///
/// 配置间距
///
diff --git a/src/Util.Ui.NgZorro/Components/WaterMarks/WaterMarkTagHelper.cs b/src/Util.Ui.NgZorro/Components/WaterMarks/WaterMarkTagHelper.cs
index a60b75841..109d287ff 100644
--- a/src/Util.Ui.NgZorro/Components/WaterMarks/WaterMarkTagHelper.cs
+++ b/src/Util.Ui.NgZorro/Components/WaterMarks/WaterMarkTagHelper.cs
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Razor.TagHelpers;
using Util.Ui.Angular.TagHelpers;
using Util.Ui.NgZorro.Components.WaterMarks.Renders;
+using Util.Ui.NgZorro.Enums;
using Util.Ui.Renders;
namespace Util.Ui.NgZorro.Components.WaterMarks;
@@ -47,6 +48,10 @@ public class WaterMarkTagHelper : AngularTagHelperBase {
///
public string Font { get; set; }
///
+ /// [nzFont],扩展属性, 字体颜色
+ ///
+ public AntDesignColor FontColorType { get; set; }
+ ///
/// [nzFont],字体颜色, 默认值: rgba(0,0,0,.15)
///
public string FontColor { get; set; }
diff --git a/src/Util.Ui.NgZorro/Configs/AntDesignConst.cs b/src/Util.Ui.NgZorro/Configs/AntDesignConst.cs
index c7f8272ec..0f1da9d9f 100644
--- a/src/Util.Ui.NgZorro/Configs/AntDesignConst.cs
+++ b/src/Util.Ui.NgZorro/Configs/AntDesignConst.cs
@@ -9,6 +9,10 @@ public class AntDesignConst {
///
public const string TwotoneColor = "twotone-color";
///
+ /// 双色图标颜色类型
+ ///
+ public const string TwotoneColorType = "twotone-color-type";
+ ///
/// 双色图标颜色
///
public const string BindTwotoneColor = "bind-twotone-color";
diff --git a/src/Util.Ui.NgZorro/Directives/Tooltips/TagBuilderExtensions.cs b/src/Util.Ui.NgZorro/Directives/Tooltips/TagBuilderExtensions.cs
index 24ffe3ce8..0900724a3 100644
--- a/src/Util.Ui.NgZorro/Directives/Tooltips/TagBuilderExtensions.cs
+++ b/src/Util.Ui.NgZorro/Directives/Tooltips/TagBuilderExtensions.cs
@@ -28,7 +28,8 @@ public static TBuilder Tooltip( this TBuilder builder, Config config )
builder.AttributeIfNotEmpty( "[nzTooltipTitleContext]", config.GetValue( UiConst.TooltipTitleContext ) );
builder.AttributeIfNotEmpty( "nzTooltipTrigger", config.GetValue( UiConst.TooltipTrigger )?.Description() );
builder.AttributeIfNotEmpty( "[nzTooltipTrigger]", config.GetValue( AngularConst.BindTooltipTrigger ) );
- builder.AttributeIfNotEmpty( "nzTooltipColor", config.GetValue( UiConst.TooltipColor )?.Description() );
+ builder.AttributeIfNotEmpty( "nzTooltipColor", config.GetValue( UiConst.TooltipColorType )?.Description() );
+ builder.AttributeIfNotEmpty( "nzTooltipColor", config.GetValue( UiConst.TooltipColor ) );
builder.AttributeIfNotEmpty( "[nzTooltipColor]", config.GetValue( AngularConst.BindTooltipColor ) );
builder.AttributeIfNotEmpty( "[nzTooltipOrigin]", config.GetValue( UiConst.TooltipOrigin ) );
builder.AttributeIfNotEmpty( "[nzTooltipVisible]", config.GetValue( UiConst.TooltipVisible ) );
diff --git a/src/Util.Ui.NgZorro/Enums/AntDesignColor.cs b/src/Util.Ui.NgZorro/Enums/AntDesignColor.cs
index aff269ae8..04ecfcf8a 100644
--- a/src/Util.Ui.NgZorro/Enums/AntDesignColor.cs
+++ b/src/Util.Ui.NgZorro/Enums/AntDesignColor.cs
@@ -5,68 +5,73 @@
///
public enum AntDesignColor {
///
- /// 粉红色
+ /// pink, 粉红色
///
[Description( "pink" )]
Pink,
///
- /// 薄暮 - 红色
+ /// red, 薄暮 - 红色
///
[Description( "red" )]
Red,
///
- /// 洋红
+ /// magenta, 洋红
///
[Description( "magenta" )]
Magenta,
///
- /// 火山
+ /// volcano, 火山
///
[Description( "volcano" )]
Volcano,
///
- /// 日暮 - 橘黄色
+ /// orange, 日暮 - 橘黄色
///
[Description( "orange" )]
Orange,
///
- /// 金盏花 - 黄金色
+ /// gold, 金盏花 - 黄金色
///
[Description( "gold" )]
Gold,
///
- /// 青柠
+ /// lime, 青柠
///
[Description( "lime" )]
Lime,
///
- /// 极光绿
+ /// green, 极光绿
///
[Description( "green" )]
Green,
///
- /// 明青
+ /// cyan, 明青
///
[Description( "cyan" )]
Cyan,
///
- /// 拂晓蓝
+ /// blue, 拂晓蓝
///
[Description( "blue" )]
Blue,
///
- /// 极客蓝
+ /// geekblue, 极客蓝
///
[Description( "geekblue" )]
GeekBlue,
///
- /// 酱紫
+ /// purple, 酱紫
///
[Description( "purple" )]
Purple,
///
- /// 黄色
+ /// yellow, 黄色
///
[Description( "yellow" )]
- Yellow
+ Yellow,
+ ///
+ /// gray,灰色
+ ///
+ [Description( "gray" )]
+ Gray
}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Enums/ProgressSize.cs b/src/Util.Ui.NgZorro/Enums/ProgressSize.cs
new file mode 100644
index 000000000..26c2c747d
--- /dev/null
+++ b/src/Util.Ui.NgZorro/Enums/ProgressSize.cs
@@ -0,0 +1,17 @@
+namespace Util.Ui.NgZorro.Enums;
+
+///
+/// 进度条尺寸
+///
+public enum ProgressSize {
+ ///
+ /// default, 默认
+ ///
+ [Description( "default" )]
+ Default,
+ ///
+ /// small, 小尺寸
+ ///
+ [Description( "small" )]
+ Small
+}
\ No newline at end of file
diff --git a/src/Util.Ui.NgZorro/Enums/TagColor.cs b/src/Util.Ui.NgZorro/Enums/TagColor.cs
new file mode 100644
index 000000000..030e52734
--- /dev/null
+++ b/src/Util.Ui.NgZorro/Enums/TagColor.cs
@@ -0,0 +1,102 @@
+namespace Util.Ui.NgZorro.Enums;
+
+///
+/// 标签颜色
+///
+public enum TagColor {
+ ///
+ /// default,默认
+ ///
+ [Description( "default" )]
+ Default,
+ ///
+ /// success,成功
+ ///
+ [Description( "success" )]
+ Success,
+ ///
+ /// processing,处理中
+ ///
+ [Description( "processing" )]
+ Processing,
+ ///
+ /// warning,警告
+ ///
+ [Description( "warning" )]
+ Warning,
+ ///
+ /// error, 错误
+ ///
+ [Description( "error" )]
+ Error,
+ ///
+ /// pink, 粉红色
+ ///
+ [Description( "pink" )]
+ Pink,
+ ///
+ /// red, 薄暮 - 红色
+ ///
+ [Description( "red" )]
+ Red,
+ ///
+ /// magenta, 洋红
+ ///
+ [Description( "magenta" )]
+ Magenta,
+ ///
+ /// volcano, 火山
+ ///
+ [Description( "volcano" )]
+ Volcano,
+ ///
+ /// orange, 日暮 - 橘黄色
+ ///
+ [Description( "orange" )]
+ Orange,
+ ///
+ /// gold, 金盏花 - 黄金色
+ ///
+ [Description( "gold" )]
+ Gold,
+ ///
+ /// lime, 青柠
+ ///
+ [Description( "lime" )]
+ Lime,
+ ///
+ /// green, 极光绿
+ ///
+ [Description( "green" )]
+ Green,
+ ///
+ /// cyan, 明青
+ ///
+ [Description( "cyan" )]
+ Cyan,
+ ///
+ /// blue, 拂晓蓝
+ ///
+ [Description( "blue" )]
+ Blue,
+ ///
+ /// geekblue, 极客蓝
+ ///
+ [Description( "geekblue" )]
+ GeekBlue,
+ ///
+ /// purple, 酱紫
+ ///
+ [Description( "purple" )]
+ Purple,
+ ///
+ /// yellow, 黄色
+ ///
+ [Description( "yellow" )]
+ Yellow,
+ ///
+ /// gray,灰色
+ ///
+ [Description( "gray" )]
+ Gray
+}
\ No newline at end of file
diff --git a/src/Util.Ui/Configs/UiConst.cs b/src/Util.Ui/Configs/UiConst.cs
index 07329ea53..58373cba8 100644
--- a/src/Util.Ui/Configs/UiConst.cs
+++ b/src/Util.Ui/Configs/UiConst.cs
@@ -33,6 +33,14 @@ public static class UiConst {
///
public const string Unit = "unit";
///
+ /// 左内边距
+ ///
+ public const string PaddingLeft = "padding-left";
+ ///
+ /// 选项卡链接
+ ///
+ public const string TabLink = "tab-link";
+ ///
/// 可选
///
public const string Optional = "optional";
@@ -613,6 +621,10 @@ public static class UiConst {
///
public const string FontColor = "font-color";
///
+ /// 字体颜色
+ ///
+ public const string FontColorType = "font-color-type";
+ ///
/// 字体大小
///
public const string FontSize = "font-size";
@@ -957,6 +969,10 @@ public static class UiConst {
///
public const string QueryParams = "query-params";
///
+ /// 查询参数处理方式
+ ///
+ public const string QueryParamsHandling = "query-params-handling";
+ ///
/// 删除地址
///
public const string DeleteUrl = "delete-url";
@@ -1649,6 +1665,10 @@ public static class UiConst {
///
public const string SelectedRowBackgroundColor = "selected-row-background-color";
///
+ /// 全部选中变化事件
+ ///
+ public const string OnAllSelectedChange = "on-all-selected-change";
+ ///
/// 危险
///
public const string Danger = "danger";
@@ -2161,6 +2181,14 @@ public static class UiConst {
///
public const string OnEnter = "on-enter";
///
+ /// 回车事件
+ ///
+ public const string OnKeyupEnter = "on-keyup-enter";
+ ///
+ /// 回车事件
+ ///
+ public const string OnKeydownEnter = "on-keydown-enter";
+ ///
/// 隐藏
///
public const string Hidden = "hidden";
@@ -3477,6 +3505,10 @@ public static class UiConst {
///
public const string TooltipColor = "tooltip-color";
///
+ /// 提示颜色类型
+ ///
+ public const string TooltipColorType = "tooltip-color-type";
+ ///
/// 提示源元素
///
public const string TooltipOrigin = "tooltip-origin";
@@ -3773,6 +3805,10 @@ public static class UiConst {
///
public const string StrokeColor = "stroke-color";
///
+ /// 线条颜色
+ ///
+ public const string StrokeColorType = "stroke-color-type";
+ ///
/// 成功百分比
///
public const string SuccessPercent = "success-percent";
diff --git a/src/Util.WebApiClient/11-Util.WebApiClient.csproj b/src/Util.WebApiClient/11-Util.WebApiClient.csproj
new file mode 100644
index 000000000..5125ad296
--- /dev/null
+++ b/src/Util.WebApiClient/11-Util.WebApiClient.csproj
@@ -0,0 +1,33 @@
+
+
+
+ $(NetTargetFramework)
+ icon.jpg
+ Util.WebApiClient
+ Util.WebApiClient
+ Util.WebApiClient是Util应用框架集成WebApiClient的声明式Web Api操作类库
+
+
+
+
+ .\obj\Debug\$(NetTargetFramework)\Util.WebApiClient.xml
+
+
+
+
+ .\obj\Release\$(NetTargetFramework)\Util.WebApiClient.xml
+
+
+
+
+ True
+ False
+
+
+
+
+
+
+
+
+
diff --git a/test/Util.Ui.NgZorro.Tests/Links/ATagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Buttons/ATagHelperTest.cs
similarity index 88%
rename from test/Util.Ui.NgZorro.Tests/Links/ATagHelperTest.cs
rename to test/Util.Ui.NgZorro.Tests/Buttons/ATagHelperTest.cs
index 09b49bc39..fd882f588 100644
--- a/test/Util.Ui.NgZorro.Tests/Links/ATagHelperTest.cs
+++ b/test/Util.Ui.NgZorro.Tests/Buttons/ATagHelperTest.cs
@@ -1,503 +1,569 @@
-using System.Text;
-using Util.Helpers;
-using Util.Ui.Angular.Configs;
-using Util.Ui.Configs;
-using Util.Ui.Enums;
-using Util.Ui.NgZorro.Components.Forms.Configs;
-using Util.Ui.NgZorro.Components.Links;
-using Util.Ui.NgZorro.Configs;
-using Util.Ui.NgZorro.Enums;
-using Util.Ui.TagHelpers;
-using Xunit;
-using Xunit.Abstractions;
-
-namespace Util.Ui.NgZorro.Tests.Links {
- ///
- /// 链接测试
- ///
- public class ATagHelperTest {
- ///
- /// 输出工具
- ///
- private readonly ITestOutputHelper _output;
- ///
- /// TagHelper包装器
- ///
- private readonly TagHelperWrapper _wrapper;
-
- ///
- /// 测试初始化
- ///
- public ATagHelperTest( ITestOutputHelper output ) {
- _output = output;
- _wrapper = new ATagHelper().ToWrapper();
- Id.SetId("id");
- }
-
- ///
- /// 获取结果
- ///
- private string GetResult() {
- var result = _wrapper.GetResult();
- _output.WriteLine( result );
- return result;
- }
-
- ///
- /// 测试默认输出
- ///
- [Fact]
- public void TestDefault() {
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试链接地址
- ///
- [Fact]
- public void TestHref() {
- _wrapper.SetContextAttribute( UiConst.Href, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试链接地址
- ///
- [Fact]
- public void TestBindHref() {
- _wrapper.SetContextAttribute( AngularConst.BindHref, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试链接打开目标
- ///
- [Fact]
- public void TestTarget() {
- _wrapper.SetContextAttribute( UiConst.Target, ATarget.Parent );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试链接打开目标
- ///
- [Fact]
- public void TestBindTarget() {
- _wrapper.SetContextAttribute( AngularConst.BindTarget, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试链接关系
- ///
- [Fact]
- public void TestRel() {
- _wrapper.SetContextAttribute( UiConst.Rel, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试链接关系
- ///
- [Fact]
- public void TestBindRel() {
- _wrapper.SetContextAttribute( AngularConst.BindRel, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试危险状态
- ///
- [Fact]
- public void TestDanger() {
- _wrapper.SetContextAttribute( UiConst.Danger, true );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试路由链接
- ///
- [Fact]
- public void TestRouterLink() {
- _wrapper.SetContextAttribute( AngularConst.RouterLink, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试路由链接
- ///
- [Fact]
- public void TestBindRouterLink() {
- _wrapper.SetContextAttribute( AngularConst.BindRouterLink, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试活动路由链接
- ///
- [Fact]
- public void TestRouterLinkActive() {
- _wrapper.SetContextAttribute( AngularConst.RouterLinkActive, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试活动路由链接
- ///
- [Fact]
- public void TestBindRouterLinkActive() {
- _wrapper.SetContextAttribute( AngularConst.BindRouterLinkActive, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试下拉菜单
- ///
- [Fact]
- public void TestDropdownMenu() {
- _wrapper.SetContextAttribute( UiConst.DropdownMenu, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试下拉菜单弹出位置
- ///
- [Fact]
- public void TestDropdownMenuPlacement() {
- _wrapper.SetContextAttribute( UiConst.DropdownMenuPlacement, DropdownMenuPlacement.BottomLeft );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试下拉菜单弹出位置
- ///
- [Fact]
- public void TestBindDropdownMenuPlacement() {
- _wrapper.SetContextAttribute( AngularConst.BindDropdownMenuPlacement, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试下拉菜单触发方式
- ///
- [Fact]
- public void TestDropdownMenuTrigger() {
- _wrapper.SetContextAttribute( UiConst.DropdownMenuTrigger, DropdownMenuTrigger.Click );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试下拉菜单触发方式
- ///
- [Fact]
- public void TestBindDropdownMenuTrigger() {
- _wrapper.SetContextAttribute( AngularConst.BindDropdownMenuTrigger, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试点击隐藏下拉菜单
- ///
- [Fact]
- public void TestDropdownMenuClickHide() {
- _wrapper.SetContextAttribute( UiConst.DropdownMenuClickHide, "false" );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试下拉菜单可见性
- ///
- [Fact]
- public void TestDropdownMenuVisible() {
- _wrapper.SetContextAttribute( UiConst.DropdownMenuVisible, "false" );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试下拉菜单可见性
- ///
- [Fact]
- public void TestBindonDropdownMenuVisible() {
- _wrapper.SetContextAttribute( AngularConst.BindonDropdownMenuVisible, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试下拉菜单根元素类名
- ///
- [Fact]
- public void TestDropdownMenuOverlayClassName() {
- _wrapper.SetContextAttribute( UiConst.DropdownMenuOverlayClassName, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试下拉菜单根元素类名
- ///
- [Fact]
- public void TestBindDropdownMenuOverlayClassName() {
- _wrapper.SetContextAttribute( AngularConst.BindDropdownMenuOverlayClassName, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试下拉菜单根元素样式
- ///
- [Fact]
- public void TestDropdownMenuOverlayStyle() {
- _wrapper.SetContextAttribute( UiConst.DropdownMenuOverlayStyle, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试间距项
- ///
- [Fact]
- public void TestSpaceItem() {
- _wrapper.SetContextAttribute( UiConst.SpaceItem, true );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试查询表单链接 - 查询条件数量超过初始显示数量则显示
- ///
- [Fact]
- public void TestIsSearch_1() {
- _wrapper.SetContextAttribute( UiConst.IsSearch, true );
- var formShareConfig = new FormShareConfig { SearchFormShowNumber = 1 };
- formShareConfig.AddColumnId( "a" );
- formShareConfig.AddColumnId( "b" );
- formShareConfig.AddColumnId( "action" );
- _wrapper.SetItem( formShareConfig );
-
- var result = new StringBuilder();
- result.Append( "" );
- result.Append( "{{expand?'收起':'展开'}}" );
- result.Append( "" );
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试查询表单链接 - 查询条件数量超过初始显示数量则显示 - 多语言
- ///
- [Fact]
- public void TestIsSearch_2() {
- NgZorroOptionsService.SetOptions( new NgZorroOptions { EnableI18n = true } );
- _wrapper.SetContextAttribute( UiConst.IsSearch, true );
- var formShareConfig = new FormShareConfig { SearchFormShowNumber = 1 };
- formShareConfig.AddColumnId( "a" );
- formShareConfig.AddColumnId( "b" );
- formShareConfig.AddColumnId( "action" );
- _wrapper.SetItem( formShareConfig );
-
- var result = new StringBuilder();
- result.Append( "" );
- result.Append( "{{expand?('util.collapse'|i18n):('util.expand'|i18n)}}" );
- result.Append( "" );
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试查询表单链接 - 查询条件数量少于等于初始显示数量则不显示
- ///
- [Fact]
- public void TestIsSearch_3() {
- _wrapper.SetContextAttribute( UiConst.IsSearch, true );
- var formShareConfig = new FormShareConfig { SearchFormShowNumber = 2 };
- formShareConfig.AddColumnId( "a" );
- formShareConfig.AddColumnId( "b" );
- formShareConfig.AddColumnId( "action" );
- _wrapper.SetItem( formShareConfig );
- Assert.Empty( GetResult() );
- }
-
- ///
- /// 测试显示表格设置
- ///
- [Fact]
- public void TestShowTableSettings() {
- _wrapper.SetContextAttribute( UiConst.ShowTableSettings, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- result.Append( "" );
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试显示表格设置 - 多语言
- ///
- [Fact]
- public void TestShowTableSettings_i18n() {
- NgZorroOptionsService.SetOptions( new NgZorroOptions { EnableI18n = true } );
- _wrapper.SetContextAttribute( UiConst.ShowTableSettings, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- result.Append( "" );
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试全屏
- ///
- [Fact]
- public void TestFullscreen() {
- _wrapper.SetContextAttribute( UiConst.Fullscreen, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- result.Append( "" );
- result.Append( "" );
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试全屏 - 多语言
- ///
- [Fact]
- public void TestFullscreen_I18n() {
- NgZorroOptionsService.SetOptions( new NgZorroOptions { EnableI18n = true } );
- _wrapper.SetContextAttribute( UiConst.Fullscreen, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- result.Append( "" );
- result.Append( "" );
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试全屏外层容器样式类名
- ///
- [Fact]
- public void TestFullscreenWrapClass() {
- _wrapper.SetContextAttribute( UiConst.Fullscreen, "a" );
- _wrapper.SetContextAttribute( UiConst.FullscreenWrapClass, "b" );
- var result = new StringBuilder();
- result.Append( "" );
- result.Append( "" );
- result.Append( "" );
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试全屏包装
- ///
- [Fact]
- public void TestFullscreenPack() {
- _wrapper.SetContextAttribute( UiConst.Fullscreen, "a" );
- _wrapper.SetContextAttribute( UiConst.FullscreenPack, false );
- var result = new StringBuilder();
- result.Append( "" );
- result.Append( "" );
- result.Append( "" );
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试测试全屏标题
- ///
- [Fact]
- public void TestFullscreenTitle() {
- _wrapper.SetContextAttribute( UiConst.Fullscreen, "a" );
- _wrapper.SetContextAttribute( UiConst.FullscreenTitle, "b" );
- var result = new StringBuilder();
- result.Append( "" );
- result.Append( "" );
- result.Append( "" );
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试内容
- ///
- [Fact]
- public void TestContent() {
- _wrapper.AppendContent( "a" );
- var result = new StringBuilder();
- result.Append( "a" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试单击事件
- ///
- [Fact]
- public void TestOnClick() {
- _wrapper.SetContextAttribute( UiConst.OnClick, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试下拉菜单显示状态变化事件
- ///
- [Fact]
- public void TestOnVisibleChange() {
- _wrapper.SetContextAttribute( UiConst.OnVisibleChange, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
- }
+using System.Text;
+using Util.Helpers;
+using Util.Ui.Angular.Configs;
+using Util.Ui.Configs;
+using Util.Ui.Enums;
+using Util.Ui.NgZorro.Components.Buttons;
+using Util.Ui.NgZorro.Components.Forms.Configs;
+using Util.Ui.NgZorro.Configs;
+using Util.Ui.NgZorro.Enums;
+using Util.Ui.TagHelpers;
+using Xunit;
+using Xunit.Abstractions;
+
+namespace Util.Ui.NgZorro.Tests.Buttons {
+ ///
+ /// 链接测试
+ ///
+ public class ATagHelperTest {
+ ///
+ /// 输出工具
+ ///
+ private readonly ITestOutputHelper _output;
+ ///
+ /// TagHelper包装器
+ ///
+ private readonly TagHelperWrapper _wrapper;
+
+ ///
+ /// 测试初始化
+ ///
+ public ATagHelperTest( ITestOutputHelper output ) {
+ _output = output;
+ _wrapper = new ATagHelper().ToWrapper();
+ Id.SetId( "id" );
+ }
+
+ ///
+ /// 获取结果
+ ///
+ private string GetResult() {
+ var result = _wrapper.GetResult();
+ _output.WriteLine( result );
+ return result;
+ }
+
+ ///
+ /// 测试默认输出
+ ///
+ [Fact]
+ public void TestDefault() {
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试链接地址
+ ///
+ [Fact]
+ public void TestHref() {
+ _wrapper.SetContextAttribute( UiConst.Href, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试链接地址
+ ///
+ [Fact]
+ public void TestBindHref() {
+ _wrapper.SetContextAttribute( AngularConst.BindHref, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试链接打开目标
+ ///
+ [Fact]
+ public void TestTarget() {
+ _wrapper.SetContextAttribute( UiConst.Target, ATarget.Parent );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试链接打开目标
+ ///
+ [Fact]
+ public void TestBindTarget() {
+ _wrapper.SetContextAttribute( AngularConst.BindTarget, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试链接关系
+ ///
+ [Fact]
+ public void TestRel() {
+ _wrapper.SetContextAttribute( UiConst.Rel, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试链接关系
+ ///
+ [Fact]
+ public void TestBindRel() {
+ _wrapper.SetContextAttribute( AngularConst.BindRel, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试危险状态
+ ///
+ [Fact]
+ public void TestDanger() {
+ _wrapper.SetContextAttribute( UiConst.Danger, true );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试路由链接
+ ///
+ [Fact]
+ public void TestRouterLink() {
+ _wrapper.SetContextAttribute( AngularConst.RouterLink, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试路由链接
+ ///
+ [Fact]
+ public void TestBindRouterLink() {
+ _wrapper.SetContextAttribute( AngularConst.BindRouterLink, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试活动路由链接
+ ///
+ [Fact]
+ public void TestRouterLinkActive() {
+ _wrapper.SetContextAttribute( AngularConst.RouterLinkActive, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试活动路由链接
+ ///
+ [Fact]
+ public void TestBindRouterLinkActive() {
+ _wrapper.SetContextAttribute( AngularConst.BindRouterLinkActive, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试路由查询参数
+ ///
+ [Fact]
+ public void TestQueryParams() {
+ _wrapper.SetContextAttribute( UiConst.QueryParams, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试路由链接查询参数处理方式
+ ///
+ [Fact]
+ public void TestQueryParamsHandling() {
+ _wrapper.SetContextAttribute( UiConst.QueryParamsHandling, QueryParamsHandling.Merge );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试路由链接查询参数处理方式
+ ///
+ [Fact]
+ public void TestBindQueryParamsHandling() {
+ _wrapper.SetContextAttribute( AngularConst.BindQueryParamsHandling, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试下拉菜单
+ ///
+ [Fact]
+ public void TestDropdownMenu() {
+ _wrapper.SetContextAttribute( UiConst.DropdownMenu, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试下拉菜单弹出位置
+ ///
+ [Fact]
+ public void TestDropdownMenuPlacement() {
+ _wrapper.SetContextAttribute( UiConst.DropdownMenuPlacement, DropdownMenuPlacement.BottomLeft );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试下拉菜单弹出位置
+ ///
+ [Fact]
+ public void TestBindDropdownMenuPlacement() {
+ _wrapper.SetContextAttribute( AngularConst.BindDropdownMenuPlacement, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试下拉菜单触发方式
+ ///
+ [Fact]
+ public void TestDropdownMenuTrigger() {
+ _wrapper.SetContextAttribute( UiConst.DropdownMenuTrigger, DropdownMenuTrigger.Click );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试下拉菜单触发方式
+ ///
+ [Fact]
+ public void TestBindDropdownMenuTrigger() {
+ _wrapper.SetContextAttribute( AngularConst.BindDropdownMenuTrigger, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试点击隐藏下拉菜单
+ ///
+ [Fact]
+ public void TestDropdownMenuClickHide() {
+ _wrapper.SetContextAttribute( UiConst.DropdownMenuClickHide, "false" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试下拉菜单可见性
+ ///
+ [Fact]
+ public void TestDropdownMenuVisible() {
+ _wrapper.SetContextAttribute( UiConst.DropdownMenuVisible, "false" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试下拉菜单可见性
+ ///
+ [Fact]
+ public void TestBindonDropdownMenuVisible() {
+ _wrapper.SetContextAttribute( AngularConst.BindonDropdownMenuVisible, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试下拉菜单根元素类名
+ ///
+ [Fact]
+ public void TestDropdownMenuOverlayClassName() {
+ _wrapper.SetContextAttribute( UiConst.DropdownMenuOverlayClassName, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试下拉菜单根元素类名
+ ///
+ [Fact]
+ public void TestBindDropdownMenuOverlayClassName() {
+ _wrapper.SetContextAttribute( AngularConst.BindDropdownMenuOverlayClassName, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试下拉菜单根元素样式
+ ///
+ [Fact]
+ public void TestDropdownMenuOverlayStyle() {
+ _wrapper.SetContextAttribute( UiConst.DropdownMenuOverlayStyle, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试间距项
+ ///
+ [Fact]
+ public void TestSpaceItem() {
+ _wrapper.SetContextAttribute( UiConst.SpaceItem, true );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试查询表单链接 - 查询条件数量超过初始显示数量则显示
+ ///
+ [Fact]
+ public void TestIsSearch_1() {
+ _wrapper.SetContextAttribute( UiConst.IsSearch, true );
+ var formShareConfig = new FormShareConfig { SearchFormShowNumber = 1 };
+ formShareConfig.AddColumnId( "a" );
+ formShareConfig.AddColumnId( "b" );
+ formShareConfig.AddColumnId( "action" );
+ _wrapper.SetItem( formShareConfig );
+
+ var result = new StringBuilder();
+ result.Append( "" );
+ result.Append( "{{expand?'收起':'展开'}}" );
+ result.Append( "" );
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试查询表单链接 - 查询条件数量超过初始显示数量则显示 - 多语言
+ ///
+ [Fact]
+ public void TestIsSearch_2() {
+ NgZorroOptionsService.SetOptions( new NgZorroOptions { EnableI18n = true } );
+ _wrapper.SetContextAttribute( UiConst.IsSearch, true );
+ var formShareConfig = new FormShareConfig { SearchFormShowNumber = 1 };
+ formShareConfig.AddColumnId( "a" );
+ formShareConfig.AddColumnId( "b" );
+ formShareConfig.AddColumnId( "action" );
+ _wrapper.SetItem( formShareConfig );
+
+ var result = new StringBuilder();
+ result.Append( "" );
+ result.Append( "{{expand?('util.collapse'|i18n):('util.expand'|i18n)}}" );
+ result.Append( "" );
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试查询表单链接 - 查询条件数量少于等于初始显示数量则不显示
+ ///
+ [Fact]
+ public void TestIsSearch_3() {
+ _wrapper.SetContextAttribute( UiConst.IsSearch, true );
+ var formShareConfig = new FormShareConfig { SearchFormShowNumber = 2 };
+ formShareConfig.AddColumnId( "a" );
+ formShareConfig.AddColumnId( "b" );
+ formShareConfig.AddColumnId( "action" );
+ _wrapper.SetItem( formShareConfig );
+ Assert.Empty( GetResult() );
+ }
+
+ ///
+ /// 测试显示表格设置
+ ///
+ [Fact]
+ public void TestShowTableSettings() {
+ _wrapper.SetContextAttribute( UiConst.ShowTableSettings, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试显示表格设置 - 多语言
+ ///
+ [Fact]
+ public void TestShowTableSettings_i18n() {
+ NgZorroOptionsService.SetOptions( new NgZorroOptions { EnableI18n = true } );
+ _wrapper.SetContextAttribute( UiConst.ShowTableSettings, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试全屏
+ ///
+ [Fact]
+ public void TestFullscreen() {
+ _wrapper.SetContextAttribute( UiConst.Fullscreen, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试全屏 - 多语言
+ ///
+ [Fact]
+ public void TestFullscreen_I18n() {
+ NgZorroOptionsService.SetOptions( new NgZorroOptions { EnableI18n = true } );
+ _wrapper.SetContextAttribute( UiConst.Fullscreen, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试全屏外层容器样式类名
+ ///
+ [Fact]
+ public void TestFullscreenWrapClass() {
+ _wrapper.SetContextAttribute( UiConst.Fullscreen, "a" );
+ _wrapper.SetContextAttribute( UiConst.FullscreenWrapClass, "b" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试全屏包装
+ ///
+ [Fact]
+ public void TestFullscreenPack() {
+ _wrapper.SetContextAttribute( UiConst.Fullscreen, "a" );
+ _wrapper.SetContextAttribute( UiConst.FullscreenPack, false );
+ var result = new StringBuilder();
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试测试全屏标题
+ ///
+ [Fact]
+ public void TestFullscreenTitle() {
+ _wrapper.SetContextAttribute( UiConst.Fullscreen, "a" );
+ _wrapper.SetContextAttribute( UiConst.FullscreenTitle, "b" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试内容
+ ///
+ [Fact]
+ public void TestContent() {
+ _wrapper.AppendContent( "a" );
+ var result = new StringBuilder();
+ result.Append( "a" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试单击事件
+ ///
+ [Fact]
+ public void TestOnClick() {
+ _wrapper.SetContextAttribute( UiConst.OnClick, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试下拉菜单显示状态变化事件
+ ///
+ [Fact]
+ public void TestOnVisibleChange() {
+ _wrapper.SetContextAttribute( UiConst.OnVisibleChange, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试选项卡路由联动
+ ///
+ [Fact]
+ public void TestTabLink_1() {
+ _wrapper.SetContextAttribute( UiConst.TabLink, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试选项卡路由联动 - 空值
+ ///
+ [Fact]
+ public void TestTabLink_2() {
+ _wrapper.SetContextAttribute( UiConst.TabLink, "" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试选项卡路由联动 - true
+ ///
+ [Fact]
+ public void TestTabLink_3() {
+ _wrapper.SetContextAttribute( UiConst.TabLink, "true" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+ }
}
\ No newline at end of file
diff --git a/test/Util.Ui.NgZorro.Tests/Buttons/ButtonTagHelperTest.Link.cs b/test/Util.Ui.NgZorro.Tests/Buttons/ButtonTagHelperTest.Link.cs
new file mode 100644
index 000000000..e57eee426
--- /dev/null
+++ b/test/Util.Ui.NgZorro.Tests/Buttons/ButtonTagHelperTest.Link.cs
@@ -0,0 +1,228 @@
+using System.Text;
+using Util.Ui.Angular.Configs;
+using Util.Ui.Configs;
+using Util.Ui.Enums;
+using Util.Ui.NgZorro.Components.Forms.Configs;
+using Util.Ui.NgZorro.Enums;
+using Xunit;
+
+namespace Util.Ui.NgZorro.Tests.Buttons {
+ ///
+ /// 按钮测试 - 链接相关
+ ///
+ public partial class ButtonTagHelperTest {
+ ///
+ /// 测试链接按钮
+ ///
+ [Fact]
+ public void TestLinkType() {
+ _wrapper.SetContextAttribute( UiConst.Type, ButtonType.Link );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试链接地址
+ ///
+ [Fact]
+ public void TestHref() {
+ _wrapper.SetContextAttribute( UiConst.Type, ButtonType.Link )
+ .SetContextAttribute( UiConst.Href, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试链接地址
+ ///
+ [Fact]
+ public void TestBindHref() {
+ _wrapper.SetContextAttribute( UiConst.Type, ButtonType.Link )
+ .SetContextAttribute( AngularConst.BindHref, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试链接打开目标
+ ///
+ [Fact]
+ public void TestTarget() {
+ _wrapper.SetContextAttribute( UiConst.Type, ButtonType.Link )
+ .SetContextAttribute( UiConst.Target, ATarget.Parent );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试链接打开目标
+ ///
+ [Fact]
+ public void TestBindTarget() {
+ _wrapper.SetContextAttribute( UiConst.Type, ButtonType.Link )
+ .SetContextAttribute( AngularConst.BindTarget, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试链接关系
+ ///
+ [Fact]
+ public void TestRel() {
+ _wrapper.SetContextAttribute( UiConst.Type, ButtonType.Link )
+ .SetContextAttribute( UiConst.Rel, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试链接关系
+ ///
+ [Fact]
+ public void TestBindRel() {
+ _wrapper.SetContextAttribute( UiConst.Type, ButtonType.Link )
+ .SetContextAttribute( AngularConst.BindRel, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试路由链接
+ ///
+ [Fact]
+ public void TestRouterLink() {
+ _wrapper.SetContextAttribute( UiConst.Type, ButtonType.Link )
+ .SetContextAttribute( AngularConst.RouterLink, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试路由链接
+ ///
+ [Fact]
+ public void TestBindRouterLink() {
+ _wrapper.SetContextAttribute( UiConst.Type, ButtonType.Link )
+ .SetContextAttribute( AngularConst.BindRouterLink, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试活动路由链接
+ ///
+ [Fact]
+ public void TestRouterLinkActive() {
+ _wrapper.SetContextAttribute( UiConst.Type, ButtonType.Link )
+ .SetContextAttribute( AngularConst.RouterLinkActive, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试活动路由链接
+ ///
+ [Fact]
+ public void TestBindRouterLinkActive() {
+ _wrapper.SetContextAttribute( UiConst.Type, ButtonType.Link )
+ .SetContextAttribute( AngularConst.BindRouterLinkActive, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试路由查询参数
+ ///
+ [Fact]
+ public void TestQueryParams() {
+ _wrapper.SetContextAttribute( UiConst.Type, ButtonType.Link )
+ .SetContextAttribute( UiConst.QueryParams, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试路由链接查询参数处理方式
+ ///
+ [Fact]
+ public void TestQueryParamsHandling() {
+ _wrapper.SetContextAttribute( UiConst.Type, ButtonType.Link )
+ .SetContextAttribute( UiConst.QueryParamsHandling, QueryParamsHandling.Merge );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试路由链接查询参数处理方式
+ ///
+ [Fact]
+ public void TestBindQueryParamsHandling() {
+ _wrapper.SetContextAttribute( UiConst.Type, ButtonType.Link )
+ .SetContextAttribute( AngularConst.BindQueryParamsHandling, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试查询表单链接
+ ///
+ [Fact]
+ public void TestIsSearch() {
+ _wrapper.SetContextAttribute( UiConst.Type, ButtonType.Link )
+ .SetContextAttribute( UiConst.IsSearch, true );
+ var formShareConfig = new FormShareConfig { SearchFormShowNumber = 1 };
+ formShareConfig.AddColumnId( "a" );
+ formShareConfig.AddColumnId( "b" );
+ formShareConfig.AddColumnId( "action" );
+ _wrapper.SetItem( formShareConfig );
+
+ var result = new StringBuilder();
+ result.Append( "" );
+ result.Append( "{{expand?'收起':'展开'}}" );
+ result.Append( "" );
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试显示表格设置
+ ///
+ [Fact]
+ public void TestShowTableSettings() {
+ _wrapper.SetContextAttribute( UiConst.Type, ButtonType.Link )
+ .SetContextAttribute( UiConst.ShowTableSettings, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试选项卡路由联动
+ ///
+ [Fact]
+ public void TestTabLink() {
+ _wrapper.SetContextAttribute( UiConst.Type, ButtonType.Link )
+ .SetContextAttribute( UiConst.TabLink, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+ }
+}
diff --git a/test/Util.Ui.NgZorro.Tests/Buttons/ButtonTagHelperTest.Tooltip.cs b/test/Util.Ui.NgZorro.Tests/Buttons/ButtonTagHelperTest.Tooltip.cs
index 5790410ec..03cad7a01 100644
--- a/test/Util.Ui.NgZorro.Tests/Buttons/ButtonTagHelperTest.Tooltip.cs
+++ b/test/Util.Ui.NgZorro.Tests/Buttons/ButtonTagHelperTest.Tooltip.cs
@@ -183,13 +183,24 @@ public void TestBindTooltipTrigger() {
/// 测试文字提示背景颜色
///
[Fact]
- public void TestTooltipColor() {
- _wrapper.SetContextAttribute( UiConst.TooltipColor, AntDesignColor.Blue );
+ public void TestTooltipColorType() {
+ _wrapper.SetContextAttribute( UiConst.TooltipColorType, AntDesignColor.Blue );
var result = new StringBuilder();
result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
+ ///
+ /// 测试文字提示背景颜色
+ ///
+ [Fact]
+ public void TestTooltipColor() {
+ _wrapper.SetContextAttribute( UiConst.TooltipColor, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
///
/// 测试文字提示背景颜色
///
diff --git a/test/Util.Ui.NgZorro.Tests/Buttons/ButtonTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Buttons/ButtonTagHelperTest.cs
index 67ae27d4c..18a52f862 100644
--- a/test/Util.Ui.NgZorro.Tests/Buttons/ButtonTagHelperTest.cs
+++ b/test/Util.Ui.NgZorro.Tests/Buttons/ButtonTagHelperTest.cs
@@ -74,17 +74,6 @@ public void TestType() {
Assert.Equal( result.ToString(), GetResult() );
}
- ///
- /// 测试链接按钮
- ///
- [Fact]
- public void TestLinkType() {
- _wrapper.SetContextAttribute( UiConst.Type, ButtonType.Link );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
///
/// 测试按钮类型
///
@@ -96,50 +85,6 @@ public void TestBindType() {
Assert.Equal( result.ToString(), GetResult() );
}
- ///
- /// 测试路由链接
- ///
- [Fact]
- public void TestRouterLink() {
- _wrapper.SetContextAttribute( UiConst.Type, ButtonType.Link ).SetContextAttribute( AngularConst.RouterLink, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试路由链接
- ///
- [Fact]
- public void TestBindRouterLink() {
- _wrapper.SetContextAttribute( UiConst.Type, ButtonType.Link ).SetContextAttribute( AngularConst.BindRouterLink, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试活动路由链接
- ///
- [Fact]
- public void TestRouterLinkActive() {
- _wrapper.SetContextAttribute( UiConst.Type, ButtonType.Link ).SetContextAttribute( AngularConst.RouterLinkActive, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试活动路由链接
- ///
- [Fact]
- public void TestBindRouterLinkActive() {
- _wrapper.SetContextAttribute( UiConst.Type, ButtonType.Link ).SetContextAttribute( AngularConst.BindRouterLinkActive, "a" );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
///
/// 测试按钮尺寸
///
diff --git a/test/Util.Ui.NgZorro.Tests/Cards/CardTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Cards/CardTagHelperTest.cs
index 2a24a6d50..f94d78e65 100644
--- a/test/Util.Ui.NgZorro.Tests/Cards/CardTagHelperTest.cs
+++ b/test/Util.Ui.NgZorro.Tests/Cards/CardTagHelperTest.cs
@@ -215,6 +215,17 @@ public void TestBindSize() {
Assert.Equal( result.ToString(), GetResult() );
}
+ ///
+ /// 测试间距项
+ ///
+ [Fact]
+ public void TestSpaceItem() {
+ _wrapper.SetContextAttribute( UiConst.SpaceItem, true );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
///
/// 测试单击事件
///
diff --git a/test/Util.Ui.NgZorro.Tests/Checkboxes/CheckboxTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Checkboxes/CheckboxTagHelperTest.cs
index db2663513..16925aa8c 100644
--- a/test/Util.Ui.NgZorro.Tests/Checkboxes/CheckboxTagHelperTest.cs
+++ b/test/Util.Ui.NgZorro.Tests/Checkboxes/CheckboxTagHelperTest.cs
@@ -211,7 +211,19 @@ public void TestControlSpan() {
/// 测试间距项
///
[Fact]
- public void TestSpaceItem() {
+ public void TestSpaceItem_1() {
+ _wrapper.SetContextAttribute( UiConst.SpaceItem, true );
+
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试间距项
+ ///
+ [Fact]
+ public void TestSpaceItem_2() {
_wrapper.SetContextAttribute( UiConst.LabelText, "a" );
_wrapper.SetContextAttribute( UiConst.SpaceItem, true );
diff --git a/test/Util.Ui.NgZorro.Tests/Containers/ContainerTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Containers/ContainerTagHelperTest.cs
index 4f2f27107..a72611103 100644
--- a/test/Util.Ui.NgZorro.Tests/Containers/ContainerTagHelperTest.cs
+++ b/test/Util.Ui.NgZorro.Tests/Containers/ContainerTagHelperTest.cs
@@ -200,5 +200,27 @@ public void TestMentionSuggestion() {
result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
+
+ ///
+ /// 测试间距项
+ ///
+ [Fact]
+ public void TestSpaceItem() {
+ _wrapper.SetContextAttribute( UiConst.SpaceItem, true );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试*ngTemplateOutlet
+ ///
+ [Fact]
+ public void TestNgTemplateOutlet() {
+ _wrapper.SetContextAttribute( AngularConst.NgTemplateOutlet, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
}
}
\ No newline at end of file
diff --git a/test/Util.Ui.NgZorro.Tests/Dropdowns/DropdownMenuTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Dropdowns/DropdownMenuTagHelperTest.cs
index 497aa38dd..88cfcaf0e 100644
--- a/test/Util.Ui.NgZorro.Tests/Dropdowns/DropdownMenuTagHelperTest.cs
+++ b/test/Util.Ui.NgZorro.Tests/Dropdowns/DropdownMenuTagHelperTest.cs
@@ -1,7 +1,7 @@
using System.Text;
-using Util.Ui.Angular.Configs;
using Util.Ui.Configs;
using Util.Ui.NgZorro.Components.Dropdowns;
+using Util.Ui.NgZorro.Components.Menus;
using Util.Ui.TagHelpers;
using Xunit;
using Xunit.Abstractions;
@@ -87,39 +87,30 @@ public void TestContent() {
}
///
- /// 测试不创建ul标签
- ///
- [Fact]
- public void TestNotCreateUl() {
- _wrapper.SetContextAttribute( UiConst.NotCreateUl, true );
- var result = new StringBuilder();
- result.Append( "" );
- Assert.Equal( result.ToString(), GetResult() );
- }
-
- ///
- /// 测试设置内容 - 不创建ul标签
+ /// 测试单击事件
///
[Fact]
- public void TestNotCreateUl_Content() {
- _wrapper.SetContextAttribute( UiConst.NotCreateUl, true );
- _wrapper.AppendContent( "a" );
+ public void TestOnClick() {
+ _wrapper.SetContextAttribute( UiConst.OnClick, "a" );
var result = new StringBuilder();
result.Append( "" );
- result.Append( "a" );
+ result.Append( "" );
result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
///
- /// 测试单击事件
+ /// 测试手工创建菜单标签
///
[Fact]
- public void TestOnClick() {
- _wrapper.SetContextAttribute( UiConst.OnClick, "a" );
+ public void TestMenu() {
+ var menu = new MenuTagHelper().ToWrapper();
+ _wrapper.AppendContent( menu );
+
var result = new StringBuilder();
result.Append( "" );
- result.Append( "" );
+ result.Append( "" );
result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
diff --git a/test/Util.Ui.NgZorro.Tests/Icons/IconTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Icons/IconTagHelperTest.cs
index 313a8c945..29b916cd6 100644
--- a/test/Util.Ui.NgZorro.Tests/Icons/IconTagHelperTest.cs
+++ b/test/Util.Ui.NgZorro.Tests/Icons/IconTagHelperTest.cs
@@ -126,6 +126,17 @@ public void TestRotate() {
Assert.Equal( result.ToString(), GetResult() );
}
+ ///
+ /// 测试双色图标主题色
+ ///
+ [Fact]
+ public void TestTwotoneColorType() {
+ _wrapper.SetContextAttribute( AntDesignConst.TwotoneColorType, AntDesignColor.Red );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
///
/// 测试双色图标主题色
///
diff --git a/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.Events.cs b/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.Events.cs
index 4f3bd629e..3268c3672 100644
--- a/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.Events.cs
+++ b/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.Events.cs
@@ -29,16 +29,38 @@ public void TestOnInput() {
Assert.Equal( result.ToString(), GetResult() );
}
+ ///
+ /// 测试失去焦点事件
+ ///
+ [Fact]
+ public void TestOnBlur() {
+ _wrapper.SetContextAttribute( UiConst.OnBlur, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
///
/// 测试回车事件
///
[Fact]
- public void TestOnEnter() {
- _wrapper.SetContextAttribute( UiConst.OnEnter, "a" );
+ public void TestOnKeyupEnter() {
+ _wrapper.SetContextAttribute( UiConst.OnKeyupEnter, "a" );
var result = new StringBuilder();
result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
+
+ ///
+ /// 测试回车事件
+ ///
+ [Fact]
+ public void TestOnKeydownEnter() {
+ _wrapper.SetContextAttribute( UiConst.OnKeydownEnter, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
}
}
diff --git a/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.Expression.cs b/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.Expression.cs
index 44d5ec247..a5143a4ae 100644
--- a/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.Expression.cs
+++ b/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.Expression.cs
@@ -40,12 +40,12 @@ public void TestFor_2() {
result.Append( "密码" );
result.Append( "" );
result.Append( "" );
- result.Append( "" );
- result.Append( "" );
result.Append( "" );
result.Append( "" );
result.Append( "" );
- result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
diff --git a/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.InputGroup.cs b/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.InputGroup.cs
index a28b65bc6..8008efff5 100644
--- a/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.InputGroup.cs
+++ b/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.InputGroup.cs
@@ -312,11 +312,11 @@ public void TestAllowClear() {
_wrapper.SetContextAttribute( AngularConst.NgModel, "code" );
var result = new StringBuilder();
result.Append( "" );
- result.Append( "" );
- result.Append( "" );
result.Append( "" );
result.Append( "" );
result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
@@ -329,11 +329,11 @@ public void TestAllowClear_2() {
_wrapper.SetContextAttribute( AngularConst.NgModel, "code" );
var result = new StringBuilder();
result.Append( "" );
- result.Append( "" );
- result.Append( "" );
result.Append( "" );
result.Append( "" );
result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
@@ -353,11 +353,11 @@ public void TestAllowClear_3() {
var result = new StringBuilder();
result.Append( "" );
- result.Append( "" );
- result.Append( "" );
result.Append( "" );
result.Append( "" );
result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
//执行
var html = inputGroup.GetResult();
@@ -398,11 +398,11 @@ public void TestType_Password() {
_wrapper.SetContextAttribute( UiConst.Type, InputType.Password );
var result = new StringBuilder();
result.Append( "" );
- result.Append( "" );
- result.Append( "" );
result.Append( "" );
result.Append( "" );
result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
@@ -416,12 +416,12 @@ public void TestPassword_AllowClear() {
_wrapper.SetContextAttribute( AngularConst.NgModel, "code" );
var result = new StringBuilder();
result.Append( "" );
- result.Append( "" );
- result.Append( "" );
result.Append( "" );
result.Append( "" );
result.Append( "" );
result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
}
diff --git a/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.NgIf.cs b/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.NgIf.cs
index e513d457e..45126a807 100644
--- a/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.NgIf.cs
+++ b/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.NgIf.cs
@@ -15,7 +15,9 @@ public partial class InputTagHelperTest {
public void TestNgIf_1() {
_wrapper.SetContextAttribute( AngularConst.NgIf, "a" );
var result = new StringBuilder();
- result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
@@ -35,6 +37,50 @@ public void TestNgIf_2() {
result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
+
+ ///
+ /// 测试ngIf* - 生成nz-input-group容器
+ ///
+ [Fact]
+ public void TestNgIf_3() {
+ _wrapper.SetContextAttribute( UiConst.AllowClear, true );
+ _wrapper.SetContextAttribute( AngularConst.NgModel, "code" )
+ .SetContextAttribute( AngularConst.NgIf, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试ngIf* - 生成form-item容器 和 nz-input-group容器
+ ///
+ [Fact]
+ public void TestNgIf_4() {
+ _wrapper.SetContextAttribute( UiConst.AllowClear, true )
+ .SetContextAttribute( AngularConst.NgModel, "code" )
+ .SetContextAttribute( UiConst.LabelText, "a" )
+ .SetContextAttribute( AngularConst.NgIf, "b" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ result.Append( "a" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
}
}
diff --git a/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.Space.cs b/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.Space.cs
index 3ee383421..539fd73e2 100644
--- a/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.Space.cs
+++ b/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.Space.cs
@@ -12,7 +12,38 @@ public partial class InputTagHelperTest {
/// 测试间距项
///
[Fact]
- public void TestSpaceItem() {
+ public void TestSpaceItem_1() {
+ _wrapper.SetContextAttribute( UiConst.SpaceItem, true );
+
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试间距项 - 创建 nz-input-group
+ ///
+ [Fact]
+ public void TestSpaceItem_2() {
+ _wrapper.SetContextAttribute( UiConst.AllowClear, true );
+ _wrapper.SetContextAttribute( AngularConst.NgModel, "code" );
+ _wrapper.SetContextAttribute( UiConst.SpaceItem, true );
+
+ var result = new StringBuilder();
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试间距项 - 创建 nz-form-item
+ ///
+ [Fact]
+ public void TestSpaceItem_3() {
_wrapper.SetContextAttribute( UiConst.Required, "true" );
_wrapper.SetContextAttribute( AngularConst.NgModel, "model" );
_wrapper.SetContextAttribute( UiConst.SpaceItem, true );
diff --git a/test/Util.Ui.NgZorro.Tests/Menus/MenuGroupTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Menus/MenuGroupTagHelperTest.cs
index 0b51e3088..ad367eab7 100644
--- a/test/Util.Ui.NgZorro.Tests/Menus/MenuGroupTagHelperTest.cs
+++ b/test/Util.Ui.NgZorro.Tests/Menus/MenuGroupTagHelperTest.cs
@@ -2,6 +2,7 @@
using Util.Ui.Angular.Configs;
using Util.Ui.Configs;
using Util.Ui.NgZorro.Components.Menus;
+using Util.Ui.NgZorro.Configs;
using Util.Ui.TagHelpers;
using Xunit;
using Xunit.Abstractions;
@@ -58,6 +59,18 @@ public void TestTitle() {
Assert.Equal( result.ToString(), GetResult() );
}
+ ///
+ /// 测试标题 - 多语言
+ ///
+ [Fact]
+ public void TestTitle_I18n() {
+ NgZorroOptionsService.SetOptions( new NgZorroOptions { EnableI18n = true } );
+ _wrapper.SetContextAttribute( UiConst.Title, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
///
/// 测试标题
///
diff --git a/test/Util.Ui.NgZorro.Tests/Menus/MenuItemTagHelperTest.I18n.cs b/test/Util.Ui.NgZorro.Tests/Menus/MenuItemTagHelperTest.I18n.cs
index 44e2acbb3..d831f7287 100644
--- a/test/Util.Ui.NgZorro.Tests/Menus/MenuItemTagHelperTest.I18n.cs
+++ b/test/Util.Ui.NgZorro.Tests/Menus/MenuItemTagHelperTest.I18n.cs
@@ -15,7 +15,9 @@ public partial class MenuItemTagHelperTest {
public void TestText() {
_wrapper.SetContextAttribute( UiConst.Text, "a" );
var result = new StringBuilder();
- result.Append( "a" );
+ result.Append( "" );
+ result.Append( "a" );
+ result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
@@ -27,7 +29,9 @@ public void TestText_I18n() {
NgZorroOptionsService.SetOptions( new NgZorroOptions { EnableI18n = true } );
_wrapper.SetContextAttribute( UiConst.Text, "a" );
var result = new StringBuilder();
- result.Append( "{{'a'|i18n}}" );
+ result.Append( "" );
+ result.Append( "{{'a'|i18n}}" );
+ result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
@@ -38,7 +42,9 @@ public void TestText_I18n() {
public void TestTextUpdate() {
_wrapper.SetContextAttribute( UiConst.TextUpdate, true );
var result = new StringBuilder();
- result.Append( "Update" );
+ result.Append( "" );
+ result.Append( "Update" );
+ result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
@@ -50,7 +56,9 @@ public void TestTextUpdate_I18n() {
NgZorroOptionsService.SetOptions( new NgZorroOptions { EnableI18n = true } );
_wrapper.SetContextAttribute( UiConst.TextUpdate, true );
var result = new StringBuilder();
- result.Append( "{{'util.update'|i18n}}" );
+ result.Append( "" );
+ result.Append( "{{'util.update'|i18n}}" );
+ result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
@@ -61,7 +69,9 @@ public void TestTextUpdate_I18n() {
public void TestTextDelete() {
_wrapper.SetContextAttribute( UiConst.TextDelete, true );
var result = new StringBuilder();
- result.Append( "Delete" );
+ result.Append( "" );
+ result.Append( "Delete" );
+ result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
@@ -73,7 +83,9 @@ public void TestTextDelete_I18n() {
NgZorroOptionsService.SetOptions( new NgZorroOptions { EnableI18n = true } );
_wrapper.SetContextAttribute( UiConst.TextDelete, true );
var result = new StringBuilder();
- result.Append( "{{'util.delete'|i18n}}" );
+ result.Append( "" );
+ result.Append( "{{'util.delete'|i18n}}" );
+ result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
@@ -84,7 +96,9 @@ public void TestTextDelete_I18n() {
public void TestTextDetail() {
_wrapper.SetContextAttribute( UiConst.TextDetail, true );
var result = new StringBuilder();
- result.Append( "Detail" );
+ result.Append( "" );
+ result.Append( "Detail" );
+ result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
@@ -96,7 +110,9 @@ public void TestTextDetail_I18n() {
NgZorroOptionsService.SetOptions( new NgZorroOptions { EnableI18n = true } );
_wrapper.SetContextAttribute( UiConst.TextDetail, true );
var result = new StringBuilder();
- result.Append( "{{'util.detail'|i18n}}" );
+ result.Append( "" );
+ result.Append( "{{'util.detail'|i18n}}" );
+ result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
@@ -107,7 +123,9 @@ public void TestTextDetail_I18n() {
public void TestTextEnable() {
_wrapper.SetContextAttribute( UiConst.TextEnable, true );
var result = new StringBuilder();
- result.Append( "Enable" );
+ result.Append( "" );
+ result.Append( "Enable" );
+ result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
@@ -119,7 +137,9 @@ public void TestTextEnable_I18n() {
NgZorroOptionsService.SetOptions( new NgZorroOptions { EnableI18n = true } );
_wrapper.SetContextAttribute( UiConst.TextEnable, true );
var result = new StringBuilder();
- result.Append( "{{'util.enable'|i18n}}" );
+ result.Append( "" );
+ result.Append( "{{'util.enable'|i18n}}" );
+ result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
@@ -130,7 +150,9 @@ public void TestTextEnable_I18n() {
public void TestTextDisable() {
_wrapper.SetContextAttribute( UiConst.TextDisable, true );
var result = new StringBuilder();
- result.Append( "Disable" );
+ result.Append( "" );
+ result.Append( "Disable" );
+ result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
@@ -142,7 +164,9 @@ public void TestTextDisable_I18n() {
NgZorroOptionsService.SetOptions( new NgZorroOptions { EnableI18n = true } );
_wrapper.SetContextAttribute( UiConst.TextDisable, true );
var result = new StringBuilder();
- result.Append( "{{'util.disable'|i18n}}" );
+ result.Append( "" );
+ result.Append( "{{'util.disable'|i18n}}" );
+ result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
}
diff --git a/test/Util.Ui.NgZorro.Tests/Menus/MenuItemTagHelperTest.Icon.cs b/test/Util.Ui.NgZorro.Tests/Menus/MenuItemTagHelperTest.Icon.cs
index 42d7486c2..4733ba15e 100644
--- a/test/Util.Ui.NgZorro.Tests/Menus/MenuItemTagHelperTest.Icon.cs
+++ b/test/Util.Ui.NgZorro.Tests/Menus/MenuItemTagHelperTest.Icon.cs
@@ -30,7 +30,8 @@ public void TestIcon_2() {
_wrapper.SetContextAttribute( UiConst.Icon, AntDesignIcon.InfoCircle );
var result = new StringBuilder();
result.Append( "" );
- result.Append( "a" );
+ result.Append( "" );
+ result.Append( "a" );
result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
diff --git a/test/Util.Ui.NgZorro.Tests/Menus/MenuItemTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Menus/MenuItemTagHelperTest.cs
index 6c15a2cd3..7e51a7a1f 100644
--- a/test/Util.Ui.NgZorro.Tests/Menus/MenuItemTagHelperTest.cs
+++ b/test/Util.Ui.NgZorro.Tests/Menus/MenuItemTagHelperTest.cs
@@ -102,6 +102,17 @@ public void TestMatchRouterExact() {
Assert.Equal( result.ToString(), GetResult() );
}
+ ///
+ /// 测试左内边距
+ ///
+ [Fact]
+ public void TestPaddingLeft() {
+ _wrapper.SetContextAttribute( UiConst.PaddingLeft, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
///
/// 测试设置内容
///
diff --git a/test/Util.Ui.NgZorro.Tests/Menus/SubMenuTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Menus/SubMenuTagHelperTest.cs
index e31e49f11..81d3b6ae3 100644
--- a/test/Util.Ui.NgZorro.Tests/Menus/SubMenuTagHelperTest.cs
+++ b/test/Util.Ui.NgZorro.Tests/Menus/SubMenuTagHelperTest.cs
@@ -2,6 +2,7 @@
using Util.Ui.Angular.Configs;
using Util.Ui.Configs;
using Util.Ui.NgZorro.Components.Menus;
+using Util.Ui.NgZorro.Configs;
using Util.Ui.NgZorro.Enums;
using Util.Ui.TagHelpers;
using Xunit;
@@ -59,6 +60,18 @@ public void TestTitle() {
Assert.Equal( result.ToString(), GetResult() );
}
+ ///
+ /// 测试标题 - 多语言
+ ///
+ [Fact]
+ public void TestTitle_I18n() {
+ NgZorroOptionsService.SetOptions( new NgZorroOptions { EnableI18n = true } );
+ _wrapper.SetContextAttribute( UiConst.Title, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
///
/// 测试标题
///
@@ -147,6 +160,39 @@ public void TestBindMenuClassName() {
Assert.Equal( result.ToString(), GetResult() );
}
+ ///
+ /// 测试菜单弹出位置
+ ///
+ [Fact]
+ public void TestPlacement() {
+ _wrapper.SetContextAttribute( UiConst.Placement, DropdownMenuPlacement.BottomLeft );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试菜单弹出位置
+ ///
+ [Fact]
+ public void TestBindPlacement() {
+ _wrapper.SetContextAttribute( AngularConst.BindPlacement, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试左内边距
+ ///
+ [Fact]
+ public void TestPaddingLeft() {
+ _wrapper.SetContextAttribute( UiConst.PaddingLeft, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
///
/// 测试设置内容
///
diff --git a/test/Util.Ui.NgZorro.Tests/Progresses/ProgressTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Progresses/ProgressTagHelperTest.cs
index e30178348..403d8b960 100644
--- a/test/Util.Ui.NgZorro.Tests/Progresses/ProgressTagHelperTest.cs
+++ b/test/Util.Ui.NgZorro.Tests/Progresses/ProgressTagHelperTest.cs
@@ -147,6 +147,17 @@ public void TestBindStrokeLinecap() {
Assert.Equal( result.ToString(), GetResult() );
}
+ ///
+ /// 测试颜色
+ ///
+ [Fact]
+ public void TestStrokeColorType() {
+ _wrapper.SetContextAttribute( UiConst.StrokeColorType, AntDesignColor.Red );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
///
/// 测试颜色
///
@@ -246,6 +257,28 @@ public void TestBindGapPosition() {
Assert.Equal( result.ToString(), GetResult() );
}
+ ///
+ /// 测试尺寸
+ ///
+ [Fact]
+ public void TestSize() {
+ _wrapper.SetContextAttribute( UiConst.Size, ProgressSize.Small );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试尺寸
+ ///
+ [Fact]
+ public void TestBindSize() {
+ _wrapper.SetContextAttribute( AngularConst.BindSize, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
///
/// 测试内容
///
@@ -256,5 +289,16 @@ public void TestContent() {
result.Append( "a" );
Assert.Equal( result.ToString(), GetResult() );
}
+
+ ///
+ /// 测试提示文字
+ ///
+ [Fact]
+ public void TestTooltipTitle() {
+ _wrapper.SetContextAttribute( UiConst.TooltipTitle, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
}
}
\ No newline at end of file
diff --git a/test/Util.Ui.NgZorro.Tests/Results/ResultIconTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Results/ResultIconTagHelperTest.cs
new file mode 100644
index 000000000..c8f118005
--- /dev/null
+++ b/test/Util.Ui.NgZorro.Tests/Results/ResultIconTagHelperTest.cs
@@ -0,0 +1,59 @@
+using System.Text;
+using Util.Ui.NgZorro.Components.Results;
+using Util.Ui.TagHelpers;
+using Xunit;
+using Xunit.Abstractions;
+
+namespace Util.Ui.NgZorro.Tests.Results {
+ ///
+ /// 结果图标测试
+ ///
+ public class ResultIconTagHelperTest {
+ ///
+ /// 输出工具
+ ///
+ private readonly ITestOutputHelper _output;
+ ///
+ /// TagHelper包装器
+ ///
+ private readonly TagHelperWrapper _wrapper;
+
+ ///
+ /// 测试初始化
+ ///
+ public ResultIconTagHelperTest( ITestOutputHelper output ) {
+ _output = output;
+ _wrapper = new ResultIconTagHelper().ToWrapper();
+ }
+
+ ///
+ /// 获取结果
+ ///
+ private string GetResult() {
+ var result = _wrapper.GetResult();
+ _output.WriteLine( result );
+ return result;
+ }
+
+ ///
+ /// 测试默认输出
+ ///
+ [Fact]
+ public void TestDefault() {
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试内容
+ ///
+ [Fact]
+ public void TestContent() {
+ _wrapper.AppendContent( "a" );
+ var result = new StringBuilder();
+ result.Append( "a
" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/Util.Ui.NgZorro.Tests/Spaces/SpaceTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Spaces/SpaceTagHelperTest.cs
index c8fe667b4..f51e94c09 100644
--- a/test/Util.Ui.NgZorro.Tests/Spaces/SpaceTagHelperTest.cs
+++ b/test/Util.Ui.NgZorro.Tests/Spaces/SpaceTagHelperTest.cs
@@ -114,6 +114,28 @@ public void TestBindAlign() {
Assert.Equal( result.ToString(), GetResult() );
}
+ ///
+ /// 测试设置分隔符
+ ///
+ [Fact]
+ public void TestSplit() {
+ _wrapper.SetContextAttribute( UiConst.Split, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试自动换行
+ ///
+ [Fact]
+ public void TestWrap() {
+ _wrapper.SetContextAttribute( UiConst.Wrap, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
///
/// 测试设置内容
///
diff --git a/test/Util.Ui.NgZorro.Tests/Tabs/TabSetTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Tabs/TabSetTagHelperTest.cs
index 2817d8270..0c9df9c40 100644
--- a/test/Util.Ui.NgZorro.Tests/Tabs/TabSetTagHelperTest.cs
+++ b/test/Util.Ui.NgZorro.Tests/Tabs/TabSetTagHelperTest.cs
@@ -268,6 +268,28 @@ public void TestBindAddIcon() {
Assert.Equal( result.ToString(), GetResult() );
}
+ ///
+ /// 测试关闭按钮图标
+ ///
+ [Fact]
+ public void TestCloseIcon() {
+ _wrapper.SetContextAttribute( UiConst.CloseIcon, AntDesignIcon.AccountBook );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试关闭按钮图标
+ ///
+ [Fact]
+ public void TestBindCloseIcon() {
+ _wrapper.SetContextAttribute( AngularConst.BindCloseIcon, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
///
/// 测试内容
///
diff --git a/test/Util.Ui.NgZorro.Tests/Tags/TagTagHelperTest.Expression.cs b/test/Util.Ui.NgZorro.Tests/Tags/TagTagHelperTest.Expression.cs
index 9263bc406..45d3fc17b 100644
--- a/test/Util.Ui.NgZorro.Tests/Tags/TagTagHelperTest.Expression.cs
+++ b/test/Util.Ui.NgZorro.Tests/Tags/TagTagHelperTest.Expression.cs
@@ -16,7 +16,7 @@ public void TestFor() {
var result = new StringBuilder();
result.Append( "" );
- result.Append( "" );
+ result.Append( "" );
result.Append( "{{item.text}}" );
result.Append( "" );
result.Append( "" );
diff --git a/test/Util.Ui.NgZorro.Tests/Tags/TagTagHelperTest.Extend.cs b/test/Util.Ui.NgZorro.Tests/Tags/TagTagHelperTest.Extend.cs
index e493c6099..7af349e3d 100644
--- a/test/Util.Ui.NgZorro.Tests/Tags/TagTagHelperTest.Extend.cs
+++ b/test/Util.Ui.NgZorro.Tests/Tags/TagTagHelperTest.Extend.cs
@@ -39,7 +39,7 @@ public void TestAutoLoad() {
_wrapper.SetContextAttribute( UiConst.AutoLoad, false );
var result = new StringBuilder();
result.Append( "" );
- result.Append( "" );
+ result.Append( "" );
result.Append( "{{item.text}}" );
result.Append( "" );
result.Append( "" );
@@ -59,7 +59,7 @@ public void TestQueryParam() {
_wrapper.SetContextAttribute( UiConst.QueryParam, "a" );
var result = new StringBuilder();
result.Append( "" );
- result.Append( "" );
+ result.Append( "" );
result.Append( "{{item.text}}" );
result.Append( "" );
result.Append( "" );
@@ -79,7 +79,7 @@ public void TestAllSelected() {
_wrapper.SetContextAttribute( UiConst.AllSelected, "a" );
var result = new StringBuilder();
result.Append( "" );
- result.Append( "" );
+ result.Append( "" );
result.Append( "{{item.text}}" );
result.Append( "" );
result.Append( "" );
@@ -99,7 +99,7 @@ public void TestSelectedText() {
_wrapper.SetContextAttribute( UiConst.SelectedText, "a" );
var result = new StringBuilder();
result.Append( "" );
- result.Append( "" );
+ result.Append( "" );
result.Append( "{{item.text}}" );
result.Append( "" );
result.Append( "" );
@@ -119,7 +119,7 @@ public void TestSelectedValue() {
_wrapper.SetContextAttribute( UiConst.SelectedValue, "a" );
var result = new StringBuilder();
result.Append( "" );
- result.Append( "" );
+ result.Append( "" );
result.Append( "{{item.text}}" );
result.Append( "" );
result.Append( "" );
@@ -135,10 +135,11 @@ public void TestSelectedValue() {
///
[Fact]
public void TestUrl_1() {
+ _wrapper.SetContextAttribute( UiConst.Id, "i" );
_wrapper.SetContextAttribute( UiConst.Url, "a" );
var result = new StringBuilder();
- result.Append( "" );
- result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
result.Append( "{{item.text}}" );
result.Append( "" );
result.Append( "" );
@@ -153,7 +154,7 @@ public void TestBindUrl() {
_wrapper.SetContextAttribute( AngularConst.BindUrl, "a" );
var result = new StringBuilder();
result.Append( "" );
- result.Append( "" );
+ result.Append( "" );
result.Append( "{{item.text}}" );
result.Append( "" );
result.Append( "" );
@@ -172,7 +173,7 @@ public void TestData() {
_wrapper.SetContextAttribute( UiConst.Data, "a" );
var result = new StringBuilder();
result.Append( "" );
- result.Append( "" );
+ result.Append( "" );
result.Append( "{{item.text}}" );
result.Append( "" );
result.Append( "" );
@@ -188,7 +189,7 @@ public void TestData_2() {
_wrapper.AppendContent( "b" );
var result = new StringBuilder();
result.Append( "" );
- result.Append( "" );
+ result.Append( "" );
result.Append( "b" );
result.Append( "" );
result.Append( "" );
@@ -204,7 +205,7 @@ public void TestData_I18n() {
_wrapper.SetContextAttribute( UiConst.Data, "a" );
var result = new StringBuilder();
result.Append( "" );
- result.Append( "" );
+ result.Append( "" );
result.Append( "{{item.text|i18n}}" );
result.Append( "" );
result.Append( "" );
@@ -224,7 +225,7 @@ public void TestOnLoad() {
_wrapper.SetContextAttribute( UiConst.OnLoad, "a" );
var result = new StringBuilder();
result.Append( "" );
- result.Append( "" );
+ result.Append( "" );
result.Append( "{{item.text}}" );
result.Append( "" );
result.Append( "" );
@@ -244,7 +245,7 @@ public void TestOnSelectedTextChange() {
_wrapper.SetContextAttribute( UiConst.OnSelectedTextChange, "a" );
var result = new StringBuilder();
result.Append( "" );
- result.Append( "" );
+ result.Append( "" );
result.Append( "{{item.text}}" );
result.Append( "" );
result.Append( "" );
@@ -264,7 +265,27 @@ public void TestOnSelectedValueChange() {
_wrapper.SetContextAttribute( UiConst.OnSelectedValueChange, "a" );
var result = new StringBuilder();
result.Append( "" );
- result.Append( "" );
+ result.Append( "" );
+ result.Append( "{{item.text}}" );
+ result.Append( "" );
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ #endregion
+
+ #region OnSelectedValueChange
+
+ ///
+ /// 测试选中值变更事件
+ ///
+ [Fact]
+ public void TestOnAllSelectedChange() {
+ _wrapper.SetContextAttribute( UiConst.EnableExtend, true );
+ _wrapper.SetContextAttribute( UiConst.OnAllSelectedChange, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ result.Append( "" );
result.Append( "{{item.text}}" );
result.Append( "" );
result.Append( "" );
@@ -284,7 +305,7 @@ public void TestCheckable_Checked() {
_wrapper.SetContextAttribute( UiConst.Mode, "checkable" );
var result = new StringBuilder();
result.Append( "" );
- result.Append( "" );
+ result.Append( "" );
result.Append( "{{item.text}}" );
result.Append( "" );
result.Append( "" );
diff --git a/test/Util.Ui.NgZorro.Tests/Tags/TagTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Tags/TagTagHelperTest.cs
index c74cac53c..f4addb43c 100644
--- a/test/Util.Ui.NgZorro.Tests/Tags/TagTagHelperTest.cs
+++ b/test/Util.Ui.NgZorro.Tests/Tags/TagTagHelperTest.cs
@@ -107,7 +107,7 @@ public void TestBindonChecked() {
///
[Fact]
public void TestColorType() {
- _wrapper.SetContextAttribute( UiConst.ColorType, AntDesignColor.GeekBlue );
+ _wrapper.SetContextAttribute( UiConst.ColorType, TagColor.GeekBlue );
var result = new StringBuilder();
result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
@@ -135,6 +135,17 @@ public void TestBindColor() {
Assert.Equal( result.ToString(), GetResult() );
}
+ ///
+ /// 测试边框
+ ///
+ [Fact]
+ public void TestBordered() {
+ _wrapper.SetContextAttribute( UiConst.Bordered, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
///
/// 测试内容
///
@@ -146,6 +157,17 @@ public void TestContent() {
Assert.Equal( result.ToString(), GetResult() );
}
+ ///
+ /// 测试点击事件
+ ///
+ [Fact]
+ public void TestOnClick() {
+ _wrapper.SetContextAttribute( UiConst.OnClick, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
///
/// 测试关闭事件
///
diff --git a/test/Util.Ui.NgZorro.Tests/Textareas/TextareaTagHelperTest.Base.cs b/test/Util.Ui.NgZorro.Tests/Textareas/TextareaTagHelperTest.Base.cs
index 928eb64c4..dedc4ef20 100644
--- a/test/Util.Ui.NgZorro.Tests/Textareas/TextareaTagHelperTest.Base.cs
+++ b/test/Util.Ui.NgZorro.Tests/Textareas/TextareaTagHelperTest.Base.cs
@@ -81,7 +81,9 @@ public void TestOutputAttributes() {
public void TestNgIf() {
_wrapper.SetContextAttribute( AngularConst.NgIf, "a" );
var result = new StringBuilder();
- result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
diff --git a/test/Util.Ui.NgZorro.Tests/Textareas/TextareaTagHelperTest.Events.cs b/test/Util.Ui.NgZorro.Tests/Textareas/TextareaTagHelperTest.Events.cs
index afa694e3f..3c941f0f3 100644
--- a/test/Util.Ui.NgZorro.Tests/Textareas/TextareaTagHelperTest.Events.cs
+++ b/test/Util.Ui.NgZorro.Tests/Textareas/TextareaTagHelperTest.Events.cs
@@ -29,15 +29,37 @@ public void TestOnInput() {
Assert.Equal( result.ToString(), GetResult() );
}
+ ///
+ /// 测试失去焦点事件
+ ///
+ [Fact]
+ public void TestOnBlur() {
+ _wrapper.SetContextAttribute( UiConst.OnBlur, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
///
/// 测试回车事件
///
[Fact]
- public void TestOnEnter() {
- _wrapper.SetContextAttribute( UiConst.OnEnter, "a" );
+ public void TestOnKeyupEnter() {
+ _wrapper.SetContextAttribute( UiConst.OnKeyupEnter, "a" );
var result = new StringBuilder();
result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
+
+ ///
+ /// 测试回车事件
+ ///
+ [Fact]
+ public void TestOnKeydownEnter() {
+ _wrapper.SetContextAttribute( UiConst.OnKeydownEnter, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
}
}
\ No newline at end of file
diff --git a/test/Util.Ui.NgZorro.Tests/Textareas/TextareaTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Textareas/TextareaTagHelperTest.cs
index 5c4f8c44d..8866802c6 100644
--- a/test/Util.Ui.NgZorro.Tests/Textareas/TextareaTagHelperTest.cs
+++ b/test/Util.Ui.NgZorro.Tests/Textareas/TextareaTagHelperTest.cs
@@ -179,11 +179,11 @@ public void TestAllowClear() {
_wrapper.SetContextAttribute( AngularConst.NgModel, "code" );
var result = new StringBuilder();
result.Append( "" );
- result.Append( "" );
- result.Append( "" );
result.Append( "" );
result.Append( "" );
result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
@@ -196,11 +196,11 @@ public void TestAllowClear_2() {
_wrapper.SetContextAttribute( AngularConst.NgModel, "code" );
var result = new StringBuilder();
result.Append( "" );
- result.Append( "" );
- result.Append( "" );
result.Append( "" );
result.Append( "" );
result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
@@ -222,7 +222,38 @@ public void TestMentionTrigger() {
/// 测试间距项
///
[Fact]
- public void TestSpaceItem() {
+ public void TestSpaceItem_1() {
+ _wrapper.SetContextAttribute( UiConst.SpaceItem, true );
+
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试间距项 - 创建 nz-input-group
+ ///
+ [Fact]
+ public void TestSpaceItem_2() {
+ _wrapper.SetContextAttribute( UiConst.AllowClear, true );
+ _wrapper.SetContextAttribute( AngularConst.NgModel, "code" );
+ _wrapper.SetContextAttribute( UiConst.SpaceItem, true );
+
+ var result = new StringBuilder();
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试间距项 - 创建 nz-form-item
+ ///
+ [Fact]
+ public void TestSpaceItem_3() {
_wrapper.SetContextAttribute( UiConst.LabelText, "a" );
_wrapper.SetContextAttribute( UiConst.SpaceItem, true );
diff --git a/test/Util.Ui.NgZorro.Tests/Timelines/TimelineItemTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Timelines/TimelineItemTagHelperTest.cs
index 0a40b8ecb..9bd142d18 100644
--- a/test/Util.Ui.NgZorro.Tests/Timelines/TimelineItemTagHelperTest.cs
+++ b/test/Util.Ui.NgZorro.Tests/Timelines/TimelineItemTagHelperTest.cs
@@ -48,6 +48,17 @@ public void TestDefault() {
Assert.Equal( result.ToString(), GetResult() );
}
+ ///
+ /// 测试颜色
+ ///
+ [Fact]
+ public void TestColorType() {
+ _wrapper.SetContextAttribute( UiConst.ColorType, AntDesignColor.Red );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
///
/// 测试颜色
///
@@ -103,6 +114,28 @@ public void TestBindPosition() {
Assert.Equal( result.ToString(), GetResult() );
}
+ ///
+ /// 测试设置标签
+ ///
+ [Fact]
+ public void TestLabel() {
+ _wrapper.SetContextAttribute( UiConst.Label, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试设置标签
+ ///
+ [Fact]
+ public void TestBindLabel() {
+ _wrapper.SetContextAttribute( AngularConst.BindLabel, "a" );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
///
/// 测试内容
///
diff --git a/test/Util.Ui.NgZorro.Tests/Typographies/ArticleTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Typographies/ArticleTagHelperTest.cs
index 41d0a0fff..5d713c722 100644
--- a/test/Util.Ui.NgZorro.Tests/Typographies/ArticleTagHelperTest.cs
+++ b/test/Util.Ui.NgZorro.Tests/Typographies/ArticleTagHelperTest.cs
@@ -1,4 +1,5 @@
using System.Text;
+using Util.Ui.Configs;
using Util.Ui.NgZorro.Components.Typographies;
using Util.Ui.TagHelpers;
using Xunit;
@@ -44,5 +45,16 @@ public void TestDefault() {
result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
+
+ ///
+ /// 测试间距项
+ ///
+ [Fact]
+ public void TestSpaceItem() {
+ _wrapper.SetContextAttribute( UiConst.SpaceItem, true );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
}
}
\ No newline at end of file
diff --git a/test/Util.Ui.NgZorro.Tests/Typographies/DivTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Typographies/DivTagHelperTest.cs
index c034285a7..5257385cc 100644
--- a/test/Util.Ui.NgZorro.Tests/Typographies/DivTagHelperTest.cs
+++ b/test/Util.Ui.NgZorro.Tests/Typographies/DivTagHelperTest.cs
@@ -67,5 +67,16 @@ public void TestTypography() {
result.Append( "" );
Assert.Equal( result.ToString(), GetResult() );
}
+
+ ///
+ /// 测试间距项
+ ///
+ [Fact]
+ public void TestSpaceItem() {
+ _wrapper.SetContextAttribute( UiConst.SpaceItem, true );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
}
}
\ No newline at end of file
diff --git a/test/Util.Ui.NgZorro.Tests/Typographies/HTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Typographies/HTagHelperTest.cs
index e53e2abf8..6a60a6192 100644
--- a/test/Util.Ui.NgZorro.Tests/Typographies/HTagHelperTest.cs
+++ b/test/Util.Ui.NgZorro.Tests/Typographies/HTagHelperTest.cs
@@ -1,4 +1,6 @@
-using System.Text;
+using Org.BouncyCastle.Crypto;
+using System.Text;
+using Util.Ui.Configs;
using Util.Ui.NgZorro.Components.Typographies;
using Xunit;
using Xunit.Abstractions;
@@ -85,5 +87,17 @@ public void TestH6() {
result.Append( "" );
Assert.Equal( result.ToString(), component.GetResult() );
}
+
+ ///
+ /// 测试间距项
+ ///
+ [Fact]
+ public void TestSpaceItem() {
+ var component = new H6TagHelper().ToWrapper();
+ component.SetContextAttribute( UiConst.SpaceItem, true );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), component.GetResult() );
+ }
}
}
\ No newline at end of file
diff --git a/test/Util.Ui.NgZorro.Tests/Typographies/PTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Typographies/PTagHelperTest.cs
index 3dbfd8130..3c0a27367 100644
--- a/test/Util.Ui.NgZorro.Tests/Typographies/PTagHelperTest.cs
+++ b/test/Util.Ui.NgZorro.Tests/Typographies/PTagHelperTest.cs
@@ -290,6 +290,17 @@ public void TestBindSuffix() {
Assert.Equal( result.ToString(), GetResult() );
}
+ ///
+ /// 测试间距项
+ ///
+ [Fact]
+ public void TestSpaceItem() {
+ _wrapper.SetContextAttribute( UiConst.SpaceItem, true );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
///
/// 测试内容更改事件
///
diff --git a/test/Util.Ui.NgZorro.Tests/Typographies/SpanTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Typographies/SpanTagHelperTest.cs
index 52ac3dccb..b5238da0c 100644
--- a/test/Util.Ui.NgZorro.Tests/Typographies/SpanTagHelperTest.cs
+++ b/test/Util.Ui.NgZorro.Tests/Typographies/SpanTagHelperTest.cs
@@ -183,6 +183,17 @@ public void TestBindHtml() {
Assert.Equal( result.ToString(), GetResult() );
}
+ ///
+ /// 测试间距项
+ ///
+ [Fact]
+ public void TestSpaceItem() {
+ _wrapper.SetContextAttribute( UiConst.SpaceItem, true );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
///
/// 测试提示框显示状态变化事件
///
diff --git a/test/Util.Ui.NgZorro.Tests/Upload/UploadTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Upload/UploadTagHelperTest.cs
index 8d65d5264..3bfb70ac1 100644
--- a/test/Util.Ui.NgZorro.Tests/Upload/UploadTagHelperTest.cs
+++ b/test/Util.Ui.NgZorro.Tests/Upload/UploadTagHelperTest.cs
@@ -493,7 +493,19 @@ public void TestOnChange() {
/// 测试间距项
///
[Fact]
- public void TestSpaceItem() {
+ public void TestSpaceItem_1() {
+ _wrapper.SetContextAttribute( UiConst.SpaceItem, true );
+
+ var result = new StringBuilder();
+ result.Append( $"{GetButton()}" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
+ ///
+ /// 测试间距项 - 创建form-item
+ ///
+ [Fact]
+ public void TestSpaceItem_2() {
_wrapper.SetContextAttribute( UiConst.LabelText, "a" );
_wrapper.SetContextAttribute( UiConst.SpaceItem, true );
diff --git a/test/Util.Ui.NgZorro.Tests/WaterMarks/WaterMarkTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/WaterMarks/WaterMarkTagHelperTest.cs
index 09e6fe97e..ec11d5af5 100644
--- a/test/Util.Ui.NgZorro.Tests/WaterMarks/WaterMarkTagHelperTest.cs
+++ b/test/Util.Ui.NgZorro.Tests/WaterMarks/WaterMarkTagHelperTest.cs
@@ -192,6 +192,17 @@ public void TestFont() {
Assert.Equal( result.ToString(), GetResult() );
}
+ ///
+ /// 测试字体颜色
+ ///
+ [Fact]
+ public void TestFontColorType() {
+ _wrapper.SetContextAttribute( UiConst.FontColorType, AntDesignColor.Red );
+ var result = new StringBuilder();
+ result.Append( "" );
+ Assert.Equal( result.ToString(), GetResult() );
+ }
+
///
/// 测试字体颜色
///