Skip to content

Commit

Permalink
1. 补齐 <util-dropdown-menu> 相关标签的属性.
Browse files Browse the repository at this point in the history
2. 补齐 <util-menu> 相关标签的属性.
3. 补齐 <util-result> 相关标签的属性.
4. 补齐 <util-space> 相关标签的属性.
5. 补齐 <util-tab> 相关标签的属性.
6. 补齐 <util-tag> 相关标签的属性.
7. 修复表单组件使用 *nzSpaceItem 引用变量作用域导致的问题.
  • Loading branch information
UtilCore committed May 20, 2024
1 parent e90f41f commit ac7523d
Show file tree
Hide file tree
Showing 131 changed files with 2,869 additions and 1,144 deletions.
2 changes: 1 addition & 1 deletion build/version.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<VersionMajor>8</VersionMajor>
<VersionMinor>0</VersionMinor>
<VersionPatch>15</VersionPatch>
<VersionPatch>16</VersionPatch>
<VersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
Expand Down
10 changes: 9 additions & 1 deletion src/Util.Ui.Angular/Builders/AngularTagBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Util.Ui.Configs;
using Util.Ui.Extensions;

namespace Util.Ui.Angular.Builders;
namespace Util.Ui.Angular.Builders;

/// <summary>
/// Angular标签生成器
Expand Down Expand Up @@ -38,6 +38,7 @@ public override void ConfigBase( Config config ) {
base.ConfigBase( config );
this.Angular( config );
ConfigId( config );
ConfigOnContextmenu( config );
}

/// <summary>
Expand All @@ -48,6 +49,13 @@ protected virtual void ConfigId( Config config ) {
this.Id( config );
}

/// <summary>
/// 配置右键上下文菜单事件
/// </summary>
protected virtual void ConfigOnContextmenu( Config config ) {
AttributeIfNotEmpty( "(contextmenu)", _config.GetValue( UiConst.OnContextmenu ) );
}

/// <summary>
/// 配置内容元素
/// </summary>
Expand Down
8 changes: 8 additions & 0 deletions src/Util.Ui.Angular/Configs/AngularConst.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ public static class AngularConst {
/// </summary>
public const string NgSwitchDefault = "ng-switch-default";
/// <summary>
/// *ngTemplateOutlet指令
/// </summary>
public const string NgTemplateOutlet = "ng-template-outlet";
/// <summary>
/// ngFor指令
/// </summary>
public const string NgFor = "ng-for";
Expand Down Expand Up @@ -473,6 +477,10 @@ public static class AngularConst {
/// </summary>
public const string BindSeparator = "bind-separator";
/// <summary>
/// 查询参数处理方式
/// </summary>
public const string BindQueryParamsHandling = "bind-query-params-handling";
/// <summary>
/// 自动生成
/// </summary>
public const string BindAutoGenerate = "bind-auto-generate";
Expand Down
19 changes: 19 additions & 0 deletions src/Util.Ui.Angular/Enums/QueryParamsHandling.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.ComponentModel;

namespace Util.Ui.NgZorro.Enums;

/// <summary>
/// 路由器链接查询参数处理方式
/// </summary>
public enum QueryParamsHandling {
/// <summary>
/// merge, 将新参数与当前参数合并
/// </summary>
[Description( "merge" )]
Merge,
/// <summary>
/// preserve, 保留当前参数
/// </summary>
[Description( "preserve" )]
Preserve
}
3 changes: 2 additions & 1 deletion src/Util.Ui.Angular/Extensions/TagBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public static class TagBuilderExtensions {
/// <param name="builder">生成器实例</param>
/// <param name="config">配置</param>
public static TBuilder Angular<TBuilder>( this TBuilder builder, Config config ) where TBuilder : TagBuilder {
builder.NgIf( config )
builder
.NgIf( config )
.NgSwitch( config ).NgSwitchCase( config ).NgSwitchDefault( config )
.NgFor( config )
.NgClass( config )
Expand Down
4 changes: 4 additions & 0 deletions src/Util.Ui.Angular/TagHelpers/AngularTagHelperBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,8 @@ public abstract class AngularTagHelperBase : TagHelperBase {
/// [acl],访问控制
/// </summary>
public string BindAcl { get; set; }
/// <summary>
/// (contextmenu),右键上下文菜单事件,类型: EventEmitter&lt;MouseEvent>
/// </summary>
public string OnContextmenu { get; set; }
}
22 changes: 6 additions & 16 deletions src/Util.Ui.NgZorro/Components/Base/ButtonBuilderBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,6 @@ public TBuilder Icon( AntDesignIcon icon ) {
return (TBuilder)this;
}

/// <summary>
/// 配置路由链接
/// </summary>
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;
}

/// <summary>
/// 配置下拉菜单
/// </summary>
Expand Down Expand Up @@ -714,7 +703,7 @@ public TBuilder OnVisibleChange() {
/// </summary>
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 )
Expand All @@ -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();
}

/// <summary>
Expand Down Expand Up @@ -791,8 +781,8 @@ protected void DisableButton() {
/// </summary>
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;
}
Expand All @@ -804,7 +794,7 @@ protected string GetFullscreenWrapClass() {
/// </summary>
protected string GetFullscreenPack() {
var isPack = _config.GetBoolValue( UiConst.FullscreenPack );
if (isPack.IsEmpty()) {
if ( isPack.IsEmpty() ) {
if ( _config.Contains( UiConst.FullscreenTitle ) )
return ",true";
return null;
Expand Down
89 changes: 69 additions & 20 deletions src/Util.Ui.NgZorro/Components/Base/ButtonTagHelperBase.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Util.Ui.NgZorro.Enums;
using Util.Ui.Enums;
using Util.Ui.NgZorro.Enums;

namespace Util.Ui.NgZorro.Components.Base;

Expand All @@ -23,7 +24,7 @@ public abstract class ButtonTagHelperBase : TooltipTagHelperBase {
/// </summary>
public bool FullscreenPack { get; set; }
/// <summary>
/// 扩展属性,内容文本,支持i18n
/// 扩展属性,内容文本,支持多语言
/// </summary>
public string Text { get; set; }
/// <summary>
Expand Down Expand Up @@ -143,31 +144,15 @@ public abstract class ButtonTagHelperBase : TooltipTagHelperBase {
/// </summary>
public bool TextUnedit { get; set; }
/// <summary>
/// routerLink,路由链接,当按钮类型为链接时可用
/// </summary>
public string RouterLink { get; set; }
/// <summary>
/// [routerLink],路由链接,当按钮类型为链接时可用
/// </summary>
public string BindRouterLink { get; set; }
/// <summary>
/// routerLinkActive,活动路由链接,设置当前活动路由链接的css类,当按钮类型为链接时可用
/// </summary>
public string RouterLinkActive { get; set; }
/// <summary>
/// [routerLinkActive],活动路由链接,设置当前活动路由链接的css类,当按钮类型为链接时可用
/// </summary>
public string BindRouterLinkActive { get; set; }
/// <summary>
/// [nzDropdownMenu],设置下拉菜单
/// </summary>
public string DropdownMenu { get; set; }
/// <summary>
/// nzPlacement,下拉菜单弹出位置
/// nzPlacement,下拉菜单弹出位置, 可选值: bottomLeft' | 'bottomCenter' | 'bottomRight' | 'topLeft' | 'topCenter' | 'topRight'
/// </summary>
public DropdownMenuPlacement DropdownMenuPlacement { get; set; }
/// <summary>
/// [nzPlacement],下拉菜单弹出位置
/// [nzPlacement],下拉菜单弹出位置, 可选值: bottomLeft' | 'bottomCenter' | 'bottomRight' | 'topLeft' | 'topCenter' | 'topRight'
/// </summary>
public string BindDropdownMenuPlacement { get; set; }
/// <summary>
Expand Down Expand Up @@ -207,6 +192,70 @@ public abstract class ButtonTagHelperBase : TooltipTagHelperBase {
/// </summary>
public bool SpaceItem { get; set; }
/// <summary>
/// 扩展属性,是否查询表单链接,折叠时显示`展开`文本,展开时显示`收起`文本
/// </summary>
public bool IsSearch { get; set; }
/// <summary>
/// 扩展属性,显示表格设置,参数值为表格标识
/// </summary>
public string ShowTableSettings { get; set; }
/// <summary>
/// href,链接地址
/// </summary>
public string Href { get; set; }
/// <summary>
/// [href],链接地址
/// </summary>
public string BindHref { get; set; }
/// <summary>
/// target,链接打开目标, 可选值: '_self' | '_blank' | '_parent' | '_top'
/// </summary>
public ATarget Target { get; set; }
/// <summary>
/// [target],链接打开目标, 可选值: '_self' | '_blank' | '_parent' | '_top'
/// </summary>
public string BindTarget { get; set; }
/// <summary>
/// rel,指定当前文档与被链接文档的关系
/// </summary>
public string Rel { get; set; }
/// <summary>
/// [rel],指定当前文档与被链接文档的关系
/// </summary>
public string BindRel { get; set; }
/// <summary>
/// routerLink,路由链接地址
/// </summary>
public string RouterLink { get; set; }
/// <summary>
/// [routerLink],路由链接地址
/// </summary>
public string BindRouterLink { get; set; }
/// <summary>
/// routerLinkActive,设置当前活动路由链接的css类
/// </summary>
public string RouterLinkActive { get; set; }
/// <summary>
/// [routerLinkActive],设置当前活动路由链接的css类
/// </summary>
public string BindRouterLinkActive { get; set; }
/// <summary>
/// [queryParams],路由查询参数
/// </summary>
public string QueryParams { get; set; }
/// <summary>
/// queryParamsHandling,路由链接查询参数处理方式, 可选值: 'merge' | 'preserve', merge 将新参数与当前参数合并, preserve 保留当前参数.
/// </summary>
public QueryParamsHandling QueryParamsHandling { get; set; }
/// <summary>
/// [queryParamsHandling],路由链接查询参数处理方式, 可选值: 'merge' | 'preserve', merge 将新参数与当前参数合并, preserve 保留当前参数.
/// </summary>
public string BindQueryParamsHandling { get; set; }
/// <summary>
/// *nzTabLink nz-tab-link, 选项卡路由联动
/// </summary>
public string TabLink { get; set; }
/// <summary>
/// (click),单击事件
/// </summary>
public string OnClick { get; set; }
Expand Down
19 changes: 15 additions & 4 deletions src/Util.Ui.NgZorro/Components/Base/FormControlBuilderBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/// <summary>
/// 表单控件标签生成器基类
Expand All @@ -29,7 +30,7 @@ public abstract class FormControlBuilderBase<TBuilder> : AngularTagBuilder where
/// <param name="config">配置</param>
/// <param name="tagName">标签名称,范例:div</param>
/// <param name="renderMode">渲染模式</param>
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();
}
Expand Down Expand Up @@ -150,6 +151,16 @@ public virtual TBuilder Pattern() {
return (TBuilder)this;
}

/// <summary>
/// 配置间距项
/// </summary>
public virtual TBuilder SpaceItem() {
if ( FormItemShareConfig.FormItemCreated )
return (TBuilder)this;
this.SpaceItem( FormItemShareConfig.SpaceItem );
return (TBuilder)this;
}

/// <summary>
/// 配置表单属性
/// </summary>
Expand All @@ -158,7 +169,7 @@ protected TBuilder ConfigForm() {
.Required().RequiredMessage()
.MinLength().MinLengthMessage()
.MaxLength().EmailMessage()
.Pattern()
.Pattern().SpaceItem()
.TableEdit().ValidationExtend();
}

Expand Down Expand Up @@ -203,7 +214,7 @@ public TBuilder ValidationExtend() {
/// </summary>
protected TBuilder AutocompleteOff() {
var options = NgZorroOptionsService.GetOptions();
if( options.EnableAutocompleteOff )
if ( options.EnableAutocompleteOff )
Attribute( "autocomplete", "off" );
return (TBuilder)this;
}
Expand Down
6 changes: 4 additions & 2 deletions src/Util.Ui.NgZorro/Components/Base/FormControlRenderBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ protected void SetControlId() {
/// </summary>
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;
}
Expand Down
6 changes: 5 additions & 1 deletion src/Util.Ui.NgZorro/Components/Base/TooltipTagHelperBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ public abstract class TooltipTagHelperBase : AngularTagHelperBase {
/// </summary>
public string BindTooltipTrigger { get; set; }
/// <summary>
/// nzTooltipColor,扩展属性, 文字提示背景颜色
/// </summary>
public AntDesignColor TooltipColorType { get; set; }
/// <summary>
/// nzTooltipColor,文字提示背景颜色
/// </summary>
public AntDesignColor TooltipColor { get; set; }
public string TooltipColor { get; set; }
/// <summary>
/// [nzTooltipColor],文字提示背景颜色
/// </summary>
Expand Down
23 changes: 23 additions & 0 deletions src/Util.Ui.NgZorro/Components/Buttons/ATagHelper.cs
Original file line number Diff line number Diff line change
@@ -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;

/// <summary>
/// 链接,生成的标签为&lt;a&gt;&lt;/a&gt;
/// </summary>
[HtmlTargetElement( "util-a" )]
public class ATagHelper : ButtonTagHelperBase {
/// <summary>
/// 扩展属性,是否危险状态,默认值: false
/// </summary>
public bool Danger { get; set; }

/// <inheritdoc />
protected override IRender GetRender( TagHelperContext context, TagHelperOutput output, TagHelperContent content ) {
var config = new Config( context, output, content );
return new ARender( config );
}
}
Loading

0 comments on commit ac7523d

Please sign in to comment.