From d97d4df43f4b027955c5a201a4fca8180d5b907f Mon Sep 17 00:00:00 2001 From: utilcore <8907060@qq.com> Date: Mon, 27 May 2024 11:04:55 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E8=A1=A5=E9=BD=90=20=20?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E5=B1=9E=E6=80=A7.=202.=E8=A1=A5=E9=BD=90=20?= =?UTF-8?q?=20=E6=A0=87=E7=AD=BE=E5=B1=9E=E6=80=A7.=203.=20?= =?UTF-8?q?=E8=A1=A5=E9=BD=90=20=20=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E5=B1=9E=E6=80=A7.=204.=20=E8=A1=A5=E9=BD=90=20?= =?UTF-8?q?=20=E6=A0=87=E7=AD=BE=E5=B1=9E=E6=80=A7.=205.=20=E8=A1=A5?= =?UTF-8?q?=E9=BD=90=20=20=E6=A0=87=E7=AD=BE=E5=B1=9E?= =?UTF-8?q?=E6=80=A7.=206.=20=E8=A1=A5=E9=BD=90=20=20?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E5=B1=9E=E6=80=A7.=207.=20=E8=A1=A5=E9=BD=90?= =?UTF-8?q?=20=20=E6=A0=87=E7=AD=BE=E5=B1=9E=E6=80=A7.?= =?UTF-8?q?=208.=20=E8=A1=A5=E9=BD=90=20=20=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E5=B1=9E=E6=80=A7.=209.=20=E8=A1=A5=E9=BD=90=20=20=E6=A0=87=E7=AD=BE=E5=B1=9E=E6=80=A7.=2010.=20?= =?UTF-8?q?=E8=A1=A5=E9=BD=90=20=20=E6=A0=87=E7=AD=BE=E5=B1=9E?= =?UTF-8?q?=E6=80=A7.=2011.=20=E8=A1=A5=E9=BD=90=20=20=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E5=B1=9E=E6=80=A7.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/version.props | 2 +- src/Util.Ui.Angular/Configs/AngularConst.cs | 24 +++ .../Components/Avatars/AvatarTagHelper.cs | 18 +- .../Avatars/Builders/AvatarBuilder.cs | 4 + .../Components/Badges/BadgeTagHelper.cs | 34 ++-- .../Badges/Builders/BadgeBuilder.cs | 28 ++- .../Badges/Builders/RibbonBuilder.cs | 21 ++- .../Components/Badges/RibbonTagHelper.cs | 9 +- .../Components/Base/ColumnTagHelperBase.cs | 64 +++---- .../Base/DatePickerTagHelperBase.cs | 173 ++++++++++++++++++ .../Base/FormControlContainerTagHelperBase.cs | 8 +- .../Components/Base/TooltipTagHelperBase.cs | 6 +- .../Breadcrumbs/Builders/BreadcrumbBuilder.cs | 6 +- .../Calendars/Builders/CalendarBuilder.cs | 11 +- .../Components/Calendars/CalendarTagHelper.cs | 22 ++- .../Cascaders/Builders/CascaderBuilder.cs | 35 +++- .../Components/Cascaders/CascaderTagHelper.cs | 84 +++++---- .../Checkboxes/Builders/CheckboxBuilder.cs | 21 ++- .../Builders/CheckboxGroupBuilder.cs | 2 +- .../Checkboxes/CheckboxGroupTagHelper.cs | 2 +- .../Checkboxes/CheckboxTagHelper.cs | 26 ++- .../Checkboxes/CheckboxWrapperTagHelper.cs | 2 +- .../Builders/ColorPickerBuilder.cs | 1 + .../ColorPickers/ColorBlockTagHelper.cs | 4 +- .../ColorPickers/ColorPickerTagHelper.cs | 20 +- .../Containers/Builders/ContainerBuilder.cs | 20 +- .../DatePickers/Builders/DatePickerBuilder.cs | 75 +++++++- .../Builders/RangePickerBuilder.cs | 71 ++++++- .../DatePickers/DatePickerTagHelper.cs | 137 +------------- .../DatePickers/RangePickerTagHelper.cs | 127 +------------ .../Builders/DescriptionItemBuilder.cs | 2 +- .../Components/Forms/Builders/FormBuilder.cs | 24 ++- .../Forms/Configs/FormShareConfig.cs | 5 +- .../Components/Forms/FormTagHelper.cs | 5 + .../Forms/Helpers/FormShareService.cs | 14 +- .../Components/Grids/ColumnTagHelper.cs | 3 +- .../Components/Icons/Builders/IconBuilder.cs | 15 +- .../Inputs/Configs/InputGroupShareConfig.cs | 2 +- .../Inputs/Helpers/InputGroupShareService.cs | 2 +- .../Components/Inputs/InputGroupTagHelper.cs | 2 +- .../Components/Inputs/InputTagHelper.cs | 4 +- .../Layouts/Builders/SiderBuilder.cs | 2 +- .../Components/Layouts/SiderTagHelper.cs | 6 +- .../PageHeaders/Builders/PageHeaderBuilder.cs | 34 +++- .../PageHeaders/PageHeaderTagHelper.cs | 8 +- .../Paginations/PaginationTagHelper.cs | 10 +- .../Selects/Helpers/SelectExpressionLoader.cs | 16 +- .../Selects/Helpers/SelectService.cs | 3 +- .../Components/Steps/Builders/StepBuilder.cs | 40 +++- .../Components/Steps/StepTagHelper.cs | 26 +-- .../Components/Steps/StepsTagHelper.cs | 28 +-- .../Templates/Builders/TemplateBuilder.cs | 13 +- .../Components/Templates/TemplateTagHelper.cs | 4 + src/Util.Ui.NgZorro/Configs/AntDesignConst.cs | 43 ----- .../Popconfirms/TagBuilderExtensions.cs | 3 +- src/Util.Ui.NgZorro/Enums/BadgeSize.cs | 17 ++ .../Enums/CascaderTriggerAction.cs | 17 ++ .../Enums/DatePickerPlacement.cs | 27 +++ .../{InputStatus.cs => FormControlStatus.cs} | 4 +- src/Util.Ui.NgZorro/Enums/InputSize.cs | 4 +- src/Util.Ui.NgZorro/Enums/Justify.cs | 7 +- src/Util.Ui/Configs/UiConst.cs | 60 ++++++ .../11-Util.WebApiClient.csproj | 33 ---- .../Badges/BadgeTagHelperTest.cs | 46 +++++ .../Badges/RibbonTagHelperTest.cs | 24 +++ .../Breadcrumbs/BreadcrumbTagHelperTest.cs | 6 +- .../Buttons/ButtonTagHelperTest.Popconfirm.cs | 11 ++ .../Calendars/CalendarTagHelperTest.cs | 22 +++ .../Cascaders/CascaderTagHelperTest.cs | 88 +++++++-- .../Checkboxes/CheckboxGroupTagHelperTest.cs | 22 +++ .../Checkboxes/CheckboxTagHelperTest.cs | 35 ++++ .../ColorPickerTagHelperTest.Expression.cs | 2 + .../ColorPickers/ColorPickerTagHelperTest.cs | 11 ++ .../DatePickers/DatePickerTagHelperTest.cs | 155 ++++++++++++++-- .../DatePickers/RangePickerTagHelperTest.cs | 162 ++++++++++++++-- .../Forms/FormTagHelperTest.cs | 25 +++ .../Icons/IconTagHelperTest.cs | 12 +- .../Inputs/InputGroupTagHelperTest.cs | 2 +- .../Inputs/InputTagHelperTest.InputGroup.cs | 2 +- .../Inputs/InputTagHelperTest.cs | 2 +- .../Layouts/SiderTagHelperTest.cs | 2 +- .../PageHeaders/PageHeaderTagHelperTest.cs | 25 +++ .../RadioGroupTagHelperTest.Expression.cs | 5 + .../Radios/RadioTagHelperTest.Expression.cs | 6 + .../SegmentedTagHelperTest.Expression.cs | 2 + .../Selects/SelectTagHelperTest.Expression.cs | 5 + .../Steps/StepTagHelperTest.cs | 36 ++++ .../Templates/TemplateTagHelperTest.cs | 12 ++ 88 files changed, 1634 insertions(+), 626 deletions(-) create mode 100644 src/Util.Ui.NgZorro/Components/Base/DatePickerTagHelperBase.cs delete mode 100644 src/Util.Ui.NgZorro/Configs/AntDesignConst.cs create mode 100644 src/Util.Ui.NgZorro/Enums/BadgeSize.cs create mode 100644 src/Util.Ui.NgZorro/Enums/CascaderTriggerAction.cs create mode 100644 src/Util.Ui.NgZorro/Enums/DatePickerPlacement.cs rename src/Util.Ui.NgZorro/Enums/{InputStatus.cs => FormControlStatus.cs} (82%) delete mode 100644 src/Util.WebApiClient/11-Util.WebApiClient.csproj diff --git a/build/version.props b/build/version.props index 91869707f..9f3119be7 100644 --- a/build/version.props +++ b/build/version.props @@ -2,7 +2,7 @@ 8 0 - 16 + 17 $(VersionMajor).$(VersionMinor).$(VersionPatch) diff --git a/src/Util.Ui.Angular/Configs/AngularConst.cs b/src/Util.Ui.Angular/Configs/AngularConst.cs index cc3ab12cc..9a25cc199 100644 --- a/src/Util.Ui.Angular/Configs/AngularConst.cs +++ b/src/Util.Ui.Angular/Configs/AngularConst.cs @@ -49,6 +49,10 @@ public static class AngularConst { /// public const string BindLink = "bind-link"; /// + /// 触发操作 + /// + public const string BindTriggerAction = "bind-trigger-action"; + /// /// 可选 /// public const string BindOptional = "bind-optional"; @@ -1808,4 +1812,24 @@ public static class AngularConst { /// 单元格控件 /// public const string BindCellControl = "bind-cell-control"; + /// + /// 双色图标颜色 + /// + public const string BindTwotoneColor = "bind-twotone-color"; + /// + /// Iconfont图标 + /// + public const string BindIconFont = "bind-icon-font"; + /// + /// 路由标签 + /// + public const string BindRouteLabel = "bind-route-label"; + /// + /// 标识 + /// + public const string BindNzId = "bind-nz-id"; + /// + /// 自定义头部 + /// + public const string BindCustomHeader = "bind-custom-header"; } \ No newline at end of file diff --git a/src/Util.Ui.NgZorro/Components/Avatars/AvatarTagHelper.cs b/src/Util.Ui.NgZorro/Components/Avatars/AvatarTagHelper.cs index a99e1c83e..c2896adad 100644 --- a/src/Util.Ui.NgZorro/Components/Avatars/AvatarTagHelper.cs +++ b/src/Util.Ui.NgZorro/Components/Avatars/AvatarTagHelper.cs @@ -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; @@ -10,33 +10,33 @@ namespace Util.Ui.NgZorro.Components.Avatars; /// 头像,生成的标签为<nz-avatar></nz-avatar> /// [HtmlTargetElement( "util-avatar" )] -public class AvatarTagHelper : AngularTagHelperBase { +public class AvatarTagHelper : TooltipTagHelperBase { /// - /// nzIcon,设置头像图标 + /// nzIcon,头像图标 /// public AntDesignIcon Icon { get; set; } /// - /// [nzIcon],设置头像图标 + /// [nzIcon],头像图标 /// public string BindIcon { get; set; } /// - /// nzShape,设置头像形状,可选值: 'circle' | 'square',默认值: 'circle' + /// nzShape,头像形状,可选值: 'circle' | 'square',默认值: 'circle' /// public AvatarShape Shape { get; set; } /// - /// [nzShape],设置头像形状,可选值: 'circle' | 'square',默认值: 'circle' + /// [nzShape],头像形状,可选值: 'circle' | 'square',默认值: 'circle' /// public string BindShape { get; set; } /// - /// nzSize,设置头像大小,可选值: 'large' | 'small' | 'default' | number,默认值: 'default' + /// nzSize,头像尺寸,可选值: 'large' | 'small' | 'default' | number, 默认值: 'default' /// public AvatarSize Size { get; set; } /// - /// [nzSize],设置头像大小,可选值: 'large' | 'small' | 'default' | number,默认值: 'default' + /// [nzSize],头像尺寸,可选值: 'large' | 'small' | 'default' | number, 默认值: 'default' /// public string BindSize { get; set; } /// - /// [nzGap],文本距离左右两侧边界,单位:像素,默认值: 4 + /// [nzGap],文本距离左右两侧边界,单位:像素, 类型: number, 默认值: 4 /// public string Gap { get; set; } /// diff --git a/src/Util.Ui.NgZorro/Components/Avatars/Builders/AvatarBuilder.cs b/src/Util.Ui.NgZorro/Components/Avatars/Builders/AvatarBuilder.cs index 5030dd33b..eeb29ba08 100644 --- a/src/Util.Ui.NgZorro/Components/Avatars/Builders/AvatarBuilder.cs +++ b/src/Util.Ui.NgZorro/Components/Avatars/Builders/AvatarBuilder.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.Avatars.Builders; @@ -104,6 +107,7 @@ public AvatarBuilder Events() { /// public override void Config() { base.Config(); + this.Tooltip( _config ).Popover( _config ).Popconfirm( _config ); Icon().Shape().Size().Gap().Src().SrcSet().Alt().Text().Events(); } } \ No newline at end of file diff --git a/src/Util.Ui.NgZorro/Components/Badges/BadgeTagHelper.cs b/src/Util.Ui.NgZorro/Components/Badges/BadgeTagHelper.cs index d5e6d20d1..593dde5d7 100644 --- a/src/Util.Ui.NgZorro/Components/Badges/BadgeTagHelper.cs +++ b/src/Util.Ui.NgZorro/Components/Badges/BadgeTagHelper.cs @@ -12,35 +12,39 @@ namespace Util.Ui.NgZorro.Components.Badges; [HtmlTargetElement( "util-badge" )] public class BadgeTagHelper : AngularTagHelperBase { /// - /// [nzStandalone],是否独立使用 + /// [nzStandalone],是否独立使用,类型: boolean /// public string Standalone { get; set; } /// - /// nzColor,自定义小圆点的颜色 + /// nzColor,小圆点的颜色 + /// + public AntDesignColor ColorType { get; set; } + /// + /// nzColor,小圆点的颜色 /// public string Color { get; set; } /// - /// [nzColor],自定义小圆点的颜色 + /// [nzColor],小圆点的颜色 /// public string BindColor { get; set; } /// - /// [nzCount],显示的数字,nzCount 大于 nzOverflowCount 时显示为 ${nzOverflowCount}+,为 0 时隐藏,类型: number | TemplateRef<void> + /// [nzCount],显示数字,大于 `overflow-count` 时显示为 `99+`,为 0 时隐藏,类型: number | TemplateRef<void> /// public string Count { get; set; } /// - /// [nzDot],是否不显示数字,只显示一个小红点,默认值: false + /// [nzDot],是否不显示数字,只显示一个小红点,类型: boolean, 默认值: false /// public string Dot { get; set; } /// - /// [nzShowDot],是否显示小红点,默认值: true + /// [nzShowDot],是否显示小红点,类型: boolean, 默认值: true /// public string ShowDot { get; set; } /// - /// [nzOverflowCount],封顶数字,nzCount 大于 nzOverflowCount 时显示为 ${nzOverflowCount}+,默认值: 99 + /// [nzOverflowCount],封顶数字,类型: number,默认值: 99 /// public string OverflowCount { get; set; } /// - /// [nzShowZero],当数值为 0 时,是否显示徽标,默认值: false + /// [nzShowZero],当数值为 0 时,是否显示徽标, 类型: boolean, 默认值: false /// public string ShowZero { get; set; } /// @@ -52,11 +56,11 @@ public class BadgeTagHelper : AngularTagHelperBase { /// public string BindStatus { get; set; } /// - /// nzText,设置状态点的文本,仅在设置了 nzStatus 时有效,类型: string | TemplateRef<void> + /// nzText,设置状态点的文本,支持多语言,仅在设置了 status 时有效 /// public string Text { get; set; } /// - /// [nzText],设置状态点的文本,仅在设置了 nzStatus 时有效,类型: string | TemplateRef<void> + /// [nzText],设置状态点的文本,仅在设置了 status 时有效,类型: string | TemplateRef<void> /// public string BindText { get; set; } /// @@ -68,9 +72,17 @@ public class BadgeTagHelper : AngularTagHelperBase { /// public string BindTitle { get; set; } /// - /// [nzOffset],设置状态点的位置偏移,格式为 [x, y],类型: [number, number] + /// [nzOffset],设置状态点的位置偏移,格式为 [left, top],表示状态点距默认位置左侧、上方的偏移量,类型: [number, number] /// public string Offset { get; set; } + /// + /// nzSize,设置徽标尺寸,仅在设置了 `count` 时有效, 可选值: default | small , 默认值: default + /// + public BadgeSize Size { get; set; } + /// + /// [nzSize],设置徽标尺寸,仅在设置了 `count` 时有效, 可选值: default | small , 默认值: default + /// + public string BindSize { get; set; } /// protected override IRender GetRender( TagHelperContext context, TagHelperOutput output, TagHelperContent content ) { diff --git a/src/Util.Ui.NgZorro/Components/Badges/Builders/BadgeBuilder.cs b/src/Util.Ui.NgZorro/Components/Badges/Builders/BadgeBuilder.cs index 14ce0a31e..f7e7ef849 100644 --- a/src/Util.Ui.NgZorro/Components/Badges/Builders/BadgeBuilder.cs +++ b/src/Util.Ui.NgZorro/Components/Badges/Builders/BadgeBuilder.cs @@ -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; @@ -32,6 +34,7 @@ public BadgeBuilder Standalone() { /// 配置颜色 /// public BadgeBuilder Color() { + AttributeIfNotEmpty( "nzColor", _config.GetValue( UiConst.ColorType )?.Description() ); AttributeIfNotEmpty( "nzColor", _config.GetValue( UiConst.Color ) ); AttributeIfNotEmpty( "[nzColor]", _config.GetValue( AngularConst.BindColor ) ); return this; @@ -90,11 +93,23 @@ public BadgeBuilder Status() { /// 配置状态点文本 /// public BadgeBuilder Text() { - AttributeIfNotEmpty( "nzText", _config.GetValue( UiConst.Text ) ); + SetText( _config.GetValue( UiConst.Text ) ); AttributeIfNotEmpty( "[nzText]", _config.GetValue( AngularConst.BindText ) ); return this; } + /// + /// 设置状态点文本 + /// + private void SetText( string value ) { + var options = NgZorroOptionsService.GetOptions(); + if ( options.EnableI18n ) { + this.AttributeByI18n( "[nzText]", value ); + return; + } + AttributeIfNotEmpty( "nzText", value ); + } + /// /// 配置状态点提示 /// @@ -112,12 +127,21 @@ public BadgeBuilder Offset() { return this; } + /// + /// 配置尺寸 + /// + public BadgeBuilder Size() { + AttributeIfNotEmpty( "nzSize", _config.GetValue( UiConst.Size )?.Description() ); + AttributeIfNotEmpty( "[nzSize]", _config.GetValue( AngularConst.BindSize ) ); + return this; + } + /// /// 配置 /// public override void Config() { base.Config(); Standalone().Color().Count().Dot().ShowDot().OverflowCount() - .ShowZero().Status().Text().Title().Offset(); + .ShowZero().Status().Text().Title().Offset().Size(); } } \ No newline at end of file diff --git a/src/Util.Ui.NgZorro/Components/Badges/Builders/RibbonBuilder.cs b/src/Util.Ui.NgZorro/Components/Badges/Builders/RibbonBuilder.cs index adc281203..99ad20734 100644 --- a/src/Util.Ui.NgZorro/Components/Badges/Builders/RibbonBuilder.cs +++ b/src/Util.Ui.NgZorro/Components/Badges/Builders/RibbonBuilder.cs @@ -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; /// /// 缎带徽标标签生成器 @@ -16,7 +18,7 @@ public class RibbonBuilder : AngularTagBuilder { /// /// 初始化缎带徽标标签生成器 /// - public RibbonBuilder( Config config ) : base( config,"nz-ribbon" ) { + public RibbonBuilder( Config config ) : base( config, "nz-ribbon" ) { _config = config; } @@ -24,6 +26,7 @@ public RibbonBuilder( Config config ) : base( config,"nz-ribbon" ) { /// 配置颜色 /// public RibbonBuilder Color() { + AttributeIfNotEmpty( "nzColor", _config.GetValue( UiConst.ColorType )?.Description() ); AttributeIfNotEmpty( "nzColor", _config.GetValue( UiConst.Color ) ); AttributeIfNotEmpty( "[nzColor]", _config.GetValue( AngularConst.BindColor ) ); return this; @@ -42,11 +45,23 @@ public RibbonBuilder Placement() { /// 配置文本内容 /// public RibbonBuilder Text() { - AttributeIfNotEmpty( "nzText", _config.GetValue( UiConst.Text ) ); + SetText( _config.GetValue( UiConst.Text ) ); AttributeIfNotEmpty( "[nzText]", _config.GetValue( AngularConst.BindText ) ); return this; } + /// + /// 设置文本内容 + /// + private void SetText( string value ) { + var options = NgZorroOptionsService.GetOptions(); + if ( options.EnableI18n ) { + this.AttributeByI18n( "[nzText]", value ); + return; + } + AttributeIfNotEmpty( "nzText", value ); + } + /// /// 配置 /// diff --git a/src/Util.Ui.NgZorro/Components/Badges/RibbonTagHelper.cs b/src/Util.Ui.NgZorro/Components/Badges/RibbonTagHelper.cs index e01007b3d..dfc214fc7 100644 --- a/src/Util.Ui.NgZorro/Components/Badges/RibbonTagHelper.cs +++ b/src/Util.Ui.NgZorro/Components/Badges/RibbonTagHelper.cs @@ -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; @@ -10,6 +11,10 @@ namespace Util.Ui.NgZorro.Components.Badges; /// [HtmlTargetElement( "util-ribbon" )] public class RibbonTagHelper : AngularTagHelperBase { + /// + /// nzColor,颜色 + /// + public AntDesignColor ColorType { get; set; } /// /// nzColor,颜色 /// @@ -21,13 +26,13 @@ public class RibbonTagHelper : AngularTagHelperBase { /// /// nzPlacement,位置,可选值: 'start' | 'end',默认值: 'end' /// - public string Placement { get; set; } + public RibbonPlacement Placement { get; set; } /// /// [nzPlacement],位置,可选值: 'start' | 'end',默认值: 'end' /// public string BindPlacement { get; set; } /// - /// nzText,文本内容 + /// nzText,文本内容,支持多语言 /// public string Text { get; set; } /// diff --git a/src/Util.Ui.NgZorro/Components/Base/ColumnTagHelperBase.cs b/src/Util.Ui.NgZorro/Components/Base/ColumnTagHelperBase.cs index c3cf1c368..410695e8c 100644 --- a/src/Util.Ui.NgZorro/Components/Base/ColumnTagHelperBase.cs +++ b/src/Util.Ui.NgZorro/Components/Base/ColumnTagHelperBase.cs @@ -11,7 +11,7 @@ public abstract class ColumnTagHelperBase : AngularTagHelperBase { /// public string Span { get; set; } /// - /// [nzOffset],栅格向右偏移的格数,即栅格左侧的间隔格数,间隔内不可以有栅格,范例: 设置值为4,将元素向右侧偏移4格宽度 + /// [nzOffset],栅格向右偏移的格数,即栅格左侧的间隔格数,间隔内不能有栅格,范例: 设置值为4,将元素向右侧偏移4格宽度 /// public string Offset { get; set; } /// @@ -39,23 +39,23 @@ public abstract class ColumnTagHelperBase : AngularTagHelperBase { /// public string Xs { get; set; } /// - /// <576px超窄尺寸响应式栅格占位格数,可选值: 0 - 24, 为 0 时隐藏,范例:设置值为6,生成[nzXs]="{span:6}" + /// <576px超窄尺寸响应式栅格占位格数,可选值: 0 - 24, 为 0 时隐藏,范例:设置值为 6,生成 [nzXs]="{span:6}" /// public int XsSpan { get; set; } /// - /// <576px超窄尺寸响应式栅格向右偏移的格数,即栅格左侧的间隔格数,间隔内不可以有栅格,范例: 设置值为6,将元素向右侧偏移了6格宽度,生成[nzXs]="{offset:6}" + /// <576px超窄尺寸响应式栅格向右偏移的格数,间隔内不能有栅格,范例: 设置值为 6,将元素向右侧偏移了6格宽度,生成 [nzXs]="{offset:6}" /// public int XsOffset { get; set; } /// - /// <576px超窄尺寸响应式栅格顺序,范例: 设置值为6,生成[nzXs]="{order:6}" + /// <576px超窄尺寸响应式栅格顺序,范例: 设置值为 6,生成 [nzXs]="{order:6}" /// public int XsOrder { get; set; } /// - /// <576px超窄尺寸响应式栅格向左移动的格数,范例: 设置值为6,生成[nzXs]="{pull:6}" + /// <576px超窄尺寸响应式栅格向左移动的格数,范例: 设置值为 6,生成 [nzXs]="{pull:6}" /// public int XsPull { get; set; } /// - /// <576px超窄尺寸响应式栅格向右移动的格数,范例: 设置值为6,生成[nzXs]="{push:6}" + /// <576px超窄尺寸响应式栅格向右移动的格数,范例: 设置值为 6,生成 [nzXs]="{push:6}" /// public int XsPush { get; set; } /// @@ -63,23 +63,23 @@ public abstract class ColumnTagHelperBase : AngularTagHelperBase { /// public string Sm { get; set; } /// - /// ≥576px窄尺寸响应式栅格占位格数,可选值: 0 - 24, 为 0 时隐藏,范例:设置值为6,生成[nzSm]="{span:6}" + /// ≥576px窄尺寸响应式栅格占位格数,可选值: 0 - 24, 为 0 时隐藏,范例:设置值为 6,生成 [nzSm]="{span:6}" /// public int SmSpan { get; set; } /// - /// ≥576px窄尺寸响应式栅格向右偏移的格数,即栅格左侧的间隔格数,间隔内不可以有栅格,范例: 设置值为6,将元素向右侧偏移了6格宽度,生成[nzSm]="{offset:6}" + /// ≥576px窄尺寸响应式栅格向右偏移的格数,间隔内不能有栅格,范例: 设置值为 6,将元素向右侧偏移了6格宽度,生成 [nzSm]="{offset:6}" /// public int SmOffset { get; set; } /// - /// ≥576px窄尺寸响应式栅格顺序,范例: 设置值为6,生成[nzSm]="{order:6}" + /// ≥576px窄尺寸响应式栅格顺序,范例: 设置值为 6,生成 [nzSm]="{order:6}" /// public int SmOrder { get; set; } /// - /// ≥576px窄尺寸响应式栅格向左移动的格数,范例: 设置值为6,生成[nzSm]="{pull:6}" + /// ≥576px窄尺寸响应式栅格向左移动的格数,范例: 设置值为 6,生成 [nzSm]="{pull:6}" /// public int SmPull { get; set; } /// - /// ≥576px窄尺寸响应式栅格向右移动的格数,范例: 设置值为6,生成[nzSm]="{push:6}" + /// ≥576px窄尺寸响应式栅格向右移动的格数,范例: 设置值为 6,生成 [nzSm]="{push:6}" /// public int SmPush { get; set; } /// @@ -87,47 +87,47 @@ public abstract class ColumnTagHelperBase : AngularTagHelperBase { /// public string Md { get; set; } /// - /// ≥768px中尺寸响应式栅格占位格数,可选值: 0 - 24, 为 0 时隐藏,范例:设置值为6,生成[nzMd]="{span:6}" + /// ≥768px中尺寸响应式栅格占位格数,可选值: 0 - 24, 为 0 时隐藏,范例:设置值为 6,生成 [nzMd]="{span:6}" /// public int MdSpan { get; set; } /// - /// ≥768px中尺寸响应式栅格向右偏移的格数,即栅格左侧的间隔格数,间隔内不可以有栅格,范例: 设置值为6,将元素向右侧偏移了6格宽度,生成[nzMd]="{offset:6}" + /// ≥768px中尺寸响应式栅格向右偏移的格数,间隔内不能有栅格,范例: 设置值为 6,将元素向右侧偏移了6格宽度,生成 [nzMd]="{offset:6}" /// public int MdOffset { get; set; } /// - /// ≥768px中尺寸响应式栅格顺序,范例: 设置值为6,生成[nzMd]="{order:6}" + /// ≥768px中尺寸响应式栅格顺序,范例: 设置值为 6,生成 [nzMd]="{order:6}" /// public int MdOrder { get; set; } /// - /// ≥768px中尺寸响应式栅格向左移动的格数,范例: 设置值为6,生成[nzMd]="{pull:6}" + /// ≥768px中尺寸响应式栅格向左移动的格数,范例: 设置值为 6,生成 [nzMd]="{pull:6}" /// public int MdPull { get; set; } /// - /// ≥768px中尺寸响应式栅格向右移动的格数,范例: 设置值为6,生成[nzMd]="{push:6}" + /// ≥768px中尺寸响应式栅格向右移动的格数,范例: 设置值为 6,生成 [nzMd]="{push:6}" /// public int MdPush { get; set; } /// - /// [nzLg], ≥992px宽尺寸响应式栅格,可以设置一个数字,相当于[nzLg]="{span:数字}",也可以设置为对象,范例:{span:5,offset:1} + /// [nzLg], ≥992px宽尺寸响应式栅格,可以设置一个数字,相当于 [nzLg]="{span:数字}",也可以设置为对象,范例: {span:5,offset:1} /// public string Lg { get; set; } /// - /// ≥992px宽尺寸响应式栅格占位格数,可选值: 0 - 24, 为 0 时隐藏,范例:设置值为6,生成[nzLg]="{span:6}" + /// ≥992px宽尺寸响应式栅格占位格数,可选值: 0 - 24, 为 0 时隐藏,范例:设置值为 6,生成 [nzLg]="{span:6}" /// public int LgSpan { get; set; } /// - /// ≥992px宽尺寸响应式栅格向右偏移的格数,即栅格左侧的间隔格数,间隔内不可以有栅格,范例: 设置值为6,将元素向右侧偏移了6格宽度,生成[nzLg]="{offset:6}" + /// ≥992px宽尺寸响应式栅格向右偏移的格数,间隔内不能有栅格,范例: 设置值为 6,将元素向右侧偏移了6格宽度,生成 [nzLg]="{offset:6}" /// public int LgOffset { get; set; } /// - /// ≥992px宽尺寸响应式栅格顺序,范例: 设置值为6,生成[nzLg]="{order:6}" + /// ≥992px宽尺寸响应式栅格顺序,范例: 设置值为 6,生成 [nzLg]="{order:6}" /// public int LgOrder { get; set; } /// - /// ≥992px宽尺寸响应式栅格向左移动的格数,范例: 设置值为6,生成[nzLg]="{pull:6}" + /// ≥992px宽尺寸响应式栅格向左移动的格数,范例: 设置值为 6,生成 [nzLg]="{pull:6}" /// public int LgPull { get; set; } /// - /// ≥992px宽尺寸响应式栅格向右移动的格数,范例: 设置值为6,生成[nzLg]="{push:6}" + /// ≥992px宽尺寸响应式栅格向右移动的格数,范例: 设置值为 6,生成 [nzLg]="{push:6}" /// public int LgPush { get; set; } /// @@ -135,23 +135,23 @@ public abstract class ColumnTagHelperBase : AngularTagHelperBase { /// public string Xl { get; set; } /// - /// ≥1200px超宽尺寸响应式栅格占位格数,可选值: 0 - 24, 为 0 时隐藏,范例:设置值为6,生成[nzXl]="{span:6}" + /// ≥1200px超宽尺寸响应式栅格占位格数,可选值: 0 - 24, 为 0 时隐藏,范例:设置值为 6,生成 [nzXl]="{span:6}" /// public int XlSpan { get; set; } /// - /// ≥1200px超宽尺寸响应式栅格向右偏移的格数,即栅格左侧的间隔格数,间隔内不可以有栅格,范例: 设置值为6,将元素向右侧偏移了6格宽度,生成[nzXl]="{offset:6}" + /// ≥1200px超宽尺寸响应式栅格向右偏移的格数,间隔内不能有栅格,范例: 设置值为 6,将元素向右侧偏移了6格宽度,生成 [nzXl]="{offset:6}" /// public int XlOffset { get; set; } /// - /// ≥1200px超宽尺寸响应式栅格顺序,范例: 设置值为6,生成[nzXl]="{order:6}" + /// ≥1200px超宽尺寸响应式栅格顺序,范例: 设置值为 6,生成 [nzXl]="{order:6}" /// public int XlOrder { get; set; } /// - /// ≥1200px超宽尺寸响应式栅格向左移动的格数,范例: 设置值为6,生成[nzXl]="{pull:6}" + /// ≥1200px超宽尺寸响应式栅格向左移动的格数,范例: 设置值为 6,生成 [nzXl]="{pull:6}" /// public int XlPull { get; set; } /// - /// ≥1200px超宽尺寸响应式栅格向右移动的格数,范例: 设置值为6,生成[nzXl]="{push:6}" + /// ≥1200px超宽尺寸响应式栅格向右移动的格数,范例: 设置值为 6,生成 [nzXl]="{push:6}" /// public int XlPush { get; set; } /// @@ -159,23 +159,23 @@ public abstract class ColumnTagHelperBase : AngularTagHelperBase { /// public string Xxl { get; set; } /// - /// ≥1600px极宽尺寸响应式栅格占位格数,可选值: 0 - 24, 为 0 时隐藏,范例:设置值为6,生成[nzXXl]="{span:6}" + /// ≥1600px极宽尺寸响应式栅格占位格数,可选值: 0 - 24, 为 0 时隐藏,范例:设置值为 6,生成[nzXXl]="{span:6}" /// public int XxlSpan { get; set; } /// - /// ≥1600px极宽尺寸响应式栅格向右偏移的格数,即栅格左侧的间隔格数,间隔内不可以有栅格,范例: 设置值为6,将元素向右侧偏移了6格宽度,生成[nzXXl]="{offset:6}" + /// ≥1600px极宽尺寸响应式栅格向右偏移的格数,间隔内不能有栅格,范例: 设置值为 6,将元素向右侧偏移了6格宽度,生成 [nzXXl]="{offset:6}" /// public int XxlOffset { get; set; } /// - /// ≥1600px极宽尺寸响应式栅格顺序,范例: 设置值为6,生成[nzXXl]="{order:6}" + /// ≥1600px极宽尺寸响应式栅格顺序,范例: 设置值为 6,生成 [nzXXl]="{order:6}" /// public int XxlOrder { get; set; } /// - /// ≥1600px极宽尺寸响应式栅格向左移动的格数,范例: 设置值为6,生成[nzXXl]="{pull:6}" + /// ≥1600px极宽尺寸响应式栅格向左移动的格数,范例: 设置值为 6,生成 [nzXXl]="{pull:6}" /// public int XxlPull { get; set; } /// - /// ≥1600px极宽尺寸响应式栅格向右移动的格数,范例: 设置值为6,生成[nzXXl]="{push:6}" + /// ≥1600px极宽尺寸响应式栅格向右移动的格数,范例: 设置值为 6,生成 [nzXXl]="{push:6}" /// public int XxlPush { get; set; } } \ No newline at end of file diff --git a/src/Util.Ui.NgZorro/Components/Base/DatePickerTagHelperBase.cs b/src/Util.Ui.NgZorro/Components/Base/DatePickerTagHelperBase.cs new file mode 100644 index 000000000..0217f3aae --- /dev/null +++ b/src/Util.Ui.NgZorro/Components/Base/DatePickerTagHelperBase.cs @@ -0,0 +1,173 @@ +using Util.Ui.NgZorro.Enums; + +namespace Util.Ui.NgZorro.Components.Base; + +/// +/// 日期选择基类 +/// +public abstract class DatePickerTagHelperBase : FormControlTagHelperBase { + /// + /// nzId,组件内部 input 的 id 值 + /// + public string NzId { get; set; } + /// + /// [nzId],组件内部 input 的 id 值 + /// + public string BindNzId { get; set; } + /// + /// [nzAllowClear],是否允许清除内容, 类型: boolean, 默认值: true + /// + public string AllowClear { get; set; } + /// + /// [nzAutoFocus],是否自动聚焦, 类型: boolean, 默认值: false + /// + public string AutoFocus { get; set; } + /// + /// [nzBackdrop],浮层是否应带有背景板, 类型: boolean, 默认值: false + /// + public string Backdrop { get; set; } + /// + /// nzMode,选择模式,可选值: 'date' | 'week' | 'month' | 'year', 默认值: 'date' + /// + public DatePickerMode Mode { get; set; } + /// + /// [nzMode],选择模式,可选值: 'date' | 'week' | 'month' | 'year', 默认值: 'date' + /// + public string BindMode { get; set; } + /// + /// [nzShowTime],是否显示时间选择,注意:该属性仅在 nzMode="date" 时有效,可传入时间选择器配置参数, 类型: object | boolean + /// + public string ShowTime { get; set; } + /// + /// nzFormat,格式化字符串,格式说明: + /// 1. 年 - yyyy + /// 2. 月 - MM + /// 3. 日 - dd + /// 4. 时 - HH + /// 5. 分 - mm + /// 6. 秒 - ss + /// 7. 毫秒 - SSS + /// 8. 周 - ww + /// + public string Format { get; set; } + /// + /// [nzFormat],格式化字符串,格式说明: + /// 1. 年 - yyyy + /// 2. 月 - MM + /// 3. 日 - dd + /// 4. 时 - HH + /// 5. 分 - mm + /// 6. 秒 - ss + /// 7. 毫秒 - SSS + /// 8. 周 - ww + /// + public string BindFormat { get; set; } + /// + /// nzSize,输入框尺寸, 可选值: 'default' | 'small' | 'large', 默认值: 'default' + /// + public InputSize Size { get; set; } + /// + /// [nzSize],输入框尺寸, 可选值: 'default' | 'small' | 'large', 默认值: 'default' + /// + public string BindSize { get; set; } + /// + /// [nzDisabled],是否禁用, 类型: boolean, 默认值: false + /// + public string Disabled { get; set; } + /// + /// [nzBorderless],是否移除边框, 类型: boolean, 默认值: false + /// + public string Borderless { get; set; } + /// + /// [nzInline],是否内联模式, 类型: boolean, 默认值: false + /// + public string Inline { get; set; } + /// + /// [nzShowWeekNumber],是否在每一行显示周数, 类型: boolean, 默认值: false + /// + public string ShowWeekNumber { get; set; } + /// + /// [nzDisabledDate],不可选择日期函数,类型:(current: Date) => boolean + /// + public string DisabledDate { get; set; } + /// + /// nzPlaceHolder,输入框占位文本 + /// + public string Placeholder { get; set; } + /// + /// [nzPlaceHolder],输入框占位文本 + /// + public string BindPlaceholder { get; set; } + /// + /// nzRenderExtraFooter,添加额外页脚, 类型: TemplateRef | string | (() => TemplateRef | string) + /// + public string RenderExtraFooter { get; set; } + /// + /// [nzRenderExtraFooter],添加额外页脚, 类型: TemplateRef | string | (() => TemplateRef | string) + /// + public string BindRenderExtraFooter { get; set; } + /// + /// [nzDateRender],自定义日期单元格内容,注意:该属性仅在 nzMode="date" 时有效, 类型: string | TemplateRef<Date> | ((d: Date) => TemplateRef<Date> | string) + /// + public string DateRender { get; set; } + /// + /// nzStatus,校验状态, 可选值: 'error' | 'warning' + /// + public FormControlStatus Status { get; set; } + /// + /// [nzStatus],校验状态, 可选值: 'error' | 'warning' + /// + public string BindStatus { get; set; } + /// + /// nzPlacement,日期选择框弹出位置, 可选值: 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight', 默认值: 'bottomLeft' + /// + public DatePickerPlacement Placement { get; set; } + /// + /// [nzPlacement],日期选择框弹出位置, 可选值: 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight', 默认值: 'bottomLeft' + /// + public string BindPlacement { get; set; } + /// + /// nzDropdownClassName,弹出日历样式类名 + /// + public string DropdownClassName { get; set; } + /// + /// [nzDropdownClassName],弹出日历样式类名 + /// + public string BindDropdownClassName { get; set; } + /// + /// [nzPopupStyle],弹出日历样式, 类型: object + /// + public string PopupStyle { get; set; } + /// + /// [nzInputReadOnly],为 input 标签设置只读属性,避免在移动设备上触发小键盘, 类型: boolean, 默认值: false + /// + public string InputReadonly { get; set; } + /// + /// [nzLocale],国际化配置, 类型: object + /// + public string Locale { get; set; } + /// + /// nzSuffixIcon,后缀图标 + /// + public AntDesignIcon SuffixIcon { get; set; } + /// + /// [nzSuffixIcon],后缀图标, 类型: string | TemplateRef + /// + public string BindSuffixIcon { get; set; } + /// + /// [required],是否必填项, 类型: boolean, 默认值: false + /// + public string Required { get; set; } + /// + /// 扩展属性 requiredMessage,必填项验证消息 + /// + public string RequiredMessage { get; set; } + /// + /// 扩展属性 [requiredMessage],必填项验证消息 + /// + public string BindRequiredMessage { get; set; } + /// + /// (nzOnOpenChange),弹出关闭日历事件, 类型: EventEmitter<boolean> + /// + public string OnOpenChange { get; set; } +} \ No newline at end of file diff --git a/src/Util.Ui.NgZorro/Components/Base/FormControlContainerTagHelperBase.cs b/src/Util.Ui.NgZorro/Components/Base/FormControlContainerTagHelperBase.cs index 28c6a657b..41fd9b6bf 100644 --- a/src/Util.Ui.NgZorro/Components/Base/FormControlContainerTagHelperBase.cs +++ b/src/Util.Ui.NgZorro/Components/Base/FormControlContainerTagHelperBase.cs @@ -5,19 +5,19 @@ /// public abstract class FormControlContainerTagHelperBase : FormContainerTagHelperBase { /// - /// 标签文本,自动创建nz-form-label,nz-form-control,nz-form-item容器标签,并设置nz-form-label的内容,支持i18n + /// 扩展属性, 标签文本,自动创建nz-form-label,nz-form-control,nz-form-item容器标签,并设置nz-form-label的内容,支持i18n /// public string LabelText { get; set; } /// - /// 标签文本,自动创建nz-form-label,nz-form-control,nz-form-item容器标签,并设置nz-form-label的内容 + /// 扩展属性, 标签文本,自动创建nz-form-label,nz-form-control,nz-form-item容器标签,并设置nz-form-label的内容 /// public string BindLabelText { get; set; } /// - /// 标签宽度 + /// 扩展属性, 标签宽度 /// public string LabelWidth { get; set; } /// - /// 是否显示标签 nz-form-label + /// 扩展属性, 是否显示标签 nz-form-label /// public bool ShowLabel { get; set; } /// diff --git a/src/Util.Ui.NgZorro/Components/Base/TooltipTagHelperBase.cs b/src/Util.Ui.NgZorro/Components/Base/TooltipTagHelperBase.cs index 1619c4dbc..a1ab55197 100644 --- a/src/Util.Ui.NgZorro/Components/Base/TooltipTagHelperBase.cs +++ b/src/Util.Ui.NgZorro/Components/Base/TooltipTagHelperBase.cs @@ -268,10 +268,14 @@ public abstract class TooltipTagHelperBase : AngularTagHelperBase { /// public string BindPopconfirmOkType { get; set; } /// - /// [nzOkDanger],气泡确认框确认按钮是否为危险按钮,默认值: false + /// [nzOkDanger],气泡确认框确认按钮是否为危险按钮,类型: boolean, 默认值: false /// public string PopconfirmOkDanger { get; set; } /// + /// [nzOkDisabled],气泡确认框是否禁用确认按钮,类型: boolean, 默认值: false + /// + public string PopconfirmOkDisabled { get; set; } + /// /// nzAutoFocus,气泡确认框按钮自动聚焦,类型: null | 'ok' | 'cancel',默认值: null /// public PopconfirmAutoFocus PopconfirmAutoFocus { get; set; } diff --git a/src/Util.Ui.NgZorro/Components/Breadcrumbs/Builders/BreadcrumbBuilder.cs b/src/Util.Ui.NgZorro/Components/Breadcrumbs/Builders/BreadcrumbBuilder.cs index 7b58c900c..90c098056 100644 --- a/src/Util.Ui.NgZorro/Components/Breadcrumbs/Builders/BreadcrumbBuilder.cs +++ b/src/Util.Ui.NgZorro/Components/Breadcrumbs/Builders/BreadcrumbBuilder.cs @@ -43,9 +43,9 @@ public BreadcrumbBuilder AutoGenerate() { /// 配置路由属性名 /// public BreadcrumbBuilder RouteLabel() { - AttributeIfNotEmpty( "nzRouteLabel", _config.GetValue( AntDesignConst.RouteLabel ) ); - AttributeIfNotEmpty( "[nzRouteLabel]", _config.GetValue( AntDesignConst.BindRouteLabel ) ); - AttributeIfNotEmpty( "[nzRouteLabelFn]", _config.GetValue( AntDesignConst.RouteLabelFn ) ); + AttributeIfNotEmpty( "nzRouteLabel", _config.GetValue( UiConst.RouteLabel ) ); + AttributeIfNotEmpty( "[nzRouteLabel]", _config.GetValue( AngularConst.BindRouteLabel ) ); + AttributeIfNotEmpty( "[nzRouteLabelFn]", _config.GetValue( UiConst.RouteLabelFn ) ); return this; } diff --git a/src/Util.Ui.NgZorro/Components/Calendars/Builders/CalendarBuilder.cs b/src/Util.Ui.NgZorro/Components/Calendars/Builders/CalendarBuilder.cs index d1ea7d07a..f81d765c7 100644 --- a/src/Util.Ui.NgZorro/Components/Calendars/Builders/CalendarBuilder.cs +++ b/src/Util.Ui.NgZorro/Components/Calendars/Builders/CalendarBuilder.cs @@ -65,6 +65,15 @@ public CalendarBuilder DisabledDate() { return this; } + /// + /// 配置自定义头部内容 + /// + public CalendarBuilder CustomHeader() { + AttributeIfNotEmpty( "nzCustomHeader", _config.GetValue( UiConst.CustomHeader ) ); + AttributeIfNotEmpty( "[nzCustomHeader]", _config.GetValue( AngularConst.BindCustomHeader ) ); + return this; + } + /// /// 配置事件 /// @@ -80,6 +89,6 @@ public CalendarBuilder Events() { public override void Config() { base.Config(); this.NgModel( _config ); - Mode().Fullscreen().DateCell().MonthCell().DisabledDate().Events(); + Mode().Fullscreen().DateCell().MonthCell().DisabledDate().CustomHeader().Events(); } } \ No newline at end of file diff --git a/src/Util.Ui.NgZorro/Components/Calendars/CalendarTagHelper.cs b/src/Util.Ui.NgZorro/Components/Calendars/CalendarTagHelper.cs index c51e47692..989e5dd17 100644 --- a/src/Util.Ui.NgZorro/Components/Calendars/CalendarTagHelper.cs +++ b/src/Util.Ui.NgZorro/Components/Calendars/CalendarTagHelper.cs @@ -12,11 +12,11 @@ namespace Util.Ui.NgZorro.Components.Calendars; [HtmlTargetElement( "util-calendar" )] public class CalendarTagHelper : AngularTagHelperBase { /// - /// [(ngModel)],模型双向绑定 + /// [(ngModel)],展示日期,双向绑定, 类型: Date, 默认值: 当前日期 /// public string NgModel { get; set; } /// - /// [ngModel],模型绑定 + /// [ngModel],展示日期, 类型: Date, 默认值: 当前日期 /// public string BindNgModel { get; set; } /// @@ -32,23 +32,23 @@ public class CalendarTagHelper : AngularTagHelperBase { /// public string BindonMode { get; set; } /// - /// [nzFullscreen],是否全屏显示,默认值: true + /// [nzFullscreen],是否全屏显示, 类型: boolean, 默认值: true /// public string Fullscreen { get; set; } /// - /// [nzDateCell],自定义渲染日期单元格模板,模版内容会被追加到单元格,类型: TemplateRef<Date> + /// [nzDateCell],自定义日期单元格,模版内容追加到单元格,类型: TemplateRef<Date> /// public string DateCell { get; set; } /// - /// [nzDateFullCell],自定义渲染日期单元格模板,模版内容覆盖单元格,类型: TemplateRef<Date> + /// [nzDateFullCell],自定义日期单元格,模版内容覆盖单元格,类型: TemplateRef<Date> /// public string DateFullCell { get; set; } /// - /// [nzMonthCell],自定义渲染月单元格模板,模版内容会被追加到单元格,类型: TemplateRef<Date> + /// [nzMonthCell],自定义月份单元格,模版内容追加到单元格,类型: TemplateRef<Date> /// public string MonthCell { get; set; } /// - /// [nzMonthFullCell],自定义渲染月单元格模板,模版内容覆盖单元格,类型: TemplateRef<Date> + /// [nzMonthFullCell],自定义月份单元格,模版内容覆盖单元格,类型: TemplateRef<Date> /// public string MonthFullCell { get; set; } /// @@ -56,6 +56,14 @@ public class CalendarTagHelper : AngularTagHelperBase { /// public string DisabledDate { get; set; } /// + /// nzCustomHeader,自定义头部内容, 类型: string | TemplateRef<void> + /// + public string CustomHeader { get; set; } + /// + /// [nzCustomHeader],自定义头部内容, 类型: string | TemplateRef<void> + /// + public string BindCustomHeader { get; set; } + /// /// (nzPanelChange),面板变化事件,类型: EventEmitter<{ date: Date, mode: 'month' | 'year' }> /// public string OnPanelChange { get; set; } diff --git a/src/Util.Ui.NgZorro/Components/Cascaders/Builders/CascaderBuilder.cs b/src/Util.Ui.NgZorro/Components/Cascaders/Builders/CascaderBuilder.cs index 303ccad9f..c7589500d 100644 --- a/src/Util.Ui.NgZorro/Components/Cascaders/Builders/CascaderBuilder.cs +++ b/src/Util.Ui.NgZorro/Components/Cascaders/Builders/CascaderBuilder.cs @@ -88,6 +88,15 @@ public CascaderBuilder ExpandTrigger() { return this; } + /// + /// 配置触发操作 + /// + public CascaderBuilder TriggerAction() { + AttributeIfNotEmpty( "nzTriggerAction", _config.GetValue( UiConst.TriggerAction )?.Description() ); + AttributeIfNotEmpty( "[nzTriggerAction]", _config.GetValue( AngularConst.BindTriggerAction ) ); + return this; + } + /// /// 配置标签属性名 /// @@ -126,8 +135,7 @@ public CascaderBuilder MenuClassName() { /// 配置浮层样式 /// public CascaderBuilder MenuStyle() { - AttributeIfNotEmpty( "nzMenuStyle", _config.GetValue( UiConst.MenuStyle ) ); - AttributeIfNotEmpty( "[nzMenuStyle]", _config.GetValue( AngularConst.BindMenuStyle ) ); + AttributeIfNotEmpty( "[nzMenuStyle]", _config.GetValue( UiConst.MenuStyle ) ); return this; } @@ -216,6 +224,23 @@ public CascaderBuilder ValueProperty() { return this; } + /// + /// 配置展开图标 + /// + public CascaderBuilder Status() { + AttributeIfNotEmpty( "nzStatus", _config.GetValue( UiConst.Status )?.Description() ); + AttributeIfNotEmpty( "[nzStatus]", _config.GetValue( AngularConst.BindStatus ) ); + return this; + } + + /// + /// 配置浮层是否应带有背景板 + /// + public CascaderBuilder Backdrop() { + AttributeIfNotEmpty( "[nzBackdrop]", _config.GetValue( UiConst.Backdrop ) ); + return this; + } + /// /// 配置事件 /// @@ -231,10 +256,10 @@ public CascaderBuilder Events() { /// public override void Config() { base.ConfigBase( _config ); - ConfigForm().AllowClear().AutoFocus().ChangeOn().ChangeOnSelect().ColumnClassName() - .Disabled().ExpandIcon().ExpandTrigger().LabelProperty().LabelRender().LoadData() + ConfigForm().Name().AllowClear().AutoFocus().ChangeOn().ChangeOnSelect().ColumnClassName() + .Disabled().ExpandIcon().ExpandTrigger().TriggerAction().LabelProperty().LabelRender().LoadData() .MenuClassName().MenuStyle().NotFoundContent().OptionRender().Options() .Placeholder().ShowArrow().ShowInput().ShowSearch().Size().SuffixIcon() - .ValueProperty().Events(); + .ValueProperty().Status().Backdrop().Events(); } } \ No newline at end of file diff --git a/src/Util.Ui.NgZorro/Components/Cascaders/CascaderTagHelper.cs b/src/Util.Ui.NgZorro/Components/Cascaders/CascaderTagHelper.cs index 2492f2ec9..77f915ced 100644 --- a/src/Util.Ui.NgZorro/Components/Cascaders/CascaderTagHelper.cs +++ b/src/Util.Ui.NgZorro/Components/Cascaders/CascaderTagHelper.cs @@ -17,19 +17,19 @@ public class CascaderTagHelper : FormControlTagHelperBase { /// private Config _config; /// - /// [nzAllowClear],是否允许清除,默认值: true + /// [nzAllowClear],是否允许清除,类型: boolean, 默认值: true /// public string AllowClear { get; set; } /// - /// [nzAutoFocus],是否自动聚焦,当存在输入框时 + /// [nzAutoFocus],是否自动聚焦,当存在输入框时, 类型: boolean, 默认值: false /// public string AutoFocus { get; set; } /// - /// [nzChangeOn],点击父级菜单项时,可通过该函数判断是否允许值的变化,函数定义: (option: any, index: number) => boolean + /// [nzChangeOn],点击父级菜单项时,可通过该函数判断是否允许值的变化,类型: (option: any, index: number) => boolean /// public string ChangeOn { get; set; } /// - /// [nzChangeOnSelect],点选每级菜单项时,是否值都会变化 + /// [nzChangeOnSelect],点选每级菜单项时,是否值都会变化, 类型: boolean, 默认值: false /// public string ChangeOnSelect { get; set; } /// @@ -41,7 +41,7 @@ public class CascaderTagHelper : FormControlTagHelperBase { /// public string BindColumnClassName { get; set; } /// - /// [nzDisabled],是否禁用 + /// [nzDisabled],是否禁用, 默认值: false /// public string Disabled { get; set; } /// @@ -49,27 +49,43 @@ public class CascaderTagHelper : FormControlTagHelperBase { /// public AntDesignIcon ExpandIcon { get; set; } /// - /// [nzExpandIcon],自定义次级菜单展开图标 + /// [nzExpandIcon],自定义次级菜单展开图标, 类型: string|TemplateRef<void> /// public string BindExpandIcon { get; set; } /// - /// nzExpandTrigger,次级菜单的展开方式 + /// nzExpandTrigger,次级菜单的展开方式, 类型: 'click'|'hover',默认值: 'click' /// public CascaderExpandTrigger ExpandTrigger { get; set; } /// - /// [nzExpandTrigger],次级菜单的展开方式 + /// [nzExpandTrigger],次级菜单的展开方式, 类型: 'click'|'hover',默认值: 'click' /// public string BindExpandTrigger { get; set; } /// - /// nzLabelProperty,选项显示值的属性名 + /// nzTriggerAction,触发操作, 类型: 'click'|'hover',默认值: 'click' + /// + public CascaderTriggerAction TriggerAction { get; set; } + /// + /// [nzTriggerAction],触发操作, 类型: 'click'|'hover',默认值: 'click' + /// + public string BindTriggerAction { get; set; } + /// + /// nzLabelProperty,选项显示文本的属性名, 默认值: 'label' /// public string LabelProperty { get; set; } /// - /// [nzLabelProperty],选项显示值的属性名 + /// [nzLabelProperty],选项显示文本的属性名, 默认值: 'label' /// public string BindLabelProperty { get; set; } /// - /// [nzLabelRender],选择后展示的渲染模板 + /// nzValueProperty,选项实际值的属性名,默认值: 'value' + /// + public string ValueProperty { get; set; } + /// + /// [nzValueProperty],选项实际值的属性名,默认值: 'value' + /// + public string BindValueProperty { get; set; } + /// + /// [nzLabelRender],选择后展示的渲染模板, 类型: TemplateRef<any> /// public string LabelRender { get; set; } /// @@ -85,39 +101,35 @@ public class CascaderTagHelper : FormControlTagHelperBase { /// public string BindMenuClassName { get; set; } /// - /// nzMenuStyle,自定义浮层样式 - /// - public string MenuStyle { get; set; } - /// /// [nzMenuStyle],自定义浮层样式 /// - public string BindMenuStyle { get; set; } + public string MenuStyle { get; set; } /// - /// nzNotFoundContent,下拉列表为空时显示的内容 + /// nzNotFoundContent,下拉列表为空时显示的内容, 类型: string | TemplateRef<void> /// public string NotFoundContent { get; set; } /// - /// [nzNotFoundContent],下拉列表为空时显示的内容 + /// [nzNotFoundContent],下拉列表为空时显示的内容, 类型: string | TemplateRef<void> /// public string BindNotFoundContent { get; set; } /// - /// [nzOptionRender],选项的渲染模板 + /// [nzOptionRender],选项的渲染模板, 类型: TemplateRef<{ $implicit: NzCascaderOption, index: number }> /// public string OptionRender { get; set; } /// - /// [nzOptions],可选项数据源 + /// [nzOptions],可选项数据源, 类型: object[] /// public string Options { get; set; } /// - /// nzPlaceHolder,输入框占位文本 + /// nzPlaceHolder,输入框占位文本, 默认值: '请选择' /// public string Placeholder { get; set; } /// - /// [nzPlaceHolder],输入框占位文本 + /// [nzPlaceHolder],输入框占位文本, 默认值: '请选择' /// public string BindPlaceholder { get; set; } /// - /// [nzShowArrow],是否显示箭头,默认值: true + /// [nzShowArrow],是否显示箭头,类型: boolean, 默认值: true /// public string ShowArrow { get; set; } /// @@ -125,15 +137,15 @@ public class CascaderTagHelper : FormControlTagHelperBase { /// public string ShowInput { get; set; } /// - /// [nzShowSearch],是否支持搜索,默认情况下对 label 进行全匹配搜索,不能和 [nzLoadData] 同时使用 + /// [nzShowSearch],是否支持搜索,默认情况下对 label 进行全匹配搜索,不能和 [nzLoadData] 同时使用, 类型: boolean | NzShowSearchOptions ,默认值: false /// public string ShowSearch { get; set; } /// - /// nzSize,输入框大小,可选值: 'large'|'small'|'default' + /// nzSize,输入框尺寸,可选值: 'large'|'small'|'default', 默认值: 'default' /// public InputSize Size { get; set; } /// - /// [nzSize],输入框大小,可选值: 'large'|'small'|'default' + /// [nzSize],输入框尺寸,可选值: 'large'|'small'|'default', 默认值: 'default' /// public string BindSize { get; set; } /// @@ -141,27 +153,31 @@ public class CascaderTagHelper : FormControlTagHelperBase { /// public AntDesignIcon SuffixIcon { get; set; } /// - /// [nzSuffixIcon],选择框后缀图标 + /// [nzSuffixIcon],选择框后缀图标, 类型: string | TemplateRef<void> /// public string BindSuffixIcon { get; set; } /// - /// nzValueProperty,选项实际值的属性名,默认值: 'value' + /// nzStatus,校验状态, 可选值: 'error' | 'warning' /// - public string ValueProperty { get; set; } + public FormControlStatus Status { get; set; } /// - /// [nzValueProperty],选项实际值的属性名,默认值: 'value' + /// [nzStatus],校验状态, 可选值: 'error' | 'warning' /// - public string BindValueProperty { get; set; } + public string BindStatus { get; set; } + /// + /// [nzBackdrop],浮层是否应带有背景板,类型: boolean, 默认值: false + /// + public string Backdrop { get; set; } /// - /// (nzClear),清除事件,清除值时触发 + /// (nzClear),清除事件,清除值时触发, 类型: EventEmitter<void> /// public string OnClear { get; set; } /// - /// (nzVisibleChange),显示状态改变事件,菜单浮层显示/隐藏时触发 + /// (nzVisibleChange),显示状态变化事件,菜单浮层显示/隐藏时触发, 类型: EventEmitter<boolean> /// public string OnVisibleChange { get; set; } /// - /// (nzSelectionChange),选中状态改变事件,值发生变化时触发 + /// (nzSelectionChange),选中状态变化事件,值发生变化时触发, 类型: EventEmitter<NzCascaderOption[]> /// public string OnSelectionChange { get; set; } diff --git a/src/Util.Ui.NgZorro/Components/Checkboxes/Builders/CheckboxBuilder.cs b/src/Util.Ui.NgZorro/Components/Checkboxes/Builders/CheckboxBuilder.cs index be049ffb6..338361cf7 100644 --- a/src/Util.Ui.NgZorro/Components/Checkboxes/Builders/CheckboxBuilder.cs +++ b/src/Util.Ui.NgZorro/Components/Checkboxes/Builders/CheckboxBuilder.cs @@ -1,5 +1,7 @@ using Util.Ui.Angular.Configs; using Util.Ui.NgZorro.Components.Base; +using Util.Ui.NgZorro.Configs; +using Util.Ui.NgZorro.Extensions; namespace Util.Ui.NgZorro.Components.Checkboxes.Builders; @@ -21,6 +23,15 @@ public CheckboxBuilder( Config config ) : base( config,"label" ) { base.Attribute( "nz-checkbox" ); } + /// + /// 配置内部id + /// + public CheckboxBuilder NzId() { + AttributeIfNotEmpty( "nzId", _config.GetValue( UiConst.NzId ) ); + AttributeIfNotEmpty( "[nzId]", _config.GetValue( AngularConst.BindNzId ) ); + return this; + } + /// /// 配置自动获取焦点 /// @@ -66,7 +77,13 @@ public CheckboxBuilder Value() { /// 配置标签 /// public CheckboxBuilder Label() { - if( _config.Contains( UiConst.Label ) ) { + var options = NgZorroOptionsService.GetOptions(); + var text = _config.GetValue( UiConst.Label ); + if ( text.IsEmpty() == false ) { + if ( options.EnableI18n ) { + this.AppendContentByI18n( text ); + return this; + } SetContent( _config.GetValue( UiConst.Label ) ); return this; } @@ -90,7 +107,7 @@ public CheckboxBuilder Events() { /// public override void Config() { base.ConfigBase( _config ); - ConfigForm().Name().AutoFocus().Disabled().Indeterminate().Checked() + ConfigForm().NzId().Name().AutoFocus().Disabled().Indeterminate().Checked() .Value().Label().Events(); } } \ No newline at end of file diff --git a/src/Util.Ui.NgZorro/Components/Checkboxes/Builders/CheckboxGroupBuilder.cs b/src/Util.Ui.NgZorro/Components/Checkboxes/Builders/CheckboxGroupBuilder.cs index d90e9e275..713e8c940 100644 --- a/src/Util.Ui.NgZorro/Components/Checkboxes/Builders/CheckboxGroupBuilder.cs +++ b/src/Util.Ui.NgZorro/Components/Checkboxes/Builders/CheckboxGroupBuilder.cs @@ -31,6 +31,6 @@ public CheckboxGroupBuilder Disabled() { /// public override void Config() { base.ConfigBase( _config ); - ConfigForm().Disabled(); + ConfigForm().Name().Disabled(); } } \ No newline at end of file diff --git a/src/Util.Ui.NgZorro/Components/Checkboxes/CheckboxGroupTagHelper.cs b/src/Util.Ui.NgZorro/Components/Checkboxes/CheckboxGroupTagHelper.cs index 3bd0c217e..a2d15a4a5 100644 --- a/src/Util.Ui.NgZorro/Components/Checkboxes/CheckboxGroupTagHelper.cs +++ b/src/Util.Ui.NgZorro/Components/Checkboxes/CheckboxGroupTagHelper.cs @@ -16,7 +16,7 @@ public class CheckboxGroupTagHelper : FormControlTagHelperBase { /// private Config _config; /// - /// [nzDisabled],禁用 + /// [nzDisabled],是否禁用全部复选框, 默认值: false /// public string Disabled { get; set; } diff --git a/src/Util.Ui.NgZorro/Components/Checkboxes/CheckboxTagHelper.cs b/src/Util.Ui.NgZorro/Components/Checkboxes/CheckboxTagHelper.cs index b1d6c0f68..8e813b365 100644 --- a/src/Util.Ui.NgZorro/Components/Checkboxes/CheckboxTagHelper.cs +++ b/src/Util.Ui.NgZorro/Components/Checkboxes/CheckboxTagHelper.cs @@ -16,39 +16,47 @@ public class CheckboxTagHelper : FormControlTagHelperBase { /// private Config _config; /// - /// [nzAutoFocus],是否自动获取焦点 + /// nzId,组件内部的 id + /// + public string NzId { get; set; } + /// + /// [nzId],组件内部的 id + /// + public string BindNzId { get; set; } + /// + /// [nzAutoFocus],是否自动获取焦点, 类型: boolean, 默认值: false /// public string AutoFocus { get; set; } /// - /// [nzDisabled],是否禁用 + /// [nzDisabled],是否禁用, 默认值: false /// public string Disabled { get; set; } /// - /// [nzIndeterminate],是否中间状态 + /// [nzIndeterminate],是否中间状态,当复选框未全部选中或全部取消时,全选复选框的状态, 类型: boolean, 默认值: false /// public string Indeterminate { get; set; } /// - /// nzValue,值,仅与 nz-checkbox-wrapper 的选中回调配合使用 + /// nzValue,值,与 <util-checkbox-wrapper> 的 on-change 配合使用 /// public string Value { get; set; } /// - /// [nzValue],值,仅与 nz-checkbox-wrapper 的选中回调配合使用 + /// [nzValue],值,与 <util-checkbox-wrapper> 的 on-change 配合使用 /// public string BindValue { get; set; } /// - /// 标签文本 + /// 扩展属性, 标签文本, 支持多语言 /// public string Label { get; set; } /// - /// 标签文本 + /// 扩展属性, 标签文本 /// public string BindLabel { get; set; } /// - /// [nzChecked],是否选中 + /// [nzChecked],是否选中, 类型: boolean, 默认值: false /// public string Checked { get; set; } /// - /// (nzCheckedChange),选中状态变更事件 + /// (nzCheckedChange),选中状态变化事件, 类型: EventEmitter<boolean> /// public string OnCheckedChange { get; set; } diff --git a/src/Util.Ui.NgZorro/Components/Checkboxes/CheckboxWrapperTagHelper.cs b/src/Util.Ui.NgZorro/Components/Checkboxes/CheckboxWrapperTagHelper.cs index 9b7ca122f..728bc1e8d 100644 --- a/src/Util.Ui.NgZorro/Components/Checkboxes/CheckboxWrapperTagHelper.cs +++ b/src/Util.Ui.NgZorro/Components/Checkboxes/CheckboxWrapperTagHelper.cs @@ -16,7 +16,7 @@ public class CheckboxWrapperTagHelper : AngularTagHelperBase { /// private Config _config; /// - /// (nzOnChange),变更事件 + /// (nzOnChange),选中数据变化事件,类型: EventEmitter<any[]> /// public string OnChange { get; set; } diff --git a/src/Util.Ui.NgZorro/Components/ColorPickers/Builders/ColorPickerBuilder.cs b/src/Util.Ui.NgZorro/Components/ColorPickers/Builders/ColorPickerBuilder.cs index e31c03a94..74801e753 100644 --- a/src/Util.Ui.NgZorro/Components/ColorPickers/Builders/ColorPickerBuilder.cs +++ b/src/Util.Ui.NgZorro/Components/ColorPickers/Builders/ColorPickerBuilder.cs @@ -101,6 +101,7 @@ public ColorPickerBuilder DisabledAlpha() { public ColorPickerBuilder Trigger() { AttributeIfNotEmpty( "nzTrigger", _config.GetValue( UiConst.Trigger )?.Description() ); AttributeIfNotEmpty( "[nzTrigger]", _config.GetValue( AngularConst.BindTrigger ) ); + AttributeIfNotEmpty( "[nzFlipFlop]", _config.GetValue( UiConst.FlipFlop ) ); return this; } diff --git a/src/Util.Ui.NgZorro/Components/ColorPickers/ColorBlockTagHelper.cs b/src/Util.Ui.NgZorro/Components/ColorPickers/ColorBlockTagHelper.cs index e59ab8865..ebc0d02d0 100644 --- a/src/Util.Ui.NgZorro/Components/ColorPickers/ColorBlockTagHelper.cs +++ b/src/Util.Ui.NgZorro/Components/ColorPickers/ColorBlockTagHelper.cs @@ -24,11 +24,11 @@ public class ColorBlockTagHelper : AngularTagHelperBase { /// public string BindColor { get; set; } /// - /// nzSize,控件尺寸, 可选值: 'default' | 'small' | 'large' , 默认值: 'default' + /// nzSize,颜色块尺寸, 可选值: 'default' | 'small' | 'large' , 默认值: 'default' /// public InputSize Size { get; set; } /// - /// [nzSize],控件尺寸, 可选值: 'default' | 'small' | 'large' , 默认值: 'default' + /// [nzSize],颜色块尺寸, 可选值: 'default' | 'small' | 'large' , 默认值: 'default' /// public string BindSize { get; set; } /// diff --git a/src/Util.Ui.NgZorro/Components/ColorPickers/ColorPickerTagHelper.cs b/src/Util.Ui.NgZorro/Components/ColorPickers/ColorPickerTagHelper.cs index a26417d3b..ce5a50e61 100644 --- a/src/Util.Ui.NgZorro/Components/ColorPickers/ColorPickerTagHelper.cs +++ b/src/Util.Ui.NgZorro/Components/ColorPickers/ColorPickerTagHelper.cs @@ -17,7 +17,7 @@ public class ColorPickerTagHelper : FormControlTagHelperBase { /// private Config _config; /// - /// nzTitle,标题,支持i18n + /// nzTitle,标题,支持多语言 /// public string Title { get; set; } /// @@ -41,23 +41,23 @@ public class ColorPickerTagHelper : FormControlTagHelperBase { /// public string BindValue { get; set; } /// - /// [nzShowText],是否显示颜色文本,默认值: false + /// [nzShowText],是否显示颜色文本,类型: boolean, 默认值: false /// public string ShowText { get; set; } /// - /// nzSize,控件尺寸, 可选值: 'default' | 'small' | 'large' , 默认值: 'default' + /// nzSize,触发器尺寸, 可选值: 'default' | 'small' | 'large' , 默认值: 'default' /// public InputSize Size { get; set; } /// - /// [nzSize],控件尺寸, 可选值: 'default' | 'small' | 'large' , 默认值: 'default' + /// [nzSize],触发器尺寸, 可选值: 'default' | 'small' | 'large' , 默认值: 'default' /// public string BindSize { get; set; } /// - /// [nzDisabled],是否禁用, 默认值: false + /// [nzDisabled],是否禁用,类型: boolean, 默认值: false /// public string Disabled { get; set; } /// - /// [nzDisabledAlpha],是否禁用透明度, 默认值: false + /// [nzDisabledAlpha],是否禁用透明度, 类型: boolean, 默认值: false /// public string DisabledAlpha { get; set; } /// @@ -69,7 +69,11 @@ public class ColorPickerTagHelper : FormControlTagHelperBase { /// public string BindTrigger { get; set; } /// - /// [nzAllowClear], 是否允许清除选择的颜色, 默认值: false + /// [nzFlipFlop],自定义触发元素, 类型: TemplateRef<void> + /// + public string FlipFlop { get; set; } + /// + /// [nzAllowClear], 是否允许清除选择的颜色, 类型: boolean, 默认值: false /// public string AllowClear { get; set; } /// @@ -81,7 +85,7 @@ public class ColorPickerTagHelper : FormControlTagHelperBase { /// public string BindFormat { get; set; } /// - /// [nzOpen],是否显示弹出窗口 ,默认值: false + /// [nzOpen],是否显示弹出窗口 ,类型: boolean, 默认值: false /// public string Open { get; set; } /// diff --git a/src/Util.Ui.NgZorro/Components/Containers/Builders/ContainerBuilder.cs b/src/Util.Ui.NgZorro/Components/Containers/Builders/ContainerBuilder.cs index 4ee03049b..5ffd2a438 100644 --- a/src/Util.Ui.NgZorro/Components/Containers/Builders/ContainerBuilder.cs +++ b/src/Util.Ui.NgZorro/Components/Containers/Builders/ContainerBuilder.cs @@ -21,27 +21,13 @@ public ContainerBuilder( Config config ) : base( config, "ng-container" ) { _config = config; } - /// - /// 配置模板出口 - /// - public ContainerBuilder NgTemplateOutlet() { - AttributeIfNotEmpty( "*ngTemplateOutlet", _config.GetValue( AngularConst.NgTemplateOutlet ) ); - return this; - } - - /// - /// 配置提及建议 - /// - public ContainerBuilder MentionSuggestion() { - AttributeIfNotEmpty( "*nzMentionSuggestion", _config.GetValue( UiConst.MentionSuggestion ) ); - return this; - } - /// /// 配置 /// public override void Config() { base.Config(); - NgTemplateOutlet().MentionSuggestion().SpaceItem( _config ); + this.SpaceItem(_config); + AttributeIfNotEmpty( "*ngTemplateOutlet", _config.GetValue( AngularConst.NgTemplateOutlet ) ); + AttributeIfNotEmpty( "*nzMentionSuggestion", _config.GetValue( UiConst.MentionSuggestion ) ); } } \ No newline at end of file diff --git a/src/Util.Ui.NgZorro/Components/DatePickers/Builders/DatePickerBuilder.cs b/src/Util.Ui.NgZorro/Components/DatePickers/Builders/DatePickerBuilder.cs index 33e4b5c8c..36956d051 100644 --- a/src/Util.Ui.NgZorro/Components/DatePickers/Builders/DatePickerBuilder.cs +++ b/src/Util.Ui.NgZorro/Components/DatePickers/Builders/DatePickerBuilder.cs @@ -2,7 +2,7 @@ using Util.Ui.NgZorro.Components.Base; using Util.Ui.NgZorro.Enums; -namespace Util.Ui.NgZorro.Components.DatePickers.Builders; +namespace Util.Ui.NgZorro.Components.DatePickers.Builders; /// /// 日期选择标签生成器 @@ -24,8 +24,9 @@ public DatePickerBuilder( Config config ) : base( config, "nz-date-picker" ) { /// /// 配置输入框标识 /// - public DatePickerBuilder InputId() { - AttributeIfNotEmpty( "nzId", _config.GetValue( UiConst.InputId ) ); + public DatePickerBuilder NzId() { + AttributeIfNotEmpty( "nzId", _config.GetValue( UiConst.NzId ) ); + AttributeIfNotEmpty( "[nzId]", _config.GetValue( AngularConst.BindNzId ) ); return this; } @@ -45,6 +46,14 @@ public DatePickerBuilder AutoFocus() { return this; } + /// + /// 配置浮层是否应带有背景板 + /// + public DatePickerBuilder Backdrop() { + AttributeIfNotEmpty( "[nzBackdrop]", _config.GetValue( UiConst.Backdrop ) ); + return this; + } + /// /// 配置默认面板日期 /// @@ -91,8 +100,7 @@ public DatePickerBuilder DropdownClassName() { /// 配置弹出日历样式 /// public DatePickerBuilder PopupStyle() { - AttributeIfNotEmpty( "nzPopupStyle", _config.GetValue( UiConst.PopupStyle ) ); - AttributeIfNotEmpty( "[nzPopupStyle]", _config.GetValue( AngularConst.BindPopupStyle ) ); + AttributeIfNotEmpty( "[nzPopupStyle]", _config.GetValue( UiConst.PopupStyle ) ); return this; } @@ -100,8 +108,18 @@ public DatePickerBuilder PopupStyle() { /// 配置日期格式 /// public DatePickerBuilder Format() { - AttributeIfNotEmpty( "nzFormat", _config.GetValue( UiConst.Format ) ); - AttributeIfNotEmpty( "[nzFormat]", _config.GetValue( AngularConst.BindFormat ) ); + var format = _config.GetValue( UiConst.Format ); + if ( format.IsEmpty() == false ) { + Attribute( "nzFormat", format ); + return this; + } + var bindFormat = _config.GetValue( AngularConst.BindFormat ); + if ( bindFormat.IsEmpty() == false ) { + Attribute( "[nzFormat]", bindFormat ); + return this; + } + if ( _config.GetValue( UiConst.Mode ) == DatePickerMode.Week ) + Attribute( "nzFormat", "yyyy-ww" ); return this; } @@ -174,6 +192,22 @@ public DatePickerBuilder Borderless() { return this; } + /// + /// 配置内联模式 + /// + public DatePickerBuilder Inline() { + AttributeIfNotEmpty( "[nzInline]", _config.GetValue( UiConst.Inline ) ); + return this; + } + + /// + /// 配置显示周数 + /// + public DatePickerBuilder ShowWeekNumber() { + AttributeIfNotEmpty( "[nzShowWeekNumber]", _config.GetValue( UiConst.ShowWeekNumber ) ); + return this; + } + /// /// 配置自定义日期单元格内容 /// @@ -206,6 +240,24 @@ public DatePickerBuilder ShowNow() { return this; } + /// + /// 配置校验状态 + /// + public DatePickerBuilder Status() { + AttributeIfNotEmpty( "nzStatus", _config.GetValue( UiConst.Status )?.Description() ); + AttributeIfNotEmpty( "[nzStatus]", _config.GetValue( AngularConst.BindStatus ) ); + return this; + } + + /// + /// 配置校验状态 + /// + public DatePickerBuilder Placement() { + AttributeIfNotEmpty( "nzPlacement", _config.GetValue( UiConst.Placement )?.Description() ); + AttributeIfNotEmpty( "[nzPlacement]", _config.GetValue( AngularConst.BindPlacement ) ); + return this; + } + /// /// 配置事件 /// @@ -220,10 +272,13 @@ public DatePickerBuilder Events() { /// public override void Config() { base.ConfigBase( _config ); - ConfigForm().Name().InputId().AllowClear().AutoFocus().DefaultPickerValue() + ConfigForm().Name().NzId().AllowClear().AutoFocus() + .Backdrop().DefaultPickerValue() .Disabled().DisabledDate().DisabledTime() .DropdownClassName().PopupStyle().Format().InputReadonly().Locale().Mode() - .Placeholder().RenderExtraFooter().Size().SuffixIcon().Borderless().DateRender() - .ShowTime().ShowToday().ShowNow().Events(); + .Placeholder().RenderExtraFooter().Size().SuffixIcon().Borderless().Inline() + .ShowWeekNumber() + .DateRender().ShowTime().ShowToday().ShowNow().Status().Placement() + .Events(); } } \ No newline at end of file diff --git a/src/Util.Ui.NgZorro/Components/DatePickers/Builders/RangePickerBuilder.cs b/src/Util.Ui.NgZorro/Components/DatePickers/Builders/RangePickerBuilder.cs index cf7ba992e..27da188ba 100644 --- a/src/Util.Ui.NgZorro/Components/DatePickers/Builders/RangePickerBuilder.cs +++ b/src/Util.Ui.NgZorro/Components/DatePickers/Builders/RangePickerBuilder.cs @@ -27,6 +27,15 @@ public RangePickerBuilder( Config config ) : base( config, "nz-range-picker" ) { _config = config; } + /// + /// 配置输入框标识 + /// + public RangePickerBuilder NzId() { + AttributeIfNotEmpty( "nzId", _config.GetValue( UiConst.NzId ) ); + AttributeIfNotEmpty( "[nzId]", _config.GetValue( AngularConst.BindNzId ) ); + return this; + } + /// /// 配置允许清除 /// @@ -43,6 +52,14 @@ public RangePickerBuilder AutoFocus() { return this; } + /// + /// 配置浮层是否应带有背景板 + /// + public RangePickerBuilder Backdrop() { + AttributeIfNotEmpty( "[nzBackdrop]", _config.GetValue( UiConst.Backdrop ) ); + return this; + } + /// /// 配置默认面板日期 /// @@ -89,8 +106,7 @@ public RangePickerBuilder DropdownClassName() { /// 配置弹出日历样式 /// public RangePickerBuilder PopupStyle() { - AttributeIfNotEmpty( "nzPopupStyle", _config.GetValue( UiConst.PopupStyle ) ); - AttributeIfNotEmpty( "[nzPopupStyle]", _config.GetValue( AngularConst.BindPopupStyle ) ); + AttributeIfNotEmpty( "[nzPopupStyle]", _config.GetValue( UiConst.PopupStyle ) ); return this; } @@ -146,6 +162,14 @@ public RangePickerBuilder RenderExtraFooter() { return this; } + /// + /// 配置自定义日期单元格内容 + /// + public RangePickerBuilder DateRender() { + AttributeIfNotEmpty( "[nzDateRender]", _config.GetValue( UiConst.DateRender ) ); + return this; + } + /// /// 配置输入框大小 /// @@ -172,6 +196,22 @@ public RangePickerBuilder Borderless() { return this; } + /// + /// 配置内联模式 + /// + public RangePickerBuilder Inline() { + AttributeIfNotEmpty( "[nzInline]", _config.GetValue( UiConst.Inline ) ); + return this; + } + + /// + /// 配置显示周数 + /// + public RangePickerBuilder ShowWeekNumber() { + AttributeIfNotEmpty( "[nzShowWeekNumber]", _config.GetValue( UiConst.ShowWeekNumber ) ); + return this; + } + /// /// 配置预设时间范围 /// @@ -197,6 +237,24 @@ public RangePickerBuilder ShowTime() { return this; } + /// + /// 配置校验状态 + /// + public RangePickerBuilder Status() { + AttributeIfNotEmpty( "nzStatus", _config.GetValue( UiConst.Status )?.Description() ); + AttributeIfNotEmpty( "[nzStatus]", _config.GetValue( AngularConst.BindStatus ) ); + return this; + } + + /// + /// 配置校验状态 + /// + public RangePickerBuilder Placement() { + AttributeIfNotEmpty( "nzPlacement", _config.GetValue( UiConst.Placement )?.Description() ); + AttributeIfNotEmpty( "[nzPlacement]", _config.GetValue( AngularConst.BindPlacement ) ); + return this; + } + /// /// 配置事件 /// @@ -212,12 +270,15 @@ public RangePickerBuilder Events() { /// public override void Config() { base.ConfigBase( _config ); - ConfigForm().Name().AllowClear().AutoFocus().DefaultPickerValue() + ConfigForm().NzId().Name().AllowClear().AutoFocus() + .Backdrop().DefaultPickerValue() .Disabled().DisabledDate().DisabledTime() .DropdownClassName().PopupStyle() .Format().InputReadonly().Locale().Mode() - .Placeholder().RenderExtraFooter().Size().SuffixIcon().Borderless() - .Ranges().Separator().ShowTime().Events(); + .Placeholder().RenderExtraFooter().DateRender() + .Size().SuffixIcon().Borderless().Inline().ShowWeekNumber() + .Ranges().Separator().ShowTime().Status().Placement() + .Events(); EnableExtend(); } diff --git a/src/Util.Ui.NgZorro/Components/DatePickers/DatePickerTagHelper.cs b/src/Util.Ui.NgZorro/Components/DatePickers/DatePickerTagHelper.cs index 7ae3c9e95..c40337868 100644 --- a/src/Util.Ui.NgZorro/Components/DatePickers/DatePickerTagHelper.cs +++ b/src/Util.Ui.NgZorro/Components/DatePickers/DatePickerTagHelper.cs @@ -2,7 +2,6 @@ using Util.Ui.NgZorro.Components.Base; using Util.Ui.NgZorro.Components.DatePickers.Renders; using Util.Ui.NgZorro.Components.Inputs.Helpers; -using Util.Ui.NgZorro.Enums; using Util.Ui.Renders; namespace Util.Ui.NgZorro.Components.DatePickers; @@ -11,155 +10,33 @@ namespace Util.Ui.NgZorro.Components.DatePickers; /// 日期选择,生成的标签为<nz-date-picker></nz-date-picker> /// [HtmlTargetElement( "util-date-picker" )] -public class DatePickerTagHelper : FormControlTagHelperBase { +public class DatePickerTagHelper : DatePickerTagHelperBase { /// /// 配置 /// private Config _config; /// - /// nzId,组件内部 input 的 id 值 - /// - public string InputId { get; set; } - /// - /// [nzAllowClear],是否允许清除内容 - /// - public string AllowClear { get; set; } - /// - /// [nzAutoFocus],是否自动聚焦 - /// - public string AutoFocus { get; set; } - /// - /// nzDefaultPickerValue,默认面板日期 + /// nzDefaultPickerValue,默认面板日期,类型: Date /// public string DefaultPickerValue { get; set; } /// - /// [nzDefaultPickerValue],默认面板日期 + /// [nzDefaultPickerValue],默认面板日期,类型: Date /// public string BindDefaultPickerValue { get; set; } /// - /// [nzDisabled],是否禁用 - /// - public string Disabled { get; set; } - /// - /// [nzDisabledDate],不可选择日期函数,函数定义:(current: Date) => boolean - /// - public string DisabledDate { get; set; } - /// - /// [nzDisabledTime],不可选择时间函数,函数定义:(current: Date) => { nzDisabledHours, nzDisabledMinutes, nzDisabledSeconds },注意:该属性仅在 nzMode="date" 时有效 + /// [nzDisabledTime],不可选择时间函数,类型:(current: Date) => { nzDisabledHours, nzDisabledMinutes, nzDisabledSeconds } /// public string DisabledTime { get; set; } /// - /// nzDropdownClassName,弹出日历样式类名 - /// - public string DropdownClassName { get; set; } - /// - /// [nzDropdownClassName],弹出日历样式类名 - /// - public string BindDropdownClassName { get; set; } - /// - /// nzPopupStyle,弹出日历样式 - /// - public string PopupStyle { get; set; } - /// - /// [nzPopupStyle],弹出日历样式 - /// - public string BindPopupStyle { get; set; } - /// - /// nzFormat,格式化字符串,格式说明: - /// 1. 年 - yyyy - /// 2. 月 - MM - /// 3. 日 - dd - /// 4. 时 - HH - /// 5. 分 - mm - /// 6. 秒 - ss - /// 7. 毫秒 - SSS - /// - public string Format { get; set; } - /// - /// [nzFormat],格式化字符串,格式说明: - /// 1. 年 - yyyy - /// 2. 月 - MM - /// 3. 日 - dd - /// 4. 时 - HH - /// 5. 分 - mm - /// 6. 秒 - ss - /// 7. 毫秒 - SSS - /// - public string BindFormat { get; set; } - /// - /// [nzInputReadOnly],为 input 标签设置只读属性,避免在移动设备上触发小键盘 - /// - public string InputReadonly { get; set; } - /// - /// [nzLocale],国际化配置 - /// - public string Locale { get; set; } - /// - /// nzMode,选择模式 - /// - public DatePickerMode Mode { get; set; } - /// - /// [nzMode],选择模式 - /// - public string BindMode { get; set; } - /// - /// nzPlaceHolder,输入框占位文本 - /// - public string Placeholder { get; set; } - /// - /// [nzPlaceHolder],输入框占位文本 - /// - public string BindPlaceholder { get; set; } - /// - /// nzRenderExtraFooter,添加额外页脚 - /// - public string RenderExtraFooter { get; set; } - /// - /// [nzRenderExtraFooter],添加额外页脚 - /// - public string BindRenderExtraFooter { get; set; } - /// - /// nzSize,输入框大小, 可选值: 'default' | 'small' | 'large' - /// - public InputSize Size { get; set; } - /// - /// [nzSize],输入框大小, 可选值: 'default' | 'small' | 'large' - /// - public string BindSize { get; set; } - /// - /// nzSuffixIcon,后缀图标 - /// - public AntDesignIcon SuffixIcon { get; set; } - /// - /// [nzSuffixIcon],后缀图标 - /// - public string BindSuffixIcon { get; set; } - /// - /// [nzBorderless],是否移除边框 - /// - public string Borderless { get; set; } - /// - /// [nzDateRender],自定义日期单元格内容,注意:该属性仅在 nzMode="date" 时有效 - /// - public string DateRender { get; set; } - /// - /// [nzShowTime],是否显示时间选择,注意:该属性仅在 nzMode="date" 时有效 - /// - public string ShowTime { get; set; } - /// - /// [nzShowToday],是否显示“今天”按钮,注意:该属性仅在 nzMode="date" 时有效 + /// [nzShowToday],是否显示“今天”按钮,注意:仅在 nzMode="date" 时有效 /// public string ShowToday { get; set; } /// - /// [nzShowNow],是否显示“此刻”按钮,注意:该属性仅在 nzMode="date",且 [nzShowTime]="true" 时有效 + /// [nzShowNow],是否显示“此刻”按钮,注意:仅在 nzMode="date",且 [nzShowTime]="true" 时有效 /// public string ShowNow { get; set; } /// - /// (nzOnOpenChange),弹出关闭日历事件 - /// - public string OnOpenChange { get; set; } - /// - /// (nzOnOk),点击确定按钮事件 + /// (nzOnOk),点击确定按钮事件, 类型: EventEmitter<Date> /// public string OnOk { get; set; } diff --git a/src/Util.Ui.NgZorro/Components/DatePickers/RangePickerTagHelper.cs b/src/Util.Ui.NgZorro/Components/DatePickers/RangePickerTagHelper.cs index a14a9088e..c43d0215e 100644 --- a/src/Util.Ui.NgZorro/Components/DatePickers/RangePickerTagHelper.cs +++ b/src/Util.Ui.NgZorro/Components/DatePickers/RangePickerTagHelper.cs @@ -4,7 +4,6 @@ using Util.Ui.NgZorro.Components.DatePickers.Helpers; using Util.Ui.NgZorro.Components.DatePickers.Renders; using Util.Ui.NgZorro.Components.Inputs.Helpers; -using Util.Ui.NgZorro.Enums; using Util.Ui.Renders; namespace Util.Ui.NgZorro.Components.DatePickers; @@ -13,130 +12,24 @@ namespace Util.Ui.NgZorro.Components.DatePickers; /// 日期范围选择,生成的标签为<nz-range-picker></nz-range-picker> /// [HtmlTargetElement( "util-range-picker" )] -public class RangePickerTagHelper : FormControlTagHelperBase { +public class RangePickerTagHelper : DatePickerTagHelperBase { /// /// 配置 /// private Config _config; /// - /// [nzAllowClear],是否允许清除内容 - /// - public string AllowClear { get; set; } - /// - /// [nzAutoFocus],是否自动聚焦 - /// - public string AutoFocus { get; set; } - /// - /// nzDefaultPickerValue,默认面板日期 + /// nzDefaultPickerValue,默认面板日期,类型: Date[] /// public string DefaultPickerValue { get; set; } /// - /// [nzDefaultPickerValue],默认面板日期 + /// [nzDefaultPickerValue],默认面板日期,类型: Date[] /// public string BindDefaultPickerValue { get; set; } /// - /// [nzDisabled],是否禁用 - /// - public string Disabled { get; set; } - /// - /// [nzDisabledDate],不可选择日期函数,函数定义:(current: Date) => boolean - /// - public string DisabledDate { get; set; } - /// - /// [nzDisabledTime],不可选择时间函数,函数定义:(current: Date) => { nzDisabledHours, nzDisabledMinutes, nzDisabledSeconds },注意:该属性仅在 nzMode="date" 时有效 + /// [nzDisabledTime],不可选择时间函数,类型:(current: Date, partial: 'start' | 'end') => { nzDisabledHours, nzDisabledMinutes, nzDisabledSeconds } /// public string DisabledTime { get; set; } /// - /// nzDropdownClassName,弹出日历样式类名 - /// - public string DropdownClassName { get; set; } - /// - /// [nzDropdownClassName],弹出日历样式类名 - /// - public string BindDropdownClassName { get; set; } - /// - /// nzPopupStyle,弹出日历样式 - /// - public string PopupStyle { get; set; } - /// - /// [nzPopupStyle],弹出日历样式 - /// - public string BindPopupStyle { get; set; } - /// - /// nzFormat,格式化字符串,格式说明: - /// 1. 年 - yyyy - /// 2. 月 - MM - /// 3. 日 - dd - /// 4. 时 - HH - /// 5. 分 - mm - /// 6. 秒 - ss - /// 7. 毫秒 - SSS - /// - public string Format { get; set; } - /// - /// [nzFormat],格式化字符串,格式说明: - /// 1. 年 - yyyy - /// 2. 月 - MM - /// 3. 日 - dd - /// 4. 时 - HH - /// 5. 分 - mm - /// 6. 秒 - ss - /// 7. 毫秒 - SSS - /// - public string BindFormat { get; set; } - /// - /// [nzInputReadOnly],为 input 标签设置只读属性,避免在移动设备上触发小键盘 - /// - public string InputReadonly { get; set; } - /// - /// [nzLocale],国际化配置 - /// - public string Locale { get; set; } - /// - /// nzMode,选择模式 - /// - public DatePickerMode Mode { get; set; } - /// - /// [nzMode],选择模式 - /// - public string BindMode { get; set; } - /// - /// nzPlaceHolder,输入框占位文本 - /// - public string Placeholder { get; set; } - /// - /// [nzPlaceHolder],输入框占位文本 - /// - public string BindPlaceholder { get; set; } - /// - /// nzRenderExtraFooter,添加额外页脚 - /// - public string RenderExtraFooter { get; set; } - /// - /// [nzRenderExtraFooter],添加额外页脚 - /// - public string BindRenderExtraFooter { get; set; } - /// - /// nzSize,输入框大小, 可选值: 'default' | 'small' | 'large' - /// - public InputSize Size { get; set; } - /// - /// [nzSize],输入框大小, 可选值: 'default' | 'small' | 'large' - /// - public string BindSize { get; set; } - /// - /// nzSuffixIcon,后缀图标 - /// - public AntDesignIcon SuffixIcon { get; set; } - /// - /// [nzSuffixIcon],后缀图标 - /// - public string BindSuffixIcon { get; set; } - /// - /// nzBorderless,是否移除边框 - /// - public string Borderless { get; set; } - /// /// [nzRanges],预设时间范围,类型:{ [ key: string ]: Date[] } | { [ key: string ]: () => Date[] } /// public string Ranges { get; set; } @@ -149,10 +42,6 @@ public class RangePickerTagHelper : FormControlTagHelperBase { /// public string BindSeparator { get; set; } /// - /// [nzShowTime],是否显示时间选择,注意:该属性仅在 nzMode="date" 时有效 - /// - public string ShowTime { get; set; } - /// /// [(beginDate)],扩展属性, 双向绑定起始日期 /// public string BeginDate { get; set; } @@ -169,15 +58,11 @@ public class RangePickerTagHelper : FormControlTagHelperBase { /// public ModelExpression ForEnd { get; set; } /// - /// (nzOnOpenChange),弹出关闭日历事件 - /// - public string OnOpenChange { get; set; } - /// - /// (nzOnCalendarChange),待选日期改变事件 + /// (nzOnCalendarChange),待选日期变化事件, 类型: EventEmitter<Date[]> /// public string OnCalendarChange { get; set; } /// - /// (nzOnOk),点击确定按钮事件 + /// (nzOnOk),点击确定按钮事件, 类型: EventEmitter<Date[]> /// public string OnOk { get; set; } diff --git a/src/Util.Ui.NgZorro/Components/Descriptions/Builders/DescriptionItemBuilder.cs b/src/Util.Ui.NgZorro/Components/Descriptions/Builders/DescriptionItemBuilder.cs index 192c532eb..2c650013c 100644 --- a/src/Util.Ui.NgZorro/Components/Descriptions/Builders/DescriptionItemBuilder.cs +++ b/src/Util.Ui.NgZorro/Components/Descriptions/Builders/DescriptionItemBuilder.cs @@ -37,7 +37,7 @@ public DescriptionItemBuilder Title() { } /// - /// 设置表单标签文本 + /// 设置标题 /// private void SetTitle( string value ) { var options = NgZorroOptionsService.GetOptions(); diff --git a/src/Util.Ui.NgZorro/Components/Forms/Builders/FormBuilder.cs b/src/Util.Ui.NgZorro/Components/Forms/Builders/FormBuilder.cs index 661b5e08a..9f77e7434 100644 --- a/src/Util.Ui.NgZorro/Components/Forms/Builders/FormBuilder.cs +++ b/src/Util.Ui.NgZorro/Components/Forms/Builders/FormBuilder.cs @@ -90,7 +90,22 @@ public FormBuilder AutoComplete() { /// 配置表单组 /// public FormBuilder FormGroup() { - AttributeIfNotEmpty( "[formGroup]", _config.GetValue( UiConst.FormGroup ) ); + AttributeIfNotEmpty( "[formGroup]", GetFormGroup() ); + return this; + } + + /// + /// 获取表单组 + /// + private string GetFormGroup() { + return _config.GetValue( UiConst.FormGroup ); + } + + /// + /// 配置是否不验证表单 + /// + public FormBuilder Novalidate() { + AttributeIf( "novalidate", _config.GetValue( UiConst.Novalidate ) == true ); return this; } @@ -107,7 +122,8 @@ public FormBuilder Events() { /// public override void Config() { base.Config(); - Layout().AutoTips().DisableAutoTips().NoColon().TooltipIcon().AutoComplete().FormGroup().Events(); + Layout().AutoTips().DisableAutoTips().NoColon().TooltipIcon().AutoComplete().FormGroup().Novalidate() + .Events(); } /// @@ -119,6 +135,10 @@ protected override void ConfigId( Config config ) { return; if ( _shareConfig.IsSearch.SafeValue() && _config.Contains( UiConst.Id ) == false ) return; + if ( GetFormGroup().IsEmpty() == false ) { + AttributeIf( $"#{_shareConfig.FormId}", _shareConfig.FormId.IsEmpty() == false ); + return; + } Attribute( $"#{_shareConfig.FormId}", "ngForm" ); } } \ No newline at end of file diff --git a/src/Util.Ui.NgZorro/Components/Forms/Configs/FormShareConfig.cs b/src/Util.Ui.NgZorro/Components/Forms/Configs/FormShareConfig.cs index 518bc02ac..8d9beb077 100644 --- a/src/Util.Ui.NgZorro/Components/Forms/Configs/FormShareConfig.cs +++ b/src/Util.Ui.NgZorro/Components/Forms/Configs/FormShareConfig.cs @@ -16,7 +16,6 @@ public class FormShareConfig { /// public FormShareConfig() { _columnIds = new List(); - FormId = "form"; } /// @@ -60,6 +59,10 @@ public bool IsHide( string columnId ) { return index >= SearchFormShowNumber; } + /// + /// form 已创建 + /// + public bool FormCreated { get; set; } /// /// 是否查询表单 /// diff --git a/src/Util.Ui.NgZorro/Components/Forms/FormTagHelper.cs b/src/Util.Ui.NgZorro/Components/Forms/FormTagHelper.cs index 57167b47d..aee594ec0 100644 --- a/src/Util.Ui.NgZorro/Components/Forms/FormTagHelper.cs +++ b/src/Util.Ui.NgZorro/Components/Forms/FormTagHelper.cs @@ -61,6 +61,10 @@ public class FormTagHelper : FormContainerTagHelperBase { /// public string LabelWidth { get; set; } /// + /// novalidate,是否不验证表单,类型: boolean, 默认值: false + /// + public bool Novalidate { get; set; } + /// /// (ngSubmit),表单提交事件 /// public string OnSubmit { get; set; } @@ -70,6 +74,7 @@ protected override void ProcessBefore( TagHelperContext context, TagHelperOutput _config = new Config( context, output ); var service = new FormShareService( _config ); service.Init(); + service.Created(); service.SetFormId(); } diff --git a/src/Util.Ui.NgZorro/Components/Forms/Helpers/FormShareService.cs b/src/Util.Ui.NgZorro/Components/Forms/Helpers/FormShareService.cs index ba04f157a..959d5c7f9 100644 --- a/src/Util.Ui.NgZorro/Components/Forms/Helpers/FormShareService.cs +++ b/src/Util.Ui.NgZorro/Components/Forms/Helpers/FormShareService.cs @@ -17,6 +17,13 @@ public class FormShareService { /// private readonly FormShareConfig _shareConfig; + /// + /// 设置 form 已创建 + /// + public void Created() { + _shareConfig.FormCreated = true; + } + /// /// 初始化表单共享服务 /// @@ -40,8 +47,13 @@ public void SetSearchForm() { /// public void SetFormId() { var id = _config.GetValue( UiConst.Id ); - if ( id.IsEmpty() == false ) + if (id.IsEmpty() == false) { _shareConfig.FormId = id; + return; + } + var formGroup = _config.GetValue( UiConst.FormGroup ); + if( formGroup.IsEmpty() ) + _shareConfig.FormId = "form"; } /// diff --git a/src/Util.Ui.NgZorro/Components/Grids/ColumnTagHelper.cs b/src/Util.Ui.NgZorro/Components/Grids/ColumnTagHelper.cs index 541cba93c..e55848f48 100644 --- a/src/Util.Ui.NgZorro/Components/Grids/ColumnTagHelper.cs +++ b/src/Util.Ui.NgZorro/Components/Grids/ColumnTagHelper.cs @@ -4,11 +4,12 @@ using Util.Ui.NgZorro.Components.Grids.Renders; using Util.Ui.Renders; -namespace Util.Ui.NgZorro.Components.Grids; +namespace Util.Ui.NgZorro.Components.Grids; /// /// 栅格列,生成的标签为<div nz-col></div> /// +[HtmlTargetElement( "util-col" )] [HtmlTargetElement( "util-column" )] public class ColumnTagHelper : ColumnTagHelperBase { /// diff --git a/src/Util.Ui.NgZorro/Components/Icons/Builders/IconBuilder.cs b/src/Util.Ui.NgZorro/Components/Icons/Builders/IconBuilder.cs index 89a908e69..b6c4a387b 100644 --- a/src/Util.Ui.NgZorro/Components/Icons/Builders/IconBuilder.cs +++ b/src/Util.Ui.NgZorro/Components/Icons/Builders/IconBuilder.cs @@ -1,7 +1,6 @@ using Util.Ui.Angular.Builders; using Util.Ui.Angular.Configs; using Util.Ui.Angular.Extensions; -using Util.Ui.NgZorro.Configs; using Util.Ui.NgZorro.Directives.Popconfirms; using Util.Ui.NgZorro.Directives.Popover; using Util.Ui.NgZorro.Directives.Tooltips; @@ -104,13 +103,13 @@ public IconBuilder BindTheme( string theme ) { /// 配置双色图标主题色 /// public IconBuilder Color() { - var value = _config.GetValue( AntDesignConst.TwotoneColorType )?.Description(); + var value = _config.GetValue( UiConst.TwotoneColorType )?.Description(); if ( value.IsEmpty() == false ) - _config.SetAttribute( AntDesignConst.TwotoneColor, value ); - if ( _config.Contains( AntDesignConst.TwotoneColor ) || _config.Contains( AntDesignConst.BindTwotoneColor ) ) + _config.SetAttribute( UiConst.TwotoneColor, value ); + if ( _config.Contains( UiConst.TwotoneColor ) || _config.Contains( AngularConst.BindTwotoneColor ) ) Attribute( "nzTheme", IconTheme.Twotone.Description() ); - AttributeIfNotEmpty( "nzTwotoneColor", _config.GetValue( AntDesignConst.TwotoneColor ) ); - AttributeIfNotEmpty( "[nzTwotoneColor]", _config.GetValue( AntDesignConst.BindTwotoneColor ) ); + AttributeIfNotEmpty( "nzTwotoneColor", _config.GetValue( UiConst.TwotoneColor ) ); + AttributeIfNotEmpty( "[nzTwotoneColor]", _config.GetValue( AngularConst.BindTwotoneColor ) ); return this; } @@ -134,8 +133,8 @@ public IconBuilder Rotate() { /// 配置Iconfont图标 /// public IconBuilder IconFont() { - AttributeIfNotEmpty( "nzIconfont", _config.GetValue( AntDesignConst.IconFont ) ); - AttributeIfNotEmpty( "[nzIconfont]", _config.GetValue( AntDesignConst.BindIconFont ) ); + AttributeIfNotEmpty( "nzIconfont", _config.GetValue( UiConst.IconFont ) ); + AttributeIfNotEmpty( "[nzIconfont]", _config.GetValue( AngularConst.BindIconFont ) ); return this; } diff --git a/src/Util.Ui.NgZorro/Components/Inputs/Configs/InputGroupShareConfig.cs b/src/Util.Ui.NgZorro/Components/Inputs/Configs/InputGroupShareConfig.cs index 312925023..023b27fa3 100644 --- a/src/Util.Ui.NgZorro/Components/Inputs/Configs/InputGroupShareConfig.cs +++ b/src/Util.Ui.NgZorro/Components/Inputs/Configs/InputGroupShareConfig.cs @@ -89,7 +89,7 @@ public class InputGroupShareConfig { /// /// 检验状态 /// - public InputStatus? Status { get; set; } + public FormControlStatus? Status { get; set; } /// /// 检验状态 /// diff --git a/src/Util.Ui.NgZorro/Components/Inputs/Helpers/InputGroupShareService.cs b/src/Util.Ui.NgZorro/Components/Inputs/Helpers/InputGroupShareService.cs index 97ba36d39..5542e617c 100644 --- a/src/Util.Ui.NgZorro/Components/Inputs/Helpers/InputGroupShareService.cs +++ b/src/Util.Ui.NgZorro/Components/Inputs/Helpers/InputGroupShareService.cs @@ -119,7 +119,7 @@ private void SetShareConfig() { _shareConfig.Size ??= _config.GetValue( UiConst.Size ); if ( _shareConfig.BindSize.IsEmpty() ) _shareConfig.BindSize = _config.GetValue( AngularConst.BindSize ); - _shareConfig.Status ??= _config.GetValue( UiConst.Status ); + _shareConfig.Status ??= _config.GetValue( UiConst.Status ); if ( _shareConfig.BindStatus.IsEmpty() ) _shareConfig.BindStatus = _config.GetValue( AngularConst.BindStatus ); _shareConfig.AllowClear = IsAllowClear(); diff --git a/src/Util.Ui.NgZorro/Components/Inputs/InputGroupTagHelper.cs b/src/Util.Ui.NgZorro/Components/Inputs/InputGroupTagHelper.cs index aafcc1ffe..981512d2d 100644 --- a/src/Util.Ui.NgZorro/Components/Inputs/InputGroupTagHelper.cs +++ b/src/Util.Ui.NgZorro/Components/Inputs/InputGroupTagHelper.cs @@ -100,7 +100,7 @@ public class InputGroupTagHelper : AngularTagHelperBase { /// /// nzStatus,校验状态, 可选值: 'error' | 'warning' /// - public InputStatus Status { get; set; } + public FormControlStatus Status { get; set; } /// /// [nzStatus],校验状态, 可选值: 'error' | 'warning' /// diff --git a/src/Util.Ui.NgZorro/Components/Inputs/InputTagHelper.cs b/src/Util.Ui.NgZorro/Components/Inputs/InputTagHelper.cs index ebd9c5301..f00df412c 100644 --- a/src/Util.Ui.NgZorro/Components/Inputs/InputTagHelper.cs +++ b/src/Util.Ui.NgZorro/Components/Inputs/InputTagHelper.cs @@ -17,7 +17,7 @@ public class InputTagHelper : FormControlTagHelperBase { /// private Config _config; /// - /// [required],是否必填项 + /// [required],是否必填项, 类型: boolean, 默认值: false /// public string Required { get; set; } /// @@ -95,7 +95,7 @@ public class InputTagHelper : FormControlTagHelperBase { /// /// nzStatus,校验状态, 可选值: 'error' | 'warning' /// - public InputStatus Status { get; set; } + public FormControlStatus Status { get; set; } /// /// [nzStatus],校验状态, 可选值: 'error' | 'warning' /// diff --git a/src/Util.Ui.NgZorro/Components/Layouts/Builders/SiderBuilder.cs b/src/Util.Ui.NgZorro/Components/Layouts/Builders/SiderBuilder.cs index 602b782cd..4b120b72f 100644 --- a/src/Util.Ui.NgZorro/Components/Layouts/Builders/SiderBuilder.cs +++ b/src/Util.Ui.NgZorro/Components/Layouts/Builders/SiderBuilder.cs @@ -86,7 +86,7 @@ public SiderBuilder ReverseArrow() { /// public SiderBuilder Trigger() { AttributeIfNotEmpty( "[nzTrigger]", _config.GetValue( UiConst.Trigger ) ); - AttributeIfNotEmpty( "[nzZeroTrigger]", _config.GetValue( AntDesignConst.ZeroTrigger ) ); + AttributeIfNotEmpty( "[nzZeroTrigger]", _config.GetValue( UiConst.ZeroTrigger ) ); return this; } diff --git a/src/Util.Ui.NgZorro/Components/Layouts/SiderTagHelper.cs b/src/Util.Ui.NgZorro/Components/Layouts/SiderTagHelper.cs index c5d5ba237..0907f5f00 100644 --- a/src/Util.Ui.NgZorro/Components/Layouts/SiderTagHelper.cs +++ b/src/Util.Ui.NgZorro/Components/Layouts/SiderTagHelper.cs @@ -40,11 +40,11 @@ public class SiderTagHelper : AngularTagHelperBase { /// public string Collapsible { get; set; } /// - /// [nzCollapsed],收缩状态, 默认值: false + /// [nzCollapsed],是否收起状态, 默认值: false /// public string Collapsed { get; set; } /// - /// [(nzCollapsed)],收缩状态, 默认值: false + /// [(nzCollapsed)],是否收起状态, 默认值: false /// public string BindonCollapsed { get; set; } /// @@ -60,7 +60,7 @@ public class SiderTagHelper : AngularTagHelperBase { /// public string ZeroTrigger { get; set; } /// - /// (nzCollapsedChange),展开-收起时的回调函数,注意:自定义触发器不会触发该事件 + /// (nzCollapsedChange),展开收起状态变化事件,注意:自定义触发器不会触发该事件, 类型: EventEmitter<boolean> /// public string OnCollapsedChange { get; set; } diff --git a/src/Util.Ui.NgZorro/Components/PageHeaders/Builders/PageHeaderBuilder.cs b/src/Util.Ui.NgZorro/Components/PageHeaders/Builders/PageHeaderBuilder.cs index 3bca3ae7f..d6d0c10e4 100644 --- a/src/Util.Ui.NgZorro/Components/PageHeaders/Builders/PageHeaderBuilder.cs +++ b/src/Util.Ui.NgZorro/Components/PageHeaders/Builders/PageHeaderBuilder.cs @@ -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.PageHeaders.Builders; +namespace Util.Ui.NgZorro.Components.PageHeaders.Builders; /// /// 页头标签生成器 @@ -16,7 +18,7 @@ public class PageHeaderBuilder : AngularTagBuilder { /// 初始化页头标签生成器 /// /// 配置 - public PageHeaderBuilder( Config config ) : base( config,"nz-page-header" ) { + public PageHeaderBuilder( Config config ) : base( config, "nz-page-header" ) { _config = config; } @@ -32,20 +34,44 @@ public PageHeaderBuilder Ghost() { /// 配置标题 /// public PageHeaderBuilder 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 ); + } + /// /// 配置子标题 /// public PageHeaderBuilder Subtitle() { - AttributeIfNotEmpty( "nzSubtitle", _config.GetValue( UiConst.Subtitle ) ); + SetSubtitle( _config.GetValue( UiConst.Subtitle ) ); AttributeIfNotEmpty( "[nzSubtitle]", _config.GetValue( AngularConst.BindSubtitle ) ); return this; } + /// + /// 设置子标题 + /// + private void SetSubtitle( string value ) { + var options = NgZorroOptionsService.GetOptions(); + if ( options.EnableI18n ) { + this.AttributeByI18n( "[nzSubtitle]", value ); + return; + } + AttributeIfNotEmpty( "nzSubtitle", value ); + } + /// /// 配置显示返回按钮 /// diff --git a/src/Util.Ui.NgZorro/Components/PageHeaders/PageHeaderTagHelper.cs b/src/Util.Ui.NgZorro/Components/PageHeaders/PageHeaderTagHelper.cs index bb7041c87..f000dfedd 100644 --- a/src/Util.Ui.NgZorro/Components/PageHeaders/PageHeaderTagHelper.cs +++ b/src/Util.Ui.NgZorro/Components/PageHeaders/PageHeaderTagHelper.cs @@ -18,7 +18,7 @@ public class PageHeaderTagHelper : AngularTagHelperBase { /// public string Ghost { get; set; } /// - /// nzTitle,标题 + /// nzTitle,标题, 支持多语言 /// public string Title { get; set; } /// @@ -26,7 +26,7 @@ public class PageHeaderTagHelper : AngularTagHelperBase { /// public string BindTitle { get; set; } /// - /// nzSubtitle,子标题 + /// nzSubtitle,子标题, 支持多语言 /// public string Subtitle { get; set; } /// @@ -34,7 +34,7 @@ public class PageHeaderTagHelper : AngularTagHelperBase { /// public string BindSubtitle { get; set; } /// - /// 扩展属性,显示默认返回按钮 + /// 扩展属性,是否显示默认返回按钮, 默认值: false /// public bool ShowBack { get; set; } /// @@ -46,7 +46,7 @@ public class PageHeaderTagHelper : AngularTagHelperBase { /// public string BindBackIcon { get; set; } /// - /// (nzBack),返回按钮点击事件 + /// (nzBack),返回按钮点击事件, 类型: EventEmitter<void> /// public string OnBack { get; set; } diff --git a/src/Util.Ui.NgZorro/Components/Paginations/PaginationTagHelper.cs b/src/Util.Ui.NgZorro/Components/Paginations/PaginationTagHelper.cs index c63487465..044dd8cf1 100644 --- a/src/Util.Ui.NgZorro/Components/Paginations/PaginationTagHelper.cs +++ b/src/Util.Ui.NgZorro/Components/Paginations/PaginationTagHelper.cs @@ -52,15 +52,15 @@ public class PaginationTagHelper : AngularTagHelperBase { /// public string BindSize { get; set; } /// - /// [nzShowTotal],设置显示总行数和当前数据范围的模板 + /// [nzShowTotal],自定义显示总行数和当前数据范围, 类型: TemplateRef<{ $implicit: number, range: [ number, number ] }> /// public string ShowTotal { get; set; } /// - /// [nzSimple],是否显示为简单分页 + /// [nzSimple],是否显示为简单分页, 类型: boolean /// public string Simple { get; set; } /// - /// [nzResponsive],响应式,根据屏幕宽度自动调整尺寸,未指定 nzSize 时有效, 默认值: false + /// [nzResponsive],是否响应式,根据屏幕宽度自动调整尺寸,未指定 nzSize 时有效, 类型: boolean, 默认值: false /// public string Responsive { get; set; } /// @@ -68,11 +68,11 @@ public class PaginationTagHelper : AngularTagHelperBase { /// public string PageSizeOptions { get; set; } /// - /// [nzItemRender],自定义页码结构 + /// [nzItemRender],自定义页码结构, 类型: TemplateRef<{ $implicit: 'page' \| 'prev' \| 'next'\| 'prev_5'\| 'next_5', page: number }> /// public string ItemRender { get; set; } /// - /// [nzHideOnSinglePage],只有一页时是否隐藏分页器, 默认值: false + /// [nzHideOnSinglePage],只有一页时是否隐藏分页器,类型: boolean, 默认值: false /// public string HideOnSinglePage { get; set; } /// diff --git a/src/Util.Ui.NgZorro/Components/Selects/Helpers/SelectExpressionLoader.cs b/src/Util.Ui.NgZorro/Components/Selects/Helpers/SelectExpressionLoader.cs index 6e457123f..e6e16d728 100644 --- a/src/Util.Ui.NgZorro/Components/Selects/Helpers/SelectExpressionLoader.cs +++ b/src/Util.Ui.NgZorro/Components/Selects/Helpers/SelectExpressionLoader.cs @@ -1,5 +1,6 @@ using Util.Ui.Angular.Configs; using Util.Ui.Expressions; +using Util.Ui.NgZorro.Components.Forms.Configs; using Util.Ui.NgZorro.Configs; using Util.Ui.NgZorro.Expressions; @@ -15,7 +16,8 @@ public class SelectExpressionLoader : NgZorroExpressionLoaderBase { /// 配置 /// 模型表达式信息 protected override void Load( Config config, ModelExpressionInfo info ) { - LoadLabel( config, info ); + var formShareConfig = GetFormShareConfig( config ); + LoadLabel( config, info, formShareConfig ); LoadId( config, info ); LoadName( config, info ); LoadNgModel( config, info ); @@ -23,11 +25,19 @@ protected override void Load( Config config, ModelExpressionInfo info ) { LoadRequired( config, info ); } + /// + /// 获取表单共享配置 + /// + private FormShareConfig GetFormShareConfig( Config config ) { + return config.GetValueFromItems() ?? new FormShareConfig(); + } + /// /// 加载标签 /// - protected virtual void LoadLabel( Config config, ModelExpressionInfo info ) { - config.SetAttribute( UiConst.LabelText, info.DisplayName, false ); + protected virtual void LoadLabel( Config config, ModelExpressionInfo info, FormShareConfig formShareConfig ) { + if( formShareConfig.FormCreated ) + config.SetAttribute( UiConst.LabelText, info.DisplayName, false ); } /// diff --git a/src/Util.Ui.NgZorro/Components/Selects/Helpers/SelectService.cs b/src/Util.Ui.NgZorro/Components/Selects/Helpers/SelectService.cs index 6b9ba7903..6a20b705a 100644 --- a/src/Util.Ui.NgZorro/Components/Selects/Helpers/SelectService.cs +++ b/src/Util.Ui.NgZorro/Components/Selects/Helpers/SelectService.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.Selects.Helpers; diff --git a/src/Util.Ui.NgZorro/Components/Steps/Builders/StepBuilder.cs b/src/Util.Ui.NgZorro/Components/Steps/Builders/StepBuilder.cs index 89850a8d7..4cce05df2 100644 --- a/src/Util.Ui.NgZorro/Components/Steps/Builders/StepBuilder.cs +++ b/src/Util.Ui.NgZorro/Components/Steps/Builders/StepBuilder.cs @@ -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.Steps.Builders; @@ -25,20 +27,44 @@ public StepBuilder( Config config ) : base( config,"nz-step" ) { /// 配置标题 /// public StepBuilder 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 ); + } + /// /// 配置子标题 /// public StepBuilder Subtitle() { - AttributeIfNotEmpty( "nzSubtitle", _config.GetValue( UiConst.Subtitle ) ); + SetSubtitle( _config.GetValue( UiConst.Subtitle ) ); AttributeIfNotEmpty( "[nzSubtitle]", _config.GetValue( AngularConst.BindSubtitle ) ); return this; } + /// + /// 设置子标题 + /// + private void SetSubtitle( string value ) { + var options = NgZorroOptionsService.GetOptions(); + if ( options.EnableI18n ) { + this.AttributeByI18n( "[nzSubtitle]", value ); + return; + } + AttributeIfNotEmpty( "nzSubtitle", value ); + } + /// /// 配置描述 /// @@ -74,11 +100,19 @@ public StepBuilder Disabled() { return this; } + /// + /// 配置进度百分比 + /// + public StepBuilder Percentage() { + AttributeIfNotEmpty( "[nzPercentage]", _config.GetValue( UiConst.Percentage ) ); + return this; + } + /// /// 配置 /// public override void Config() { base.Config(); - Title().Subtitle().Description().Icon().Status().Disabled(); + Title().Subtitle().Description().Icon().Status().Disabled().Percentage(); } } \ No newline at end of file diff --git a/src/Util.Ui.NgZorro/Components/Steps/StepTagHelper.cs b/src/Util.Ui.NgZorro/Components/Steps/StepTagHelper.cs index 5bea36e54..d85eff168 100644 --- a/src/Util.Ui.NgZorro/Components/Steps/StepTagHelper.cs +++ b/src/Util.Ui.NgZorro/Components/Steps/StepTagHelper.cs @@ -4,7 +4,7 @@ using Util.Ui.NgZorro.Enums; using Util.Ui.Renders; -namespace Util.Ui.NgZorro.Components.Steps; +namespace Util.Ui.NgZorro.Components.Steps; /// /// 步骤,生成的标签为<nz-step></nz-step>,放在<util-steps></util-steps>中使用 @@ -12,27 +12,27 @@ namespace Util.Ui.NgZorro.Components.Steps; [HtmlTargetElement( "util-step" )] public class StepTagHelper : AngularTagHelperBase { /// - /// nzTitle,标题 + /// nzTitle,标题,支持多语言 /// public string Title { get; set; } /// - /// [nzTitle],标题 + /// [nzTitle],标题,类型: string | TemplateRef<void> /// public string BindTitle { get; set; } /// - /// nzSubtitle,子标题 + /// nzSubtitle,子标题,支持多语言 /// public string Subtitle { get; set; } /// - /// [nzSubtitle],子标题 + /// [nzSubtitle],子标题,类型: string | TemplateRef<void> /// public string BindSubtitle { get; set; } /// - /// nzDescription,详情描述 + /// nzDescription,描述 /// public string Description { get; set; } /// - /// [nzDescription],详情描述 + /// [nzDescription],描述,类型: string | TemplateRef<void> /// public string BindDescription { get; set; } /// @@ -40,21 +40,25 @@ public class StepTagHelper : AngularTagHelperBase { /// public AntDesignIcon Icon { get; set; } /// - /// [nzIcon],图标 + /// [nzIcon],图标,类型: string | string[] | Set<string> | { [klass: string]: any; } | TemplateRef<void> /// public string BindIcon { get; set; } /// - /// nzStatus,状态,当不配置该属性时,会使用 nz-steps 的 nzCurrent 来自动指定状态,可选值: 'wait' | 'process' | 'finish' | 'error' + /// nzStatus,状态,当不配置该属性时,使用 <util-steps> 的 current 指定状态,可选值: 'wait' | 'process' | 'finish' | 'error',默认值: 'wait' /// public StepStatus Status { get; set; } /// - /// [nzStatus],状态,当不配置该属性时,会使用 nz-steps 的 nzCurrent 来自动指定状态,可选值: 'wait' | 'process' | 'finish' | 'error' + /// [nzStatus],状态,当不配置该属性时,使用 <util-steps> 的 current 指定状态,可选值: 'wait' | 'process' | 'finish' | 'error',默认值: 'wait' /// public string BindStatus { get; set; } /// - /// [nzDisabled],是否禁用点击 + /// [nzDisabled],是否禁用点击, 默认值: false /// public string Disabled { get; set; } + /// + /// [nzPercentage],当前状态为 `process` 的步骤所显示的进度百分比, 类型: number + /// + public string Percentage { get; set; } /// protected override IRender GetRender( TagHelperContext context, TagHelperOutput output, TagHelperContent content ) { diff --git a/src/Util.Ui.NgZorro/Components/Steps/StepsTagHelper.cs b/src/Util.Ui.NgZorro/Components/Steps/StepsTagHelper.cs index 56b74a57b..656e97571 100644 --- a/src/Util.Ui.NgZorro/Components/Steps/StepsTagHelper.cs +++ b/src/Util.Ui.NgZorro/Components/Steps/StepsTagHelper.cs @@ -12,59 +12,59 @@ namespace Util.Ui.NgZorro.Components.Steps; [HtmlTargetElement( "util-steps" )] public class StepsTagHelper : AngularTagHelperBase { /// - /// nzType,步骤条类型,可选值: 'default' | 'navigation' + /// nzType,步骤条类型,可选值: 'default' | 'navigation', 默认值: 'default' /// public StepsType Type { get; set; } /// - /// [nzType],步骤条类型,可选值: 'default' | 'navigation' + /// [nzType],步骤条类型,可选值: 'default' | 'navigation', 默认值: 'default' /// public string BindType { get; set; } /// - /// [nzCurrent],指定当前步骤,从 0 开始记数,在子 nz-step 元素中,可以通过 nzStatus 属性覆盖状态, 默认值: 0 + /// [nzCurrent],指定当前步骤,从 `0` 开始记数。在 <util-step> 中,可通过 status 覆盖状态,类型: number, 默认值: 0 /// public string Current { get; set; } /// - /// nzSize,步骤条尺寸,可选值: 'default' | 'small' + /// nzSize,步骤条尺寸,可选值: 'default' | 'small', 默认值: 'default' /// public StepsSize Size { get; set; } /// - /// [nzSize],步骤条尺寸,可选值: 'default' | 'small' + /// [nzSize],步骤条尺寸,可选值: 'default' | 'small', 默认值: 'default' /// public string BindSize { get; set; } /// - /// [nzStartIndex],起始位置的序号,默认值: 0 + /// [nzStartIndex],起始位置的序号,类型: number, 默认值: 0 /// public string StartIndex { get; set; } /// - /// nzDirection,步骤条方向,可选值: 'vertical' | 'horizontal' + /// nzDirection,步骤条方向,可选值: 'vertical' | 'horizontal' ,默认值: 'horizontal' /// public StepsDirection Direction { get; set; } /// - /// [nzDirection],步骤条方向,可选值: 'vertical' | 'horizontal' + /// [nzDirection],步骤条方向,可选值: 'vertical' | 'horizontal' ,默认值: 'horizontal' /// public string BindDirection { get; set; } /// - /// nzStatus,当前步骤的状态,可选值: 'wait' | 'process' | 'finish' | 'error' + /// nzStatus,当前步骤的状态,可选值: 'wait' | 'process' | 'finish' | 'error',默认值: 'process' /// public StepStatus Status { get; set; } /// - /// [nzStatus],当前步骤的状态,可选值: 'wait' | 'process' | 'finish' | 'error' + /// [nzStatus],当前步骤的状态,可选值: 'wait' | 'process' | 'finish' | 'error',默认值: 'process' /// public string BindStatus { get; set; } /// - /// [nzProgressDot],点状步骤条 + /// [nzProgressDot],点状步骤条, 类型: boolean | TemplateRef<{ $implicit: TemplateRef<void>, status: string, index: number }>, 默认值: false /// public string ProgressDot { get; set; } /// - /// nzLabelPlacement,标签放置位置,默认水平放图标右侧,可选 vertical 放图标下方,可选值: 'horizontal' | 'vertical' + /// nzLabelPlacement,标签位置,可选值: 'horizontal' | 'vertical', 默认值: 'horizontal' /// public StepsLabelPlacement LabelPlacement { get; set; } /// - /// [nzLabelPlacement],标签放置位置,默认水平放图标右侧,可选 vertical 放图标下方,可选值: 'horizontal' | 'vertical' + /// [nzLabelPlacement],标签位置,可选值: 'horizontal' | 'vertical', 默认值: 'horizontal' /// public string BindLabelPlacement { get; set; } /// - /// (nzIndexChange),点击单个步骤时触发的事件 + /// (nzIndexChange),步骤索引变化事件,点击步骤时触发,类型: EventEmitter<number> /// public string OnIndexChange { get; set; } diff --git a/src/Util.Ui.NgZorro/Components/Templates/Builders/TemplateBuilder.cs b/src/Util.Ui.NgZorro/Components/Templates/Builders/TemplateBuilder.cs index 8d6087cc6..ae74c1af0 100644 --- a/src/Util.Ui.NgZorro/Components/Templates/Builders/TemplateBuilder.cs +++ b/src/Util.Ui.NgZorro/Components/Templates/Builders/TemplateBuilder.cs @@ -1,6 +1,7 @@ using Util.Ui.Angular.Builders; +using Util.Ui.Angular.Configs; -namespace Util.Ui.NgZorro.Components.Templates.Builders; +namespace Util.Ui.NgZorro.Components.Templates.Builders; /// /// ng-template标签生成器 @@ -35,11 +36,19 @@ public TemplateBuilder Tab( bool value ) { return this; } + /// + /// 配置模板出口 + /// + public TemplateBuilder TemplateOutlet() { + AttributeIfNotEmpty( "[ngTemplateOutlet]", _config.GetValue( AngularConst.NgTemplateOutlet ) ); + return this; + } + /// /// 配置 /// public override void Config() { base.Config(); - Tab(); + Tab().TemplateOutlet(); } } \ No newline at end of file diff --git a/src/Util.Ui.NgZorro/Components/Templates/TemplateTagHelper.cs b/src/Util.Ui.NgZorro/Components/Templates/TemplateTagHelper.cs index 6b44a58e0..a1159f43f 100644 --- a/src/Util.Ui.NgZorro/Components/Templates/TemplateTagHelper.cs +++ b/src/Util.Ui.NgZorro/Components/Templates/TemplateTagHelper.cs @@ -14,6 +14,10 @@ public class TemplateTagHelper : AngularTagHelperBase { /// 扩展属性 nz-tab,选项卡是否延迟加载, 默认值: false /// public bool Tab { get; set; } + /// + /// [ngTemplateOutlet], 模板出口 + /// + public string NgTemplateOutlet { get; set; } /// protected override IRender GetRender( TagHelperContext context, TagHelperOutput output, TagHelperContent content ) { diff --git a/src/Util.Ui.NgZorro/Configs/AntDesignConst.cs b/src/Util.Ui.NgZorro/Configs/AntDesignConst.cs deleted file mode 100644 index 0f1da9d9f..000000000 --- a/src/Util.Ui.NgZorro/Configs/AntDesignConst.cs +++ /dev/null @@ -1,43 +0,0 @@ -namespace Util.Ui.NgZorro.Configs; - -/// -/// AntDesign常量 -/// -public class AntDesignConst { - /// - /// 双色图标颜色 - /// - public const string TwotoneColor = "twotone-color"; - /// - /// 双色图标颜色类型 - /// - public const string TwotoneColorType = "twotone-color-type"; - /// - /// 双色图标颜色 - /// - public const string BindTwotoneColor = "bind-twotone-color"; - /// - /// Iconfont图标 - /// - public const string IconFont = "icon-font"; - /// - /// Iconfont图标 - /// - public const string BindIconFont = "bind-icon-font"; - /// - /// 值为0时的触发器 - /// - public const string ZeroTrigger = "zero-trigger"; - /// - /// 路由标签 - /// - public const string RouteLabel = "route-label"; - /// - /// 路由标签 - /// - public const string BindRouteLabel = "bind-route-label"; - /// - /// 路由标签函数 - /// - public const string RouteLabelFn = "route-label-fn"; -} \ No newline at end of file diff --git a/src/Util.Ui.NgZorro/Directives/Popconfirms/TagBuilderExtensions.cs b/src/Util.Ui.NgZorro/Directives/Popconfirms/TagBuilderExtensions.cs index c69ddb2fc..d005630d2 100644 --- a/src/Util.Ui.NgZorro/Directives/Popconfirms/TagBuilderExtensions.cs +++ b/src/Util.Ui.NgZorro/Directives/Popconfirms/TagBuilderExtensions.cs @@ -41,10 +41,9 @@ public static TBuilder Popconfirm( this TBuilder builder, Config confi builder.AttributeIfNotEmpty( "nzOkType", config.GetValue( UiConst.PopconfirmOkType )?.Description() ); builder.AttributeIfNotEmpty( "[nzOkType]", config.GetValue( AngularConst.BindPopconfirmOkType ) ); builder.AttributeIfNotEmpty( "[nzOkDanger]", config.GetValue( UiConst.PopconfirmOkDanger ) ); - + builder.AttributeIfNotEmpty( "[nzOkDisabled]", config.GetValue( UiConst.PopconfirmOkDisabled ) ); builder.AttributeIfNotEmpty( "nzAutoFocus", config.GetValue( UiConst.PopconfirmAutoFocus )?.Description() ); builder.AttributeIfNotEmpty( "[nzAutoFocus]", config.GetValue( AngularConst.BindPopconfirmAutoFocus ) ); - builder.AttributeIfNotEmpty( "[nzCondition]", config.GetValue( UiConst.PopconfirmCondition ) ); builder.AttributeIfNotEmpty( "nzIcon", config.GetValue( UiConst.PopconfirmIcon )?.Description() ); builder.AttributeIfNotEmpty( "[nzIcon]", config.GetValue( AngularConst.BindPopconfirmIcon ) ); diff --git a/src/Util.Ui.NgZorro/Enums/BadgeSize.cs b/src/Util.Ui.NgZorro/Enums/BadgeSize.cs new file mode 100644 index 000000000..c3a0da5d8 --- /dev/null +++ b/src/Util.Ui.NgZorro/Enums/BadgeSize.cs @@ -0,0 +1,17 @@ +namespace Util.Ui.NgZorro.Enums; + +/// +/// 徽标尺寸 +/// +public enum BadgeSize { + /// + /// default,默认尺寸 + /// + [Description( "default" )] + Default, + /// + /// small,小尺寸 + /// + [Description( "small" )] + Small +} \ No newline at end of file diff --git a/src/Util.Ui.NgZorro/Enums/CascaderTriggerAction.cs b/src/Util.Ui.NgZorro/Enums/CascaderTriggerAction.cs new file mode 100644 index 000000000..f0bc9f013 --- /dev/null +++ b/src/Util.Ui.NgZorro/Enums/CascaderTriggerAction.cs @@ -0,0 +1,17 @@ +namespace Util.Ui.NgZorro.Enums; + +/// +/// 级联选择触发操作 +/// +public enum CascaderTriggerAction { + /// + /// 点击触发 + /// + [Description( "click" )] + Click, + /// + /// 移入触发 + /// + [Description( "hover" )] + Hover +} \ No newline at end of file diff --git a/src/Util.Ui.NgZorro/Enums/DatePickerPlacement.cs b/src/Util.Ui.NgZorro/Enums/DatePickerPlacement.cs new file mode 100644 index 000000000..a2b1cd5ca --- /dev/null +++ b/src/Util.Ui.NgZorro/Enums/DatePickerPlacement.cs @@ -0,0 +1,27 @@ +namespace Util.Ui.NgZorro.Enums; + +/// +/// 日期选择框弹出位置 +/// +public enum DatePickerPlacement { + /// + /// 左下方 + /// + [Description( "bottomLeft" )] + BottomLeft, + /// + /// 右下方 + /// + [Description( "bottomRight" )] + BottomRight, + /// + /// 左上方 + /// + [Description( "topLeft" )] + TopLeft, + /// + /// 右上方 + /// + [Description( "topRight" )] + TopRight +} \ No newline at end of file diff --git a/src/Util.Ui.NgZorro/Enums/InputStatus.cs b/src/Util.Ui.NgZorro/Enums/FormControlStatus.cs similarity index 82% rename from src/Util.Ui.NgZorro/Enums/InputStatus.cs rename to src/Util.Ui.NgZorro/Enums/FormControlStatus.cs index a3c8d336e..ccf2ce0ad 100644 --- a/src/Util.Ui.NgZorro/Enums/InputStatus.cs +++ b/src/Util.Ui.NgZorro/Enums/FormControlStatus.cs @@ -1,9 +1,9 @@ namespace Util.Ui.NgZorro.Enums; /// -/// 输入框状态 +/// 表单控件状态 /// -public enum InputStatus { +public enum FormControlStatus { /// /// error /// diff --git a/src/Util.Ui.NgZorro/Enums/InputSize.cs b/src/Util.Ui.NgZorro/Enums/InputSize.cs index e06fef812..95e73fbfe 100644 --- a/src/Util.Ui.NgZorro/Enums/InputSize.cs +++ b/src/Util.Ui.NgZorro/Enums/InputSize.cs @@ -1,7 +1,7 @@ -namespace Util.Ui.NgZorro.Enums; +namespace Util.Ui.NgZorro.Enums; /// -/// 输入框大小 +/// 输入框尺寸 /// public enum InputSize { /// diff --git a/src/Util.Ui.NgZorro/Enums/Justify.cs b/src/Util.Ui.NgZorro/Enums/Justify.cs index 5acdebd10..94646619b 100644 --- a/src/Util.Ui.NgZorro/Enums/Justify.cs +++ b/src/Util.Ui.NgZorro/Enums/Justify.cs @@ -28,5 +28,10 @@ public enum Justify { /// space-between, 分散排列,两端对齐,项之间的间隔都相等 /// [Description( "space-between" )] - SpaceBetween + SpaceBetween, + /// + /// space-evenly, 均匀排列 + /// + [Description( "space-evenly" )] + SpaceEvenly } \ No newline at end of file diff --git a/src/Util.Ui/Configs/UiConst.cs b/src/Util.Ui/Configs/UiConst.cs index 58373cba8..1e3762fad 100644 --- a/src/Util.Ui/Configs/UiConst.cs +++ b/src/Util.Ui/Configs/UiConst.cs @@ -29,6 +29,30 @@ public static class UiConst { /// public const string Padding = "padding"; /// + /// 标识 + /// + public const string NzId = "NzId"; + /// + /// 触发器 + /// + public const string FlipFlop = "flip-flop"; + /// + /// 显示周数 + /// + public const string ShowWeekNumber = "show-week-number"; + /// + /// 背景 + /// + public const string Backdrop = "backdrop"; + /// + /// 自定义头部 + /// + public const string CustomHeader = "custom-header"; + /// + /// 百分比 + /// + public const string Percentage = "percentage"; + /// /// 单位 /// public const string Unit = "unit"; @@ -37,6 +61,14 @@ public static class UiConst { /// public const string PaddingLeft = "padding-left"; /// + /// 触发操作 + /// + public const string TriggerAction = "trigger-action"; + /// + /// 不验证表单 + /// + public const string Novalidate = "novalidate"; + /// /// 选项卡链接 /// public const string TabLink = "tab-link"; @@ -65,6 +97,10 @@ public static class UiConst { /// public const string PopconfirmOkDanger = "popconfirm-ok-danger"; /// + /// 确认气泡框是否禁用确认按钮 + /// + public const string PopconfirmOkDisabled = "popconfirm-ok-disabled"; + /// /// 确认气泡框箭头是否指向锚点的中心 /// public const string PopconfirmArrowPointAtCenter = "popconfirm-arrow-point-at-center"; @@ -3880,4 +3916,28 @@ public static class UiConst { /// 是否无效身份证 /// public const string IsInvalidIdCard = "is-invalid-id-card"; + /// + /// 双色图标颜色 + /// + public const string TwotoneColor = "twotone-color"; + /// + /// 双色图标颜色类型 + /// + public const string TwotoneColorType = "twotone-color-type"; + /// + /// Iconfont图标 + /// + public const string IconFont = "icon-font"; + /// + /// 值为0时的触发器 + /// + public const string ZeroTrigger = "zero-trigger"; + /// + /// 路由标签 + /// + public const string RouteLabel = "route-label"; + /// + /// 路由标签函数 + /// + public const string RouteLabelFn = "route-label-fn"; } \ No newline at end of file diff --git a/src/Util.WebApiClient/11-Util.WebApiClient.csproj b/src/Util.WebApiClient/11-Util.WebApiClient.csproj deleted file mode 100644 index 5125ad296..000000000 --- a/src/Util.WebApiClient/11-Util.WebApiClient.csproj +++ /dev/null @@ -1,33 +0,0 @@ - - - - $(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/Badges/BadgeTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Badges/BadgeTagHelperTest.cs index edaa8ffd0..ab84cc6c5 100644 --- a/test/Util.Ui.NgZorro.Tests/Badges/BadgeTagHelperTest.cs +++ b/test/Util.Ui.NgZorro.Tests/Badges/BadgeTagHelperTest.cs @@ -2,6 +2,7 @@ using Util.Ui.Angular.Configs; using Util.Ui.Configs; using Util.Ui.NgZorro.Components.Badges; +using Util.Ui.NgZorro.Configs; using Util.Ui.NgZorro.Enums; using Util.Ui.TagHelpers; using Xunit; @@ -59,6 +60,17 @@ public void TestStandalone() { 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() ); + } + /// /// 测试颜色 /// @@ -169,6 +181,18 @@ public void TestText() { Assert.Equal( result.ToString(), GetResult() ); } + /// + /// 测试状态点文本 - 多语言 + /// + [Fact] + public void TestText_I18n() { + NgZorroOptionsService.SetOptions( new NgZorroOptions { EnableI18n = true } ); + _wrapper.SetContextAttribute( UiConst.Text, "a" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + /// /// 测试状态点文本 /// @@ -213,6 +237,28 @@ public void TestOffset() { Assert.Equal( result.ToString(), GetResult() ); } + /// + /// 测试徽标尺寸 + /// + [Fact] + public void TestSize() { + _wrapper.SetContextAttribute( UiConst.Size, BadgeSize.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() ); + } + /// /// 测试内容 /// diff --git a/test/Util.Ui.NgZorro.Tests/Badges/RibbonTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Badges/RibbonTagHelperTest.cs index 22b5fd013..081f3ac74 100644 --- a/test/Util.Ui.NgZorro.Tests/Badges/RibbonTagHelperTest.cs +++ b/test/Util.Ui.NgZorro.Tests/Badges/RibbonTagHelperTest.cs @@ -2,6 +2,7 @@ using Util.Ui.Angular.Configs; using Util.Ui.Configs; using Util.Ui.NgZorro.Components.Badges; +using Util.Ui.NgZorro.Configs; using Util.Ui.NgZorro.Enums; using Util.Ui.TagHelpers; using Xunit; @@ -48,6 +49,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() ); + } + /// /// 测试颜色 /// @@ -104,6 +116,18 @@ public void TestText() { Assert.Equal( result.ToString(), GetResult() ); } + /// + /// 测试文本内容 - 多语言 + /// + [Fact] + public void TestText_I18n() { + NgZorroOptionsService.SetOptions( new NgZorroOptions { EnableI18n = true } ); + _wrapper.SetContextAttribute( UiConst.Text, "a" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + /// /// 测试文本内容 /// diff --git a/test/Util.Ui.NgZorro.Tests/Breadcrumbs/BreadcrumbTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Breadcrumbs/BreadcrumbTagHelperTest.cs index 95aef1838..1815ad83c 100644 --- a/test/Util.Ui.NgZorro.Tests/Breadcrumbs/BreadcrumbTagHelperTest.cs +++ b/test/Util.Ui.NgZorro.Tests/Breadcrumbs/BreadcrumbTagHelperTest.cs @@ -87,7 +87,7 @@ public void TestAutoGenerate() { /// [Fact] public void TestRouteLabel() { - _wrapper.SetContextAttribute( AntDesignConst.RouteLabel, "a" ); + _wrapper.SetContextAttribute( UiConst.RouteLabel, "a" ); var result = new StringBuilder(); result.Append( "" ); Assert.Equal( result.ToString(), GetResult() ); @@ -98,7 +98,7 @@ public void TestRouteLabel() { /// [Fact] public void TestBindRouteLabel() { - _wrapper.SetContextAttribute( AntDesignConst.BindRouteLabel, "a" ); + _wrapper.SetContextAttribute( AngularConst.BindRouteLabel, "a" ); var result = new StringBuilder(); result.Append( "" ); Assert.Equal( result.ToString(), GetResult() ); @@ -109,7 +109,7 @@ public void TestBindRouteLabel() { /// [Fact] public void TestRouteLabelFn() { - _wrapper.SetContextAttribute( AntDesignConst.RouteLabelFn, "a" ); + _wrapper.SetContextAttribute( UiConst.RouteLabelFn, "a" ); var result = new StringBuilder(); result.Append( "" ); Assert.Equal( result.ToString(), GetResult() ); diff --git a/test/Util.Ui.NgZorro.Tests/Buttons/ButtonTagHelperTest.Popconfirm.cs b/test/Util.Ui.NgZorro.Tests/Buttons/ButtonTagHelperTest.Popconfirm.cs index 653f3d72b..266c1e050 100644 --- a/test/Util.Ui.NgZorro.Tests/Buttons/ButtonTagHelperTest.Popconfirm.cs +++ b/test/Util.Ui.NgZorro.Tests/Buttons/ButtonTagHelperTest.Popconfirm.cs @@ -286,6 +286,17 @@ public void TestPopconfirmOkDanger() { Assert.Equal( result.ToString(), GetResult() ); } + /// + /// 测试气泡框是否禁用确认按钮 + /// + [Fact] + public void TestPopconfirmOkDisabled() { + _wrapper.SetContextAttribute( UiConst.PopconfirmOkDisabled, "a" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + /// /// 测试气泡确认框按钮自动聚焦 /// diff --git a/test/Util.Ui.NgZorro.Tests/Calendars/CalendarTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Calendars/CalendarTagHelperTest.cs index 2e932c8e0..9bcbf4616 100644 --- a/test/Util.Ui.NgZorro.Tests/Calendars/CalendarTagHelperTest.cs +++ b/test/Util.Ui.NgZorro.Tests/Calendars/CalendarTagHelperTest.cs @@ -169,6 +169,28 @@ public void TestDisabledDate() { Assert.Equal( result.ToString(), GetResult() ); } + /// + /// 测试自定义头部内容 + /// + [Fact] + public void TestCustomHeader() { + _wrapper.SetContextAttribute( UiConst.CustomHeader, "a" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + + /// + /// 测试自定义头部内容 + /// + [Fact] + public void TestBindCustomHeader() { + _wrapper.SetContextAttribute( AngularConst.BindCustomHeader, "a" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + /// /// 测试内容 /// diff --git a/test/Util.Ui.NgZorro.Tests/Cascaders/CascaderTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Cascaders/CascaderTagHelperTest.cs index 43e533b54..27c6d0694 100644 --- a/test/Util.Ui.NgZorro.Tests/Cascaders/CascaderTagHelperTest.cs +++ b/test/Util.Ui.NgZorro.Tests/Cascaders/CascaderTagHelperTest.cs @@ -50,6 +50,28 @@ public void TestDefault() { Assert.Equal( result.ToString(), GetResult() ); } + /// + /// 测试引用变量 + /// + [Fact] + public void TestId() { + _wrapper.SetContextAttribute( UiConst.Id, "a" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + + /// + /// 测试名称 + /// + [Fact] + public void TestName() { + _wrapper.SetContextAttribute( UiConst.Name, "a" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + /// /// 测试允许清除 /// @@ -171,6 +193,28 @@ public void TestBindExpandTrigger() { Assert.Equal( result.ToString(), GetResult() ); } + /// + /// 测试触发操作 + /// + [Fact] + public void TestTriggerAction() { + _wrapper.SetContextAttribute( UiConst.TriggerAction, CascaderTriggerAction.Hover ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + + /// + /// 测试触发操作 + /// + [Fact] + public void TestBindTriggerAction() { + _wrapper.SetContextAttribute( AngularConst.BindTriggerAction, "a" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + /// /// 测试标签属性名 /// @@ -244,17 +288,6 @@ public void TestBindMenuClassName() { public void TestMenuStyle() { _wrapper.SetContextAttribute( UiConst.MenuStyle, "a" ); var result = new StringBuilder(); - result.Append( "" ); - Assert.Equal( result.ToString(), GetResult() ); - } - - /// - /// 测试浮层样式 - /// - [Fact] - public void TestBindMenuStyle() { - _wrapper.SetContextAttribute( AngularConst.BindMenuStyle, "a" ); - var result = new StringBuilder(); result.Append( "" ); Assert.Equal( result.ToString(), GetResult() ); } @@ -424,6 +457,39 @@ public void TestBindValueProperty() { Assert.Equal( result.ToString(), GetResult() ); } + /// + /// 测试状态 + /// + [Fact] + public void TestStatus() { + _wrapper.SetContextAttribute( UiConst.Status, FormControlStatus.Error ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + + /// + /// 测试状态 + /// + [Fact] + public void TestBindStatus() { + _wrapper.SetContextAttribute( AngularConst.BindStatus, "a" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + + /// + /// 测试浮层是否应带有背景板 + /// + [Fact] + public void TestBackdrop() { + _wrapper.SetContextAttribute( UiConst.Backdrop, "true" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + /// /// 测试模型变更事件 /// diff --git a/test/Util.Ui.NgZorro.Tests/Checkboxes/CheckboxGroupTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Checkboxes/CheckboxGroupTagHelperTest.cs index 0eff4e2b9..c4071dc9d 100644 --- a/test/Util.Ui.NgZorro.Tests/Checkboxes/CheckboxGroupTagHelperTest.cs +++ b/test/Util.Ui.NgZorro.Tests/Checkboxes/CheckboxGroupTagHelperTest.cs @@ -47,6 +47,28 @@ public void TestDefault() { Assert.Equal( result.ToString(), GetResult() ); } + /// + /// 测试引用变量 + /// + [Fact] + public void TestId() { + _wrapper.SetContextAttribute( UiConst.Id, "a" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + + /// + /// 测试名称 + /// + [Fact] + public void TestName() { + _wrapper.SetContextAttribute( UiConst.Name, "a" ); + 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 16925aa8c..c9cdcd800 100644 --- a/test/Util.Ui.NgZorro.Tests/Checkboxes/CheckboxTagHelperTest.cs +++ b/test/Util.Ui.NgZorro.Tests/Checkboxes/CheckboxTagHelperTest.cs @@ -2,6 +2,7 @@ using Util.Ui.Angular.Configs; using Util.Ui.Configs; using Util.Ui.NgZorro.Components.Checkboxes; +using Util.Ui.NgZorro.Configs; using Util.Ui.NgZorro.Tests.Samples; using Util.Ui.TagHelpers; using Xunit; @@ -59,6 +60,28 @@ public void TestId() { Assert.Equal( result.ToString(), GetResult() ); } + /// + /// 测试内部 id + /// + [Fact] + public void TestNzId() { + _wrapper.SetContextAttribute( UiConst.NzId, "a" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + + /// + /// 测试内部 id + /// + [Fact] + public void TestBindNzId() { + _wrapper.SetContextAttribute( AngularConst.BindNzId, "a" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + /// /// 测试设置名称 /// @@ -158,6 +181,18 @@ public void TestLabel() { Assert.Equal( result.ToString(), GetResult() ); } + /// + /// 测试设置标签 - 多语言 + /// + [Fact] + public void TestLabel_I18n() { + NgZorroOptionsService.SetOptions( new NgZorroOptions { EnableI18n = true } ); + _wrapper.SetContextAttribute( UiConst.Label, "a" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + /// /// 测试设置标签绑定 /// diff --git a/test/Util.Ui.NgZorro.Tests/ColorPickers/ColorPickerTagHelperTest.Expression.cs b/test/Util.Ui.NgZorro.Tests/ColorPickers/ColorPickerTagHelperTest.Expression.cs index e677e2593..200cce5a0 100644 --- a/test/Util.Ui.NgZorro.Tests/ColorPickers/ColorPickerTagHelperTest.Expression.cs +++ b/test/Util.Ui.NgZorro.Tests/ColorPickers/ColorPickerTagHelperTest.Expression.cs @@ -1,4 +1,5 @@ using System.Text; +using Util.Ui.NgZorro.Components.Forms.Configs; using Xunit; namespace Util.Ui.NgZorro.Tests.ColorPickers { @@ -11,6 +12,7 @@ public partial class ColorPickerTagHelperTest { /// [Fact] public void TestFor_1() { + _wrapper.SetItem( new FormShareConfig { FormCreated = true } ); _wrapper.SetExpression( t => t.Name ); var result = new StringBuilder(); result.Append( "" ); diff --git a/test/Util.Ui.NgZorro.Tests/ColorPickers/ColorPickerTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/ColorPickers/ColorPickerTagHelperTest.cs index 7061d84b4..d43d64c88 100644 --- a/test/Util.Ui.NgZorro.Tests/ColorPickers/ColorPickerTagHelperTest.cs +++ b/test/Util.Ui.NgZorro.Tests/ColorPickers/ColorPickerTagHelperTest.cs @@ -251,6 +251,17 @@ public void TestOpen() { Assert.Equal( result.ToString(), GetResult() ); } + /// + /// 测试自定义触发元素 + /// + [Fact] + public void TestFlipFlop() { + _wrapper.SetContextAttribute( UiConst.FlipFlop, "a" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + /// /// 测试内容 /// diff --git a/test/Util.Ui.NgZorro.Tests/DatePickers/DatePickerTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/DatePickers/DatePickerTagHelperTest.cs index 5df989e32..93b703d5f 100644 --- a/test/Util.Ui.NgZorro.Tests/DatePickers/DatePickerTagHelperTest.cs +++ b/test/Util.Ui.NgZorro.Tests/DatePickers/DatePickerTagHelperTest.cs @@ -55,13 +55,24 @@ public void TestDefault() { /// 测试输入框标识 /// [Fact] - public void TestInputId() { - _wrapper.SetContextAttribute( UiConst.InputId, "a" ); + public void TestNzId() { + _wrapper.SetContextAttribute( UiConst.NzId, "a" ); var result = new StringBuilder(); result.Append( "" ); Assert.Equal( result.ToString(), GetResult() ); } - + + /// + /// 测试输入框标识 + /// + [Fact] + public void TestBindNzId() { + _wrapper.SetContextAttribute( AngularConst.BindNzId, "a" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + /// /// 测试允许清除 /// @@ -84,6 +95,17 @@ public void TestAutoFocus() { Assert.Equal( result.ToString(), GetResult() ); } + /// + /// 测试浮层是否应带有背景板 + /// + [Fact] + public void TestBackdrop() { + _wrapper.SetContextAttribute( UiConst.Backdrop, "true" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + /// /// 测试默认面板日期 /// @@ -168,17 +190,6 @@ public void TestBindDropdownClassName() { public void TestPopupStyle() { _wrapper.SetContextAttribute( UiConst.PopupStyle, "a" ); var result = new StringBuilder(); - result.Append( "" ); - Assert.Equal( result.ToString(), GetResult() ); - } - - /// - /// 测试弹出日历样式 - /// - [Fact] - public void TestBindPopupStyle() { - _wrapper.SetContextAttribute( AngularConst.BindPopupStyle, "a" ); - var result = new StringBuilder(); result.Append( "" ); Assert.Equal( result.ToString(), GetResult() ); } @@ -238,6 +249,17 @@ public void TestMode() { Assert.Equal( result.ToString(), GetResult() ); } + /// + /// 测试模式 - 周,修复格式字符串 + /// + [Fact] + public void TestMode_Week() { + _wrapper.SetContextAttribute( UiConst.Mode, DatePickerMode.Week ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + /// /// 测试模式 /// @@ -348,6 +370,28 @@ public void TestBorderless() { Assert.Equal( result.ToString(), GetResult() ); } + /// + /// 测试内联模式 + /// + [Fact] + public void TestInline() { + _wrapper.SetContextAttribute( UiConst.Inline, "true" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + + /// + /// 测试显示周数 + /// + [Fact] + public void TestShowWeekNumber() { + _wrapper.SetContextAttribute( UiConst.ShowWeekNumber, "true" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + /// /// 测试自定义日期单元格内容 /// @@ -392,6 +436,89 @@ public void TestShowNow() { Assert.Equal( result.ToString(), GetResult() ); } + /// + /// 测试状态 + /// + [Fact] + public void TestStatus() { + _wrapper.SetContextAttribute( UiConst.Status, FormControlStatus.Error ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + + /// + /// 测试状态 + /// + [Fact] + public void TestBindStatus() { + _wrapper.SetContextAttribute( AngularConst.BindStatus, "a" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + + /// + /// 测试日期选择框弹出位置 + /// + [Fact] + public void TestPlacement() { + _wrapper.SetContextAttribute( UiConst.Placement, DatePickerPlacement.TopLeft ); + 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 TestRequired() { + _wrapper.SetContextAttribute( UiConst.Required, "true" ); + _wrapper.SetContextAttribute( AngularConst.NgModel, "model" ); + var result = new StringBuilder(); + result.Append( "" ); + result.Append( "" ); + result.Append( "" ); + result.Append( "" ); + result.Append( "{{v_id.getErrorMessage()}}" ); + result.Append( "" ); + result.Append( "" ); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + + /// + /// 测试必填项消息 + /// + [Fact] + public void TestRequiredMessage() { + _wrapper.SetContextAttribute( UiConst.Required, "true" ); + _wrapper.SetContextAttribute( UiConst.RequiredMessage, "a" ); + _wrapper.SetContextAttribute( AngularConst.NgModel, "model" ); + var result = new StringBuilder(); + result.Append( "" ); + result.Append( "" ); + result.Append( "" ); + result.Append( "" ); + result.Append( "{{v_id.getErrorMessage()}}" ); + result.Append( "" ); + result.Append( "" ); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + /// /// 测试内容 /// diff --git a/test/Util.Ui.NgZorro.Tests/DatePickers/RangePickerTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/DatePickers/RangePickerTagHelperTest.cs index e9770476a..6f33b6945 100644 --- a/test/Util.Ui.NgZorro.Tests/DatePickers/RangePickerTagHelperTest.cs +++ b/test/Util.Ui.NgZorro.Tests/DatePickers/RangePickerTagHelperTest.cs @@ -50,7 +50,29 @@ public void TestDefault() { result.Append( "" ); Assert.Equal( result.ToString(), GetResult() ); } - + + /// + /// 测试输入框标识 + /// + [Fact] + public void TestNzId() { + _wrapper.SetContextAttribute( UiConst.NzId, "a" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + + /// + /// 测试输入框标识 + /// + [Fact] + public void TestBindNzId() { + _wrapper.SetContextAttribute( AngularConst.BindNzId, "a" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + /// /// 测试允许清除 /// @@ -73,6 +95,17 @@ public void TestAutoFocus() { Assert.Equal( result.ToString(), GetResult() ); } + /// + /// 测试浮层是否应带有背景板 + /// + [Fact] + public void TestBackdrop() { + _wrapper.SetContextAttribute( UiConst.Backdrop, "true" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + /// /// 测试默认面板日期 /// @@ -146,17 +179,6 @@ public void TestBindDropdownClassName() { public void TestPopupStyle() { _wrapper.SetContextAttribute( UiConst.PopupStyle, "a" ); var result = new StringBuilder(); - result.Append( "" ); - Assert.Equal( result.ToString(), GetResult() ); - } - - /// - /// 测试弹出日历样式 - /// - [Fact] - public void TestBindPopupStyle() { - _wrapper.SetContextAttribute( AngularConst.BindPopupStyle, "a" ); - var result = new StringBuilder(); result.Append( "" ); Assert.Equal( result.ToString(), GetResult() ); } @@ -271,6 +293,17 @@ public void TestBindRenderExtraFooter() { Assert.Equal( result.ToString(), GetResult() ); } + /// + /// 测试自定义日期单元格内容 + /// + [Fact] + public void TestDateRender() { + _wrapper.SetContextAttribute( UiConst.DateRender, "a" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + /// /// 测试输入框大小 /// @@ -326,6 +359,28 @@ public void TestBorderless() { Assert.Equal( result.ToString(), GetResult() ); } + /// + /// 测试内联模式 + /// + [Fact] + public void TestInline() { + _wrapper.SetContextAttribute( UiConst.Inline, "true" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + + /// + /// 测试显示周数 + /// + [Fact] + public void TestShowWeekNumber() { + _wrapper.SetContextAttribute( UiConst.ShowWeekNumber, "true" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + /// /// 测试预设时间范围 /// @@ -370,6 +425,89 @@ public void TestShowTime() { Assert.Equal( result.ToString(), GetResult() ); } + /// + /// 测试状态 + /// + [Fact] + public void TestStatus() { + _wrapper.SetContextAttribute( UiConst.Status, FormControlStatus.Error ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + + /// + /// 测试状态 + /// + [Fact] + public void TestBindStatus() { + _wrapper.SetContextAttribute( AngularConst.BindStatus, "a" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + + /// + /// 测试日期选择框弹出位置 + /// + [Fact] + public void TestPlacement() { + _wrapper.SetContextAttribute( UiConst.Placement, DatePickerPlacement.TopLeft ); + 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 TestRequired() { + _wrapper.SetContextAttribute( UiConst.Required, "true" ); + _wrapper.SetContextAttribute( AngularConst.NgModel, "model" ); + var result = new StringBuilder(); + result.Append( "" ); + result.Append( "" ); + result.Append( "" ); + result.Append( "" ); + result.Append( "{{v_id.getErrorMessage()}}" ); + result.Append( "" ); + result.Append( "" ); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + + /// + /// 测试必填项消息 + /// + [Fact] + public void TestRequiredMessage() { + _wrapper.SetContextAttribute( UiConst.Required, "true" ); + _wrapper.SetContextAttribute( UiConst.RequiredMessage, "a" ); + _wrapper.SetContextAttribute( AngularConst.NgModel, "model" ); + var result = new StringBuilder(); + result.Append( "" ); + result.Append( "" ); + result.Append( "" ); + result.Append( "" ); + result.Append( "{{v_id.getErrorMessage()}}" ); + result.Append( "" ); + result.Append( "" ); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + /// /// 测试内容 /// diff --git a/test/Util.Ui.NgZorro.Tests/Forms/FormTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Forms/FormTagHelperTest.cs index 0bd21c0a7..d0df83613 100644 --- a/test/Util.Ui.NgZorro.Tests/Forms/FormTagHelperTest.cs +++ b/test/Util.Ui.NgZorro.Tests/Forms/FormTagHelperTest.cs @@ -183,6 +183,31 @@ public void TestFormGroup() { Assert.Equal( result.ToString(), GetResult() ); } + /// + /// 测试表单组 - 设置id + /// + [Fact] + public void TestFormGroup_2() { + _wrapper.SetContextAttribute( UiConst.Id, "id" ); + _wrapper.SetContextAttribute( UiConst.FormGroup, "a" ); + var result = new StringBuilder(); + result.Append( "
" ); + result.Append( "
" ); + Assert.Equal( result.ToString(), GetResult() ); + } + + /// + /// 测试是否不验证表单 + /// + [Fact] + public void TestNovalidate() { + _wrapper.SetContextAttribute( UiConst.Novalidate, true ); + var result = new StringBuilder(); + 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 29b916cd6..e3d9f18cb 100644 --- a/test/Util.Ui.NgZorro.Tests/Icons/IconTagHelperTest.cs +++ b/test/Util.Ui.NgZorro.Tests/Icons/IconTagHelperTest.cs @@ -131,7 +131,7 @@ public void TestRotate() { /// [Fact] public void TestTwotoneColorType() { - _wrapper.SetContextAttribute( AntDesignConst.TwotoneColorType, AntDesignColor.Red ); + _wrapper.SetContextAttribute( UiConst.TwotoneColorType, AntDesignColor.Red ); var result = new StringBuilder(); result.Append( "" ); Assert.Equal( result.ToString(), GetResult() ); @@ -142,7 +142,7 @@ public void TestTwotoneColorType() { /// [Fact] public void TestTwotoneColor() { - _wrapper.SetContextAttribute( AntDesignConst.TwotoneColor, "#eb2f96" ); + _wrapper.SetContextAttribute( UiConst.TwotoneColor, "#eb2f96" ); var result = new StringBuilder(); result.Append( "" ); Assert.Equal( result.ToString(), GetResult() ); @@ -153,7 +153,7 @@ public void TestTwotoneColor() { /// [Fact] public void TestTwotoneColor_2() { - _wrapper.SetContextAttribute( UiConst.Theme, IconTheme.Twotone ).SetContextAttribute( AntDesignConst.TwotoneColor, "#eb2f96" ); + _wrapper.SetContextAttribute( UiConst.Theme, IconTheme.Twotone ).SetContextAttribute( UiConst.TwotoneColor, "#eb2f96" ); var result = new StringBuilder(); result.Append( "" ); Assert.Equal( result.ToString(), GetResult() ); @@ -164,7 +164,7 @@ public void TestTwotoneColor_2() { /// [Fact] public void TestBindTwotoneColor() { - _wrapper.SetContextAttribute( AntDesignConst.BindTwotoneColor, "a" ); + _wrapper.SetContextAttribute( AngularConst.BindTwotoneColor, "a" ); var result = new StringBuilder(); result.Append( "" ); Assert.Equal( result.ToString(), GetResult() ); @@ -175,7 +175,7 @@ public void TestBindTwotoneColor() { /// [Fact] public void TestIconfont() { - _wrapper.SetContextAttribute( AntDesignConst.IconFont, "a" ); + _wrapper.SetContextAttribute( UiConst.IconFont, "a" ); var result = new StringBuilder(); result.Append( "" ); Assert.Equal( result.ToString(), GetResult() ); @@ -186,7 +186,7 @@ public void TestIconfont() { /// [Fact] public void TestBindIconfont() { - _wrapper.SetContextAttribute( AntDesignConst.BindIconFont, "a" ); + _wrapper.SetContextAttribute( AngularConst.BindIconFont, "a" ); var result = new StringBuilder(); result.Append( "" ); Assert.Equal( result.ToString(), GetResult() ); diff --git a/test/Util.Ui.NgZorro.Tests/Inputs/InputGroupTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Inputs/InputGroupTagHelperTest.cs index 602e947a6..e51cc41f6 100644 --- a/test/Util.Ui.NgZorro.Tests/Inputs/InputGroupTagHelperTest.cs +++ b/test/Util.Ui.NgZorro.Tests/Inputs/InputGroupTagHelperTest.cs @@ -265,7 +265,7 @@ public void TestBindSize() { /// [Fact] public void TestStatus() { - _wrapper.SetContextAttribute( UiConst.Status, InputStatus.Error ); + _wrapper.SetContextAttribute( UiConst.Status, FormControlStatus.Error ); var result = new StringBuilder(); 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 8008efff5..adae040d3 100644 --- a/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.InputGroup.cs +++ b/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.InputGroup.cs @@ -58,7 +58,7 @@ public void TestAddOnBefore_BindSize() { [Fact] public void TestAddOnBefore_Status() { _wrapper.SetContextAttribute( UiConst.AddOnBefore, "a" ); - _wrapper.SetContextAttribute( UiConst.Status, InputStatus.Error ); + _wrapper.SetContextAttribute( UiConst.Status, FormControlStatus.Error ); var result = new StringBuilder(); result.Append( "" ); result.Append( "" ); diff --git a/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.cs index c6656b40a..db434daf1 100644 --- a/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.cs +++ b/test/Util.Ui.NgZorro.Tests/Inputs/InputTagHelperTest.cs @@ -138,7 +138,7 @@ public void TestBindSize() { /// [Fact] public void TestStatus() { - _wrapper.SetContextAttribute( UiConst.Status, InputStatus.Error ); + _wrapper.SetContextAttribute( UiConst.Status, FormControlStatus.Error ); var result = new StringBuilder(); result.Append( "" ); Assert.Equal( result.ToString(), GetResult() ); diff --git a/test/Util.Ui.NgZorro.Tests/Layouts/SiderTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Layouts/SiderTagHelperTest.cs index ba9e00d96..c8e2424af 100644 --- a/test/Util.Ui.NgZorro.Tests/Layouts/SiderTagHelperTest.cs +++ b/test/Util.Ui.NgZorro.Tests/Layouts/SiderTagHelperTest.cs @@ -175,7 +175,7 @@ public void TestTrigger() { /// [Fact] public void TestZeroTrigger() { - _wrapper.SetContextAttribute( AntDesignConst.ZeroTrigger, "a" ); + _wrapper.SetContextAttribute( UiConst.ZeroTrigger, "a" ); var result = new StringBuilder(); result.Append( "" ); Assert.Equal( result.ToString(), GetResult() ); diff --git a/test/Util.Ui.NgZorro.Tests/PageHeaders/PageHeaderTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/PageHeaders/PageHeaderTagHelperTest.cs index ce65bc8f7..dfb55e12c 100644 --- a/test/Util.Ui.NgZorro.Tests/PageHeaders/PageHeaderTagHelperTest.cs +++ b/test/Util.Ui.NgZorro.Tests/PageHeaders/PageHeaderTagHelperTest.cs @@ -2,6 +2,7 @@ using Util.Ui.Angular.Configs; using Util.Ui.Configs; using Util.Ui.NgZorro.Components.PageHeaders; +using Util.Ui.NgZorro.Configs; using Util.Ui.NgZorro.Enums; using Util.Ui.TagHelpers; using Xunit; @@ -70,6 +71,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() ); + } + /// /// 测试标题 /// @@ -92,6 +105,18 @@ public void TestSubtitle() { Assert.Equal( result.ToString(), GetResult() ); } + /// + /// 测试子标题 - 多语言 + /// + [Fact] + public void TestSubtitle_I18n() { + NgZorroOptionsService.SetOptions( new NgZorroOptions { EnableI18n = true } ); + _wrapper.SetContextAttribute( UiConst.Subtitle, "a" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + /// /// 测试子标题 /// diff --git a/test/Util.Ui.NgZorro.Tests/Radios/RadioGroupTagHelperTest.Expression.cs b/test/Util.Ui.NgZorro.Tests/Radios/RadioGroupTagHelperTest.Expression.cs index 6ac02cb59..d5279ea72 100644 --- a/test/Util.Ui.NgZorro.Tests/Radios/RadioGroupTagHelperTest.Expression.cs +++ b/test/Util.Ui.NgZorro.Tests/Radios/RadioGroupTagHelperTest.Expression.cs @@ -1,4 +1,5 @@ using System.Text; +using Util.Ui.NgZorro.Components.Forms.Configs; using Util.Ui.NgZorro.Configs; using Xunit; @@ -12,6 +13,7 @@ public partial class RadioGroupTagHelperTest { /// [Fact] public void TestFor_Bool() { + _wrapper.SetItem( new FormShareConfig { FormCreated = true } ); _wrapper.SetExpression( t => t.Enabled ); var result = new StringBuilder(); result.Append( "" ); @@ -36,6 +38,7 @@ public void TestFor_Bool() { /// [Fact] public void TestFor_Bool_I18n() { + _wrapper.SetItem( new FormShareConfig { FormCreated = true } ); NgZorroOptionsService.SetOptions( new NgZorroOptions { EnableI18n = true } ); _wrapper.SetExpression( t => t.Enabled ); var result = new StringBuilder(); @@ -61,6 +64,7 @@ public void TestFor_Bool_I18n() { /// [Fact] public void TestFor_Enum() { + _wrapper.SetItem( new FormShareConfig { FormCreated = true } ); _wrapper.SetExpression( t => t.Gender ); var result = new StringBuilder(); result.Append( "" ); @@ -85,6 +89,7 @@ public void TestFor_Enum() { /// [Fact] public void TestFor_Enum_I18n() { + _wrapper.SetItem( new FormShareConfig { FormCreated = true } ); NgZorroOptionsService.SetOptions( new NgZorroOptions { EnableI18n = true } ); _wrapper.SetExpression( t => t.Gender ); var result = new StringBuilder(); diff --git a/test/Util.Ui.NgZorro.Tests/Radios/RadioTagHelperTest.Expression.cs b/test/Util.Ui.NgZorro.Tests/Radios/RadioTagHelperTest.Expression.cs index dd071c70a..123c3e8be 100644 --- a/test/Util.Ui.NgZorro.Tests/Radios/RadioTagHelperTest.Expression.cs +++ b/test/Util.Ui.NgZorro.Tests/Radios/RadioTagHelperTest.Expression.cs @@ -1,4 +1,5 @@ using System.Text; +using Util.Ui.NgZorro.Components.Forms.Configs; using Util.Ui.NgZorro.Configs; using Xunit; @@ -12,6 +13,7 @@ public partial class RadioTagHelperTest { /// [Fact] public void TestFor_Bool() { + _wrapper.SetItem( new FormShareConfig { FormCreated = true } ); _wrapper.SetExpression( t => t.Enabled ); var result = new StringBuilder(); result.Append( "" ); @@ -36,6 +38,7 @@ public void TestFor_Bool() { /// [Fact] public void TestFor_Bool_2() { + _wrapper.SetItem( new FormShareConfig { FormCreated = true } ); NgZorroOptionsService.SetOptions( new NgZorroOptions { EnableI18n = true } ); _wrapper.SetExpression( t => t.Enabled ); var result = new StringBuilder(); @@ -61,6 +64,7 @@ public void TestFor_Bool_2() { /// [Fact] public void TestFor_Bool_3() { + _wrapper.SetItem( new FormShareConfig { FormCreated = true } ); _wrapper.SetExpression( t => t.IsRequired ); var result = new StringBuilder(); result.Append( "" ); @@ -87,6 +91,7 @@ public void TestFor_Bool_3() { /// [Fact] public void TestFor_Enum() { + _wrapper.SetItem( new FormShareConfig { FormCreated = true } ); _wrapper.SetExpression( t => t.Gender ); var result = new StringBuilder(); result.Append( "" ); @@ -111,6 +116,7 @@ public void TestFor_Enum() { /// [Fact] public void TestFor_Enum_I18n() { + _wrapper.SetItem( new FormShareConfig { FormCreated = true } ); NgZorroOptionsService.SetOptions( new NgZorroOptions { EnableI18n = true } ); _wrapper.SetExpression( t => t.Gender ); var result = new StringBuilder(); diff --git a/test/Util.Ui.NgZorro.Tests/Segments/SegmentedTagHelperTest.Expression.cs b/test/Util.Ui.NgZorro.Tests/Segments/SegmentedTagHelperTest.Expression.cs index 38c233e0a..fc1def5e5 100644 --- a/test/Util.Ui.NgZorro.Tests/Segments/SegmentedTagHelperTest.Expression.cs +++ b/test/Util.Ui.NgZorro.Tests/Segments/SegmentedTagHelperTest.Expression.cs @@ -1,4 +1,5 @@ using System.Text; +using Util.Ui.NgZorro.Components.Forms.Configs; using Xunit; namespace Util.Ui.NgZorro.Tests.Segments { @@ -11,6 +12,7 @@ public partial class SegmentedTagHelperTest { /// [Fact] public void TestFor_Bool() { + _wrapper.SetItem( new FormShareConfig { FormCreated = true } ); _wrapper.SetExpression( t => t.Enabled ); var result = new StringBuilder(); result.Append( "" ); diff --git a/test/Util.Ui.NgZorro.Tests/Selects/SelectTagHelperTest.Expression.cs b/test/Util.Ui.NgZorro.Tests/Selects/SelectTagHelperTest.Expression.cs index bf609b568..b4c5879df 100644 --- a/test/Util.Ui.NgZorro.Tests/Selects/SelectTagHelperTest.Expression.cs +++ b/test/Util.Ui.NgZorro.Tests/Selects/SelectTagHelperTest.Expression.cs @@ -1,6 +1,7 @@ using System.Text; using Util.Ui.Angular.Configs; using Util.Ui.Configs; +using Util.Ui.NgZorro.Components.Forms.Configs; using Util.Ui.NgZorro.Configs; using Xunit; @@ -14,6 +15,7 @@ public partial class SelectTagHelperTest { /// [Fact] public void TestFor_Bool() { + _wrapper.SetItem( new FormShareConfig { FormCreated = true } ); _wrapper.SetExpression( t => t.Enabled ); var result = new StringBuilder(); result.Append( "" ); @@ -42,6 +44,7 @@ public void TestFor_Bool() { /// [Fact] public void TestFor_Bool_I18n() { + _wrapper.SetItem( new FormShareConfig { FormCreated = true } ); NgZorroOptionsService.SetOptions( new NgZorroOptions { EnableI18n = true } ); _wrapper.SetExpression( t => t.Enabled ); var result = new StringBuilder(); @@ -71,6 +74,7 @@ public void TestFor_Bool_I18n() { /// [Fact] public void TestFor_Name() { + _wrapper.SetItem( new FormShareConfig { FormCreated = true } ); _wrapper.SetExpression( t => t.Enabled ); _wrapper.SetContextAttribute( UiConst.Name,"abc" ); var result = new StringBuilder(); @@ -100,6 +104,7 @@ public void TestFor_Name() { /// [Fact] public void TestFor_BindName() { + _wrapper.SetItem( new FormShareConfig { FormCreated = true } ); _wrapper.SetExpression( t => t.Enabled ); _wrapper.SetContextAttribute( AngularConst.BindName, "abc" ); var result = new StringBuilder(); diff --git a/test/Util.Ui.NgZorro.Tests/Steps/StepTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Steps/StepTagHelperTest.cs index fd69240c9..adca2695f 100644 --- a/test/Util.Ui.NgZorro.Tests/Steps/StepTagHelperTest.cs +++ b/test/Util.Ui.NgZorro.Tests/Steps/StepTagHelperTest.cs @@ -2,6 +2,7 @@ using Util.Ui.Angular.Configs; using Util.Ui.Configs; using Util.Ui.NgZorro.Components.Steps; +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() ); + } + /// /// 测试标题 /// @@ -81,6 +94,18 @@ public void TestSubtitle() { Assert.Equal( result.ToString(), GetResult() ); } + /// + /// 测试子标题 - 多语言 + /// + [Fact] + public void TestSubtitle_I18n() { + NgZorroOptionsService.SetOptions( new NgZorroOptions { EnableI18n = true } ); + _wrapper.SetContextAttribute( UiConst.Subtitle, "a" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + /// /// 测试子标题 /// @@ -169,6 +194,17 @@ public void TestDisabled() { Assert.Equal( result.ToString(), GetResult() ); } + /// + /// 测试进度百分比 + /// + [Fact] + public void TestPercentage() { + _wrapper.SetContextAttribute( UiConst.Percentage, "a" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } + /// /// 测试内容 /// diff --git a/test/Util.Ui.NgZorro.Tests/Templates/TemplateTagHelperTest.cs b/test/Util.Ui.NgZorro.Tests/Templates/TemplateTagHelperTest.cs index 3f97cc94b..43ca5d447 100644 --- a/test/Util.Ui.NgZorro.Tests/Templates/TemplateTagHelperTest.cs +++ b/test/Util.Ui.NgZorro.Tests/Templates/TemplateTagHelperTest.cs @@ -1,4 +1,5 @@ using System.Text; +using Util.Ui.Angular.Configs; using Util.Ui.Configs; using Util.Ui.NgZorro.Components.Templates; using Util.Ui.TagHelpers; @@ -56,5 +57,16 @@ public void TestTab() { result.Append( "" ); Assert.Equal( result.ToString(), GetResult() ); } + + /// + /// 测试模板出口 + /// + [Fact] + public void TestTemplateOutlet() { + _wrapper.SetContextAttribute( AngularConst.NgTemplateOutlet, "a" ); + var result = new StringBuilder(); + result.Append( "" ); + Assert.Equal( result.ToString(), GetResult() ); + } } } \ No newline at end of file