From 7d8ac74c2e77b755591f9be3af0247926686e4bc Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 7 Feb 2026 19:17:05 +0800 Subject: [PATCH 1/4] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/EditorForm/EditorForm.razor.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs b/src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs index f54352c97bf..e628e6ed907 100644 --- a/src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs +++ b/src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs @@ -85,8 +85,8 @@ public partial class EditorForm : IShowLabel, IDisposable public int? LabelWidth { get; set; } /// - /// 获得/设置 列模板 设置 时本参数不生效 - /// Gets or sets Field Items Template. Not effective when is set + /// 获得/设置 绑定属性集合模板 设置 时本参数优先级高 + /// Gets or sets the field items collection template. /// [Parameter] public RenderFragment? FieldItems { get; set; } @@ -158,8 +158,8 @@ public partial class EditorForm : IShowLabel, IDisposable public List? IgnoreItems { get; set; } /// - /// 获得/设置 级联上下文绑定字段信息集合 设置此参数后 模板不生效 - /// Gets or sets Context Field Items Collection. template will not be effective if set + /// 获得/设置 绑定字段信息集合 设置此参数后 模板优先级更高 + /// Gets or sets the items collection. /// [Parameter] public IEnumerable? Items { get; set; } From f9e0bdb1608970b5d18acdf58eea9c71cf1e30a3 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 7 Feb 2026 19:33:28 +0800 Subject: [PATCH 2/4] =?UTF-8?q?refactor:=20=E5=A2=9E=E5=BC=BA=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/EditorForm/EditorForm.razor.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs b/src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs index e628e6ed907..ff1f7f6c61f 100644 --- a/src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs +++ b/src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs @@ -294,7 +294,8 @@ private List GetRenderItems() var items = new List(); if (Items != null) { - items.AddRange(Items.Where(i => !i.GetIgnore() && !string.IsNullOrEmpty(i.GetFieldName()) && FilterIgnoreItem(i))); + items.AddRange(Items.Where(i => _editorItems.Find(item => i.GetFieldName() == item.GetFieldName()) == null && FilterEditorItem(i))); + items.AddRange(_editorItems.Where(FilterEditorItem)); return items; } @@ -309,6 +310,8 @@ private List GetRenderItems() return items; } + private bool FilterEditorItem(IEditorItem i) => !i.GetIgnore() && !string.IsNullOrEmpty(i.GetFieldName()) && FilterIgnoreItem(i); + private bool FilterIgnoreItem(IEditorItem item) { return IgnoreItems?.Find(i => i.Equals(item.GetFieldName(), StringComparison.OrdinalIgnoreCase)) == null; From e9d04c202359553fca3524538011de28796fdc98 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Mon, 9 Feb 2026 16:26:02 +0800 Subject: [PATCH 3/4] =?UTF-8?q?test:=20=E5=A2=9E=E5=8A=A0=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/UnitTest/Components/EditorFormTest.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/UnitTest/Components/EditorFormTest.cs b/test/UnitTest/Components/EditorFormTest.cs index 736a136e38b..57f9675cbd0 100644 --- a/test/UnitTest/Components/EditorFormTest.cs +++ b/test/UnitTest/Components/EditorFormTest.cs @@ -68,8 +68,29 @@ public void Items_Ok() pb.Add(a => a.Items, new List { new InternalTableColumn("Id", typeof(int)) { Ignore = true }, + new InternalTableColumn("Name", typeof(string)), new TableTemplateColumn() }); + + pb.Add(a => a.FieldItems, f => builder => + { + var index = 0; + builder.OpenComponent>(index++); + builder.AddAttribute(index++, nameof(EditorItem.Field), f.Name); + builder.AddAttribute(index++, nameof(EditorItem.FieldExpression), Utility.GenerateValueExpression(foo, nameof(Foo.Name), typeof(string))); + + builder.AddAttribute(index++, nameof(EditorItem.Required), true); + builder.AddAttribute(index++, nameof(EditorItem.RequiredErrorMessage), "Test"); + builder.AddAttribute(index++, nameof(EditorItem.Readonly), true); + builder.AddAttribute(index++, nameof(EditorItem.SkipValidate), false); + builder.AddAttribute(index++, nameof(EditorItem.Text), "Test-Text"); + builder.AddAttribute(index++, nameof(EditorItem.ComponentType), typeof(BootstrapInput)); + builder.AddAttribute(index++, nameof(EditorItem.ComponentParameters), new KeyValuePair[] + { + new("type", "text") + }); + builder.CloseComponent(); + }); }); } From 8ba36ba0bf6532d7c85e1956546b025e2173b757 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Tue, 10 Feb 2026 10:37:09 +0800 Subject: [PATCH 4/4] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E6=80=A7?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs b/src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs index ff1f7f6c61f..7464d9a6da4 100644 --- a/src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs +++ b/src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs @@ -294,7 +294,8 @@ private List GetRenderItems() var items = new List(); if (Items != null) { - items.AddRange(Items.Where(i => _editorItems.Find(item => i.GetFieldName() == item.GetFieldName()) == null && FilterEditorItem(i))); + var editorFieldNames = new HashSet(_editorItems.Select(item => item.GetFieldName())); + items.AddRange(Items.Where(i => !editorFieldNames.Contains(i.GetFieldName()) && FilterEditorItem(i))); items.AddRange(_editorItems.Where(FilterEditorItem)); return items; }