mirror of
https://github.com/dotnetcore/Util.git
synced 2026-10-29 03:26:31 +08:00
更新文本框组件
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
<util-card-content>
|
||||
<util-layout gap="10px">
|
||||
<util-layout-item>
|
||||
<util-textbox for="Name"></util-textbox>
|
||||
<util-textbox for="Name" type="Multiple"></util-textbox>
|
||||
</util-layout-item>
|
||||
|
||||
<util-select for="Nation" multiple="true"></util-select>
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace Util.Ui.Material.Cards.Renders {
|
||||
/// </summary>
|
||||
protected void Config( TagBuilder builder ) {
|
||||
builder.Style( _config );
|
||||
builder.Class( _config );
|
||||
ConfigId( builder );
|
||||
ConfigContent( builder );
|
||||
}
|
||||
|
||||
@@ -24,6 +24,11 @@ namespace Util.Ui.Material.Enums {
|
||||
/// 电子邮件框
|
||||
/// </summary>
|
||||
[Description( "email" )]
|
||||
Email
|
||||
Email,
|
||||
/// <summary>
|
||||
/// 多行文本框
|
||||
/// </summary>
|
||||
[Description( "text" )]
|
||||
Multiple
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
using Util.Ui.Configs;
|
||||
using Util.Ui.Material.Forms.Configs;
|
||||
using Util.Ui.Material.Forms.Renders;
|
||||
using Util.Ui.Material.Internal;
|
||||
using Util.Ui.Renders;
|
||||
using Util.Ui.TagHelpers;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
using Util.Ui.Configs;
|
||||
using Util.Ui.Material.Enums;
|
||||
using Util.Ui.Material.Forms.Configs;
|
||||
using Util.Ui.Material.Forms.Renders;
|
||||
@@ -46,7 +47,10 @@ namespace Util.Ui.Material.Forms.TagHelpers {
|
||||
/// </summary>
|
||||
/// <param name="context">上下文</param>
|
||||
protected override IRender GetRender( Context context ) {
|
||||
return new TextBoxRender( new TextBoxConfig( context ) );
|
||||
var config = new TextBoxConfig( context );
|
||||
if ( config.GetValue<TextBoxType?>( UiConst.Type ) == TextBoxType.Multiple )
|
||||
config.IsTextArea = true;
|
||||
return new TextBoxRender( config );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+22
-9
@@ -19,12 +19,25 @@
|
||||
<% string CamelClassName = SafeClassName.ToCamelCase(); %>
|
||||
@model <%=SafeClassName%>Dto
|
||||
|
||||
<util-table base-url="<%=CamelClassName%>">
|
||||
<util-table-column type="Checkbox"></util-table-column>
|
||||
<util-table-column type="LineNumber"></util-table-column>
|
||||
<% foreach(Property p in Entity.Properties) { %>
|
||||
<% if( p.IsPrimaryKey.SafeValue() ) continue; %>
|
||||
<% if( Entity.IsHidden(p) ) continue; %>
|
||||
<util-table-column for="<%= p.PropertyName.ToSafeName() %>" sort="true"></util-table-column>
|
||||
<% } %>
|
||||
</util-table>
|
||||
<util-form id="form" on-submit="onChange(form)">
|
||||
<util-card>
|
||||
<util-card-header>
|
||||
编辑应用程序
|
||||
</util-card-header>
|
||||
<util-card-content style="padding: 30px 0 0 50px;">
|
||||
<% foreach(Property p in Entity.Properties) { %>
|
||||
<% if( p.IsPrimaryKey.SafeValue() ) continue; %>
|
||||
<% if( Entity.IsHidden(p) ) continue; %>
|
||||
<util-layout >
|
||||
<util-layout-item flex="50%">
|
||||
<util-textbox for="<%= p.PropertyName.ToSafeName() %>"></util-textbox>
|
||||
</util-layout-item>
|
||||
</util-layout>
|
||||
<% } %>
|
||||
</util-card-content>
|
||||
<util-card-actions align="Right">
|
||||
<util-button type="Reset"></util-button>
|
||||
<util-button type="Submit"></util-button>
|
||||
</util-card-actions>
|
||||
</util-card>
|
||||
</util-form>
|
||||
@@ -248,6 +248,17 @@ namespace Util.Ui.Tests.Material.Forms.TagHelpers {
|
||||
Assert.Equal( result.ToString(), GetResult( attributes ) );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 测试设置为多行文本框
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void TestType_Multiple() {
|
||||
var attributes = new TagHelperAttributeList { { UiConst.Type, TextBoxType.Multiple } };
|
||||
var result = new String();
|
||||
result.Append( "<mat-textarea-wrapper type=\"text\"></mat-textarea-wrapper>" );
|
||||
Assert.Equal( result.ToString(), GetResult( attributes ) );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 测试设置为电子邮件框
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user