Skip to content

Commit 87b5e6b

Browse files
committed
添加flex弹性布局组件,添加查询表单支持
1 parent f4081d0 commit 87b5e6b

File tree

34 files changed

+1093
-33
lines changed

34 files changed

+1093
-33
lines changed

build/version.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
<VersionMinor>0</VersionMinor>
55
<VersionPatch>1</VersionPatch>
66
<VersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)</VersionPrefix>
7-
<VersionSuffix>pre-3</VersionSuffix>
7+
<VersionSuffix>pre-6</VersionSuffix>
88
</PropertyGroup>
99
</Project>

src/Util.Ui.Angular/Configs/AngularConst.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,4 +1696,8 @@ public static class AngularConst {
16961696
/// 不绑定文件列表
16971697
/// </summary>
16981698
public const string NotBindFileList = "not-bind-file-list";
1699+
/// <summary>
1700+
/// 自动换行
1701+
/// </summary>
1702+
public const string BindWrap = "bind-wrap";
16991703
}

src/Util.Ui.NgZorro/Components/Base/ColumnBuilderBase.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using Microsoft.AspNetCore.Mvc.Rendering;
22
using Util.Ui.Angular.Builders;
33
using Util.Ui.Angular.Configs;
4-
using Util.Ui.Configs;
54
using Util.Ui.NgZorro.Components.Grids.Helpers;
65

76
namespace Util.Ui.NgZorro.Components.Base;

src/Util.Ui.NgZorro/Components/Empties/Builders/EmptyBuilder.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using Util.Ui.Angular.Builders;
22
using Util.Ui.Angular.Configs;
3-
using Util.Ui.Configs;
43

54
namespace Util.Ui.NgZorro.Components.Empties.Builders;
65

src/Util.Ui.NgZorro/Components/Empties/EmptyTagHelper.cs

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

src/Util.Ui.NgZorro/Components/Empties/Renders/EmptyRender.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Util.Ui.Builders;
2-
using Util.Ui.Configs;
32
using Util.Ui.NgZorro.Components.Empties.Builders;
43
using Util.Ui.Renders;
54

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
using Util.Ui.Angular.Builders;
2+
using Util.Ui.Angular.Configs;
3+
using Util.Ui.NgZorro.Enums;
4+
5+
namespace Util.Ui.NgZorro.Components.Flex.Builders;
6+
7+
/// <summary>
8+
/// 弹性布局栅格标签生成器
9+
/// </summary>
10+
public class FlexBuilder : AngularTagBuilder {
11+
/// <summary>
12+
/// 配置
13+
/// </summary>
14+
private readonly Config _config;
15+
16+
/// <summary>
17+
/// 初始化弹性布局栅格标签生成器
18+
/// </summary>
19+
/// <param name="config">配置</param>
20+
public FlexBuilder( Config config ) : base( config,"div" ) {
21+
_config = config;
22+
base.Attribute("nz-flex");
23+
}
24+
25+
/// <summary>
26+
/// 配置是否垂直布局
27+
/// </summary>
28+
public FlexBuilder Vertical() {
29+
AttributeIfNotEmpty( "[nzVertical]", _config.GetBoolValue( UiConst.Vertical ) );
30+
AttributeIfNotEmpty( "[nzVertical]", _config.GetValue( AngularConst.BindVertical ) );
31+
return this;
32+
}
33+
34+
/// <summary>
35+
/// 配置对齐方式
36+
/// </summary>
37+
public FlexBuilder Justify() {
38+
AttributeIfNotEmpty( "nzJustify", _config.GetValue<FlexJustify?>( UiConst.Justify )?.Description() );
39+
AttributeIfNotEmpty( "[nzJustify]", _config.GetValue( AngularConst.BindJustify ) );
40+
return this;
41+
}
42+
43+
/// <summary>
44+
/// 配置垂直对齐方式
45+
/// </summary>
46+
public FlexBuilder Align() {
47+
AttributeIfNotEmpty( "nzAlign", _config.GetValue<FlexAlign?>( UiConst.Align )?.Description() );
48+
AttributeIfNotEmpty( "[nzAlign]", _config.GetValue( AngularConst.BindAlign ) );
49+
return this;
50+
}
51+
52+
/// <summary>
53+
/// 配置间距
54+
/// </summary>
55+
public FlexBuilder Gap() {
56+
AttributeIfNotEmpty( "nzGap", _config.GetValue<FlexGap?>( UiConst.Gap )?.Description() );
57+
AttributeIfNotEmpty( "[nzGap]", _config.GetValue( AngularConst.BindGap ) );
58+
return this;
59+
}
60+
61+
/// <summary>
62+
/// 配置自动换行
63+
/// </summary>
64+
public FlexBuilder Wrap() {
65+
AttributeIfNotEmpty( "nzWrap", _config.GetValue<FlexWrap?>( UiConst.Wrap )?.Description() );
66+
AttributeIfNotEmpty( "[nzWrap]", _config.GetValue( AngularConst.BindWrap ) );
67+
return this;
68+
}
69+
70+
/// <summary>
71+
/// 配置flex
72+
/// </summary>
73+
public FlexBuilder Flex() {
74+
AttributeIfNotEmpty( "nzFlex", _config.GetValue( UiConst.Flex ) );
75+
AttributeIfNotEmpty( "[nzFlex]", _config.GetValue( AngularConst.BindFlex ) );
76+
return this;
77+
}
78+
79+
/// <summary>
80+
/// 配置
81+
/// </summary>
82+
public override void Config() {
83+
base.Config();
84+
Vertical().Justify().Align().Gap().Wrap().Flex();
85+
}
86+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
using Microsoft.AspNetCore.Razor.TagHelpers;
2+
using Util.Ui.Angular.TagHelpers;
3+
using Util.Ui.NgZorro.Components.Flex.Renders;
4+
using Util.Ui.NgZorro.Enums;
5+
using Util.Ui.Renders;
6+
7+
namespace Util.Ui.NgZorro.Components.Flex;
8+
9+
/// <summary>
10+
/// 弹性布局栅格,生成的标签为&lt;div nz-flex>&lt;/div>
11+
/// </summary>
12+
[HtmlTargetElement( "util-flex" )]
13+
public class FlexTagHelper : AngularTagHelperBase {
14+
/// <summary>
15+
/// [nzVertical],是否垂直布局, 默认值: false
16+
/// </summary>
17+
public bool Vertical { get; set; }
18+
/// <summary>
19+
/// [nzVertical],是否垂直布局, 默认值: false
20+
/// </summary>
21+
public string BindVertical { get; set; }
22+
/// <summary>
23+
/// nzJustify,对齐方式, 可选值: flex-start,center,flex-end,space-between,space-around,space-evenly
24+
/// </summary>
25+
public FlexJustify Justify { get; set; }
26+
/// <summary>
27+
/// [nzJustify],对齐方式, 可选值: flex-start,center,flex-end,space-between,space-around,space-evenly
28+
/// </summary>
29+
public string BindJustify { get; set; }
30+
/// <summary>
31+
/// nzAlign,垂直对齐方式, 可选值: flex-start,center,flex-end
32+
/// </summary>
33+
public FlexAlign Align { get; set; }
34+
/// <summary>
35+
/// [nzAlign],垂直对齐方式, 可选值: flex-start,center,flex-end
36+
/// </summary>
37+
public string BindAlign { get; set; }
38+
/// <summary>
39+
/// nzGap,元素之间的间距, 可选值: small,middle,large
40+
/// </summary>
41+
public FlexGap Gap { get; set; }
42+
/// <summary>
43+
/// [nzGap],元素之间的间距, 可选值: small,middle,large,自定义数值
44+
/// </summary>
45+
public string BindGap { get; set; }
46+
/// <summary>
47+
/// nzWrap,自动换行, 可选值: wrap,wrap-reverse,nowrap
48+
/// </summary>
49+
public FlexWrap Wrap { get; set; }
50+
/// <summary>
51+
/// [nzWrap],自动换行, 可选值: wrap,wrap-reverse,nowrap
52+
/// </summary>
53+
public string BindWrap { get; set; }
54+
/// <summary>
55+
/// nzFlex
56+
/// </summary>
57+
public string Flex { get; set; }
58+
/// <summary>
59+
/// [nzFlex]
60+
/// </summary>
61+
public string BindFlex { get; set; }
62+
63+
/// <inheritdoc />
64+
protected override IRender GetRender( TagHelperContext context, TagHelperOutput output, TagHelperContent content ) {
65+
var config = new Config( context, output, content );
66+
return new FlexRender( config );
67+
}
68+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using Util.Ui.Angular.Extensions;
2+
using Util.Ui.Builders;
3+
using Util.Ui.NgZorro.Components.Flex.Builders;
4+
using Util.Ui.Renders;
5+
6+
namespace Util.Ui.NgZorro.Components.Flex.Renders;
7+
8+
/// <summary>
9+
/// 空状态渲染器
10+
/// </summary>
11+
public class FlexRender : RenderBase {
12+
/// <summary>
13+
/// 配置
14+
/// </summary>
15+
private readonly Config _config;
16+
17+
/// <summary>
18+
/// 初始化空状态渲染器
19+
/// </summary>
20+
/// <param name="config">配置</param>
21+
public FlexRender( Config config ) {
22+
_config = config;
23+
}
24+
25+
/// <summary>
26+
/// 获取标签生成器
27+
/// </summary>
28+
protected override TagBuilder GetTagBuilder() {
29+
var builder = new FlexBuilder( _config );
30+
builder.Config();
31+
return builder;
32+
}
33+
34+
/// <inheritdoc />
35+
public override IHtmlContent Clone() {
36+
return new FlexRender( _config.CopyRemoveAttributes() );
37+
}
38+
}

src/Util.Ui.NgZorro/Components/Forms/Builders/FormBuilder.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using Util.Ui.Angular.Builders;
22
using Util.Ui.Angular.Configs;
33
using Util.Ui.Angular.Extensions;
4-
using Util.Ui.Configs;
54
using Util.Ui.NgZorro.Enums;
65

76
namespace Util.Ui.NgZorro.Components.Forms.Builders;

0 commit comments

Comments
 (0)