-
-
Notifications
You must be signed in to change notification settings - Fork 375
feat(EditorForm): add EditorFormGroupType parameter #7612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
47dbef3
5e50cdf
080acbb
a64ab5e
7bcca93
8111054
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -26,6 +26,7 @@ public sealed partial class EditorForms | |||||
| private IStringLocalizer<Foo>? FooLocalizer { get; set; } | ||||||
|
|
||||||
| private List<string> _ignoreItems = []; | ||||||
| private EditorFormGroupType _groupType = EditorFormGroupType.GroupBox; | ||||||
|
||||||
| private EditorFormGroupType _groupType = EditorFormGroupType.GroupBox; | |
| private readonly EditorFormGroupType _groupType = EditorFormGroupType.GroupBox; |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2129,6 +2129,9 @@ | |||||
| "EditorFormTips3": "Complex edit columns, set up <code>EditTemplate</code> templates, and edit custom components", | ||||||
| "EditorFormTips4": "The buttons in the form can be set up multiplely, just set the buttons <code>Buttons</code> template", | ||||||
| "GroupBoxTitle": "An example of a form", | ||||||
| "GroupDescription": "Grouping is enabled by setting the <code>GroupName</code> parameter of the <code>EditorItem</code> component, and the order is controlled by <code>GroupOrder</code>.", | ||||||
| "GroupIntro": "The grouping format can be controlled by setting the <code>groupType</code> value.", | ||||||
|
||||||
| "GroupIntro": "The grouping format can be controlled by setting the <code>groupType</code> value.", | |
| "GroupIntro": "The grouping format can be controlled by setting the <code>GroupType</code> value.", |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| @namespace BootstrapBlazor.Components | ||
| @namespace BootstrapBlazor.Components | ||
| @inherits BootstrapComponentBase | ||
|
|
||
| <div @attributes="@AdditionalAttributes" class="@ClassString"> | ||
| <label class="legend">@Title</label> | ||
| <span class="legend">@Title</span> | ||
| @ChildContent | ||
| </div> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the Apache 2.0 License | ||
| // See the LICENSE file in the project root for more information. | ||
| // Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone | ||
|
|
||
| namespace BootstrapBlazor.Components; | ||
|
|
||
| /// <summary> | ||
| /// <para lang="zh">EditorForm 分组类型</para> | ||
| /// <para lang="en">EditorForm group type</para> | ||
| /// </summary> | ||
| public enum EditorFormGroupType | ||
| { | ||
| /// <summary> | ||
| /// <para lang="zh">使用 GroupBox 形式</para> | ||
| /// <para lang="en">Group box</para> | ||
| /// </summary> | ||
| GroupBox, | ||
|
|
||
| /// <summary> | ||
| /// <para lang="zh">使用 RowHeader 形式</para> | ||
| /// <para lang="en">Row header</para> | ||
| /// </summary> | ||
| RowHeader, | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -177,6 +177,25 @@ public void Buttons_Ok() | |
| }); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void GroupType_Ok() | ||
| { | ||
| var foo = new Foo(); | ||
| var cut = Context.Render<EditorForm<Foo>>(pb => | ||
| { | ||
| pb.Add(a => a.Model, foo); | ||
| pb.Add(a => a.GroupType, EditorFormGroupType.GroupBox); | ||
| }); | ||
|
|
||
| cut.DoesNotContain("bb-editor-group-row-header"); | ||
|
Comment on lines
+181
to
+190
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (testing): Add a test to verify the default GroupType behavior when the parameter is not set. This test only validates explicit |
||
|
|
||
| cut.Render(pb => | ||
| { | ||
| pb.Add(a => a.GroupType, EditorFormGroupType.RowHeader); | ||
| }); | ||
| cut.Contains("bb-editor-group-row-header"); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Alignment_Right() | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing @ symbol before the variable reference. The GroupType parameter binding should be GroupType="@_groupType" instead of GroupType="_groupType". Without the @ symbol, the component will receive the literal string "_groupType" rather than the value of the variable.