Skip to content

Commit

Permalink
1. 补齐 <util-avatar> 标签属性.
Browse files Browse the repository at this point in the history
2.补齐 <util-badge> 标签属性.
3. 补齐 <util-ribbon> 标签属性.
4. 补齐 <util-calendar> 标签属性.
5. 补齐 <util-cascader> 标签属性.
6. 补齐 <util-checkbox> 标签属性.
7. 补齐 <util-color-picker> 标签属性.
8. 补齐 <util-date-picker> 标签属性.
9. 补齐 <util-range-picker> 标签属性.
10. 补齐 <util-step> 标签属性.
11. 补齐 <util-step> 标签属性.
  • Loading branch information
UtilCore committed May 27, 2024
1 parent ac7523d commit d97d4df
Show file tree
Hide file tree
Showing 88 changed files with 1,634 additions and 626 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>16</VersionPatch>
<VersionPatch>17</VersionPatch>
<VersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
Expand Down
24 changes: 24 additions & 0 deletions src/Util.Ui.Angular/Configs/AngularConst.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ public static class AngularConst {
/// </summary>
public const string BindLink = "bind-link";
/// <summary>
/// 触发操作
/// </summary>
public const string BindTriggerAction = "bind-trigger-action";
/// <summary>
/// 可选
/// </summary>
public const string BindOptional = "bind-optional";
Expand Down Expand Up @@ -1808,4 +1812,24 @@ public static class AngularConst {
/// 单元格控件
/// </summary>
public const string BindCellControl = "bind-cell-control";
/// <summary>
/// 双色图标颜色
/// </summary>
public const string BindTwotoneColor = "bind-twotone-color";
/// <summary>
/// Iconfont图标
/// </summary>
public const string BindIconFont = "bind-icon-font";
/// <summary>
/// 路由标签
/// </summary>
public const string BindRouteLabel = "bind-route-label";
/// <summary>
/// 标识
/// </summary>
public const string BindNzId = "bind-nz-id";
/// <summary>
/// 自定义头部
/// </summary>
public const string BindCustomHeader = "bind-custom-header";
}
18 changes: 9 additions & 9 deletions src/Util.Ui.NgZorro/Components/Avatars/AvatarTagHelper.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Razor.TagHelpers;
using Util.Ui.Angular.TagHelpers;
using Util.Ui.NgZorro.Components.Avatars.Renders;
using Util.Ui.NgZorro.Components.Base;
using Util.Ui.NgZorro.Enums;
using Util.Ui.Renders;

Expand All @@ -10,33 +10,33 @@ namespace Util.Ui.NgZorro.Components.Avatars;
/// 头像,生成的标签为&lt;nz-avatar>&lt;/nz-avatar>
/// </summary>
[HtmlTargetElement( "util-avatar" )]
public class AvatarTagHelper : AngularTagHelperBase {
public class AvatarTagHelper : TooltipTagHelperBase {
/// <summary>
/// nzIcon,设置头像图标
/// nzIcon,头像图标
/// </summary>
public AntDesignIcon Icon { get; set; }
/// <summary>
/// [nzIcon],设置头像图标
/// [nzIcon],头像图标
/// </summary>
public string BindIcon { get; set; }
/// <summary>
/// nzShape,设置头像形状,可选值: 'circle' | 'square',默认值: 'circle'
/// nzShape,头像形状,可选值: 'circle' | 'square',默认值: 'circle'
/// </summary>
public AvatarShape Shape { get; set; }
/// <summary>
/// [nzShape],设置头像形状,可选值: 'circle' | 'square',默认值: 'circle'
/// [nzShape],头像形状,可选值: 'circle' | 'square',默认值: 'circle'
/// </summary>
public string BindShape { get; set; }
/// <summary>
/// nzSize,设置头像大小,可选值: 'large' | 'small' | 'default' | number,默认值: 'default'
/// nzSize,头像尺寸,可选值: 'large' | 'small' | 'default' | number, 默认值: 'default'
/// </summary>
public AvatarSize Size { get; set; }
/// <summary>
/// [nzSize],设置头像大小,可选值: 'large' | 'small' | 'default' | number,默认值: 'default'
/// [nzSize],头像尺寸,可选值: 'large' | 'small' | 'default' | number, 默认值: 'default'
/// </summary>
public string BindSize { get; set; }
/// <summary>
/// [nzGap],文本距离左右两侧边界,单位:像素,默认值: 4
/// [nzGap],文本距离左右两侧边界,单位:像素, 类型: number, 默认值: 4
/// </summary>
public string Gap { get; set; }
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -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.Avatars.Builders;
Expand Down Expand Up @@ -104,6 +107,7 @@ public AvatarBuilder Events() {
/// </summary>
public override void Config() {
base.Config();
this.Tooltip( _config ).Popover( _config ).Popconfirm( _config );
Icon().Shape().Size().Gap().Src().SrcSet().Alt().Text().Events();
}
}
34 changes: 23 additions & 11 deletions src/Util.Ui.NgZorro/Components/Badges/BadgeTagHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,39 @@ namespace Util.Ui.NgZorro.Components.Badges;
[HtmlTargetElement( "util-badge" )]
public class BadgeTagHelper : AngularTagHelperBase {
/// <summary>
/// [nzStandalone],是否独立使用
/// [nzStandalone],是否独立使用,类型: boolean
/// </summary>
public string Standalone { get; set; }
/// <summary>
/// nzColor,自定义小圆点的颜色
/// nzColor,小圆点的颜色
/// </summary>
public AntDesignColor ColorType { get; set; }
/// <summary>
/// nzColor,小圆点的颜色
/// </summary>
public string Color { get; set; }
/// <summary>
/// [nzColor],自定义小圆点的颜色
/// [nzColor],小圆点的颜色
/// </summary>
public string BindColor { get; set; }
/// <summary>
/// [nzCount],显示的数字,nzCount 大于 nzOverflowCount 时显示为 ${nzOverflowCount}+,为 0 时隐藏,类型: number | TemplateRef&lt;void>
/// [nzCount],显示数字,大于 `overflow-count` 时显示为 `99+`,为 0 时隐藏,类型: number | TemplateRef&lt;void>
/// </summary>
public string Count { get; set; }
/// <summary>
/// [nzDot],是否不显示数字,只显示一个小红点,默认值: false
/// [nzDot],是否不显示数字,只显示一个小红点,类型: boolean, 默认值: false
/// </summary>
public string Dot { get; set; }
/// <summary>
/// [nzShowDot],是否显示小红点,默认值: true
/// [nzShowDot],是否显示小红点,类型: boolean, 默认值: true
/// </summary>
public string ShowDot { get; set; }
/// <summary>
/// [nzOverflowCount],封顶数字,nzCount 大于 nzOverflowCount 时显示为 ${nzOverflowCount}+,默认值: 99
/// [nzOverflowCount],封顶数字,类型: number,默认值: 99
/// </summary>
public string OverflowCount { get; set; }
/// <summary>
/// [nzShowZero],当数值为 0 时,是否显示徽标,默认值: false
/// [nzShowZero],当数值为 0 时,是否显示徽标, 类型: boolean, 默认值: false
/// </summary>
public string ShowZero { get; set; }
/// <summary>
Expand All @@ -52,11 +56,11 @@ public class BadgeTagHelper : AngularTagHelperBase {
/// </summary>
public string BindStatus { get; set; }
/// <summary>
/// nzText,设置状态点的文本,仅在设置了 nzStatus 时有效,类型: string | TemplateRef&lt;void>
/// nzText,设置状态点的文本,支持多语言,仅在设置了 status 时有效
/// </summary>
public string Text { get; set; }
/// <summary>
/// [nzText],设置状态点的文本,仅在设置了 nzStatus 时有效,类型: string | TemplateRef&lt;void>
/// [nzText],设置状态点的文本,仅在设置了 status 时有效,类型: string | TemplateRef&lt;void>
/// </summary>
public string BindText { get; set; }
/// <summary>
Expand All @@ -68,9 +72,17 @@ public class BadgeTagHelper : AngularTagHelperBase {
/// </summary>
public string BindTitle { get; set; }
/// <summary>
/// [nzOffset],设置状态点的位置偏移,格式为 [x, y],类型: [number, number]
/// [nzOffset],设置状态点的位置偏移,格式为 [left, top],表示状态点距默认位置左侧、上方的偏移量,类型: [number, number]
/// </summary>
public string Offset { get; set; }
/// <summary>
/// nzSize,设置徽标尺寸,仅在设置了 `count` 时有效, 可选值: default | small , 默认值: default
/// </summary>
public BadgeSize Size { get; set; }
/// <summary>
/// [nzSize],设置徽标尺寸,仅在设置了 `count` 时有效, 可选值: default | small , 默认值: default
/// </summary>
public string BindSize { get; set; }

/// <inheritdoc />
protected override IRender GetRender( TagHelperContext context, TagHelperOutput output, TagHelperContent content ) {
Expand Down
28 changes: 26 additions & 2 deletions src/Util.Ui.NgZorro/Components/Badges/Builders/BadgeBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using Util.Ui.Angular.Builders;
using Util.Ui.Angular.Configs;
using Util.Ui.NgZorro.Configs;
using Util.Ui.NgZorro.Enums;
using Util.Ui.NgZorro.Extensions;

namespace Util.Ui.NgZorro.Components.Badges.Builders;

Expand Down Expand Up @@ -32,6 +34,7 @@ public BadgeBuilder Standalone() {
/// 配置颜色
/// </summary>
public BadgeBuilder Color() {
AttributeIfNotEmpty( "nzColor", _config.GetValue<AntDesignColor?>( UiConst.ColorType )?.Description() );
AttributeIfNotEmpty( "nzColor", _config.GetValue( UiConst.Color ) );
AttributeIfNotEmpty( "[nzColor]", _config.GetValue( AngularConst.BindColor ) );
return this;
Expand Down Expand Up @@ -90,11 +93,23 @@ public BadgeBuilder Status() {
/// 配置状态点文本
/// </summary>
public BadgeBuilder Text() {
AttributeIfNotEmpty( "nzText", _config.GetValue( UiConst.Text ) );
SetText( _config.GetValue( UiConst.Text ) );
AttributeIfNotEmpty( "[nzText]", _config.GetValue( AngularConst.BindText ) );
return this;
}

/// <summary>
/// 设置状态点文本
/// </summary>
private void SetText( string value ) {
var options = NgZorroOptionsService.GetOptions();
if ( options.EnableI18n ) {
this.AttributeByI18n( "[nzText]", value );
return;
}
AttributeIfNotEmpty( "nzText", value );
}

/// <summary>
/// 配置状态点提示
/// </summary>
Expand All @@ -112,12 +127,21 @@ public BadgeBuilder Offset() {
return this;
}

/// <summary>
/// 配置尺寸
/// </summary>
public BadgeBuilder Size() {
AttributeIfNotEmpty( "nzSize", _config.GetValue<BadgeSize?>( UiConst.Size )?.Description() );
AttributeIfNotEmpty( "[nzSize]", _config.GetValue( AngularConst.BindSize ) );
return this;
}

/// <summary>
/// 配置
/// </summary>
public override void Config() {
base.Config();
Standalone().Color().Count().Dot().ShowDot().OverflowCount()
.ShowZero().Status().Text().Title().Offset();
.ShowZero().Status().Text().Title().Offset().Size();
}
}
21 changes: 18 additions & 3 deletions src/Util.Ui.NgZorro/Components/Badges/Builders/RibbonBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using Util.Ui.Angular.Builders;
using Util.Ui.Angular.Configs;
using Util.Ui.NgZorro.Configs;
using Util.Ui.NgZorro.Enums;
using Util.Ui.NgZorro.Extensions;

namespace Util.Ui.NgZorro.Components.Badges.Builders;
namespace Util.Ui.NgZorro.Components.Badges.Builders;

/// <summary>
/// 缎带徽标标签生成器
Expand All @@ -16,14 +18,15 @@ public class RibbonBuilder : AngularTagBuilder {
/// <summary>
/// 初始化缎带徽标标签生成器
/// </summary>
public RibbonBuilder( Config config ) : base( config,"nz-ribbon" ) {
public RibbonBuilder( Config config ) : base( config, "nz-ribbon" ) {
_config = config;
}

/// <summary>
/// 配置颜色
/// </summary>
public RibbonBuilder Color() {
AttributeIfNotEmpty( "nzColor", _config.GetValue<AntDesignColor?>( UiConst.ColorType )?.Description() );
AttributeIfNotEmpty( "nzColor", _config.GetValue( UiConst.Color ) );
AttributeIfNotEmpty( "[nzColor]", _config.GetValue( AngularConst.BindColor ) );
return this;
Expand All @@ -42,11 +45,23 @@ public RibbonBuilder Placement() {
/// 配置文本内容
/// </summary>
public RibbonBuilder Text() {
AttributeIfNotEmpty( "nzText", _config.GetValue( UiConst.Text ) );
SetText( _config.GetValue( UiConst.Text ) );
AttributeIfNotEmpty( "[nzText]", _config.GetValue( AngularConst.BindText ) );
return this;
}

/// <summary>
/// 设置文本内容
/// </summary>
private void SetText( string value ) {
var options = NgZorroOptionsService.GetOptions();
if ( options.EnableI18n ) {
this.AttributeByI18n( "[nzText]", value );
return;
}
AttributeIfNotEmpty( "nzText", value );
}

/// <summary>
/// 配置
/// </summary>
Expand Down
9 changes: 7 additions & 2 deletions src/Util.Ui.NgZorro/Components/Badges/RibbonTagHelper.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Razor.TagHelpers;
using Util.Ui.Angular.TagHelpers;
using Util.Ui.NgZorro.Components.Badges.Renders;
using Util.Ui.NgZorro.Enums;
using Util.Ui.Renders;

namespace Util.Ui.NgZorro.Components.Badges;
Expand All @@ -10,6 +11,10 @@ namespace Util.Ui.NgZorro.Components.Badges;
/// </summary>
[HtmlTargetElement( "util-ribbon" )]
public class RibbonTagHelper : AngularTagHelperBase {
/// <summary>
/// nzColor,颜色
/// </summary>
public AntDesignColor ColorType { get; set; }
/// <summary>
/// nzColor,颜色
/// </summary>
Expand All @@ -21,13 +26,13 @@ public class RibbonTagHelper : AngularTagHelperBase {
/// <summary>
/// nzPlacement,位置,可选值: 'start' | 'end',默认值: 'end'
/// </summary>
public string Placement { get; set; }
public RibbonPlacement Placement { get; set; }
/// <summary>
/// [nzPlacement],位置,可选值: 'start' | 'end',默认值: 'end'
/// </summary>
public string BindPlacement { get; set; }
/// <summary>
/// nzText,文本内容
/// nzText,文本内容,支持多语言
/// </summary>
public string Text { get; set; }
/// <summary>
Expand Down
Loading

0 comments on commit d97d4df

Please sign in to comment.