From 28bb2e1d02d6a7bf2c2dc3f6a5b06cf0f1813469 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 29 May 2025 09:58:51 +0800 Subject: [PATCH 1/4] chore: bump version 9.7.0 --- src/BootstrapBlazor/BootstrapBlazor.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index ab25aa9de34..798950e0ab1 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@  - 9.6.5-beta03 + 9.7.0 From c43bc825a3b39aeb6d9c57762e0262d2e68da1b8 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 29 May 2025 09:22:03 +0800 Subject: [PATCH 2/4] =?UTF-8?q?refactor:=20ToggleMessage=20=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E6=9B=B4=E6=94=B9=E4=B8=BA=20Task?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Conflicts: # src/BootstrapBlazor/Components/Validate/IValidateComponent.cs # src/BootstrapBlazor/Components/Validate/ValidateBase.cs --- src/BootstrapBlazor/Components/Validate/IValidateComponent.cs | 2 +- src/BootstrapBlazor/Components/Validate/ValidateBase.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/BootstrapBlazor/Components/Validate/IValidateComponent.cs b/src/BootstrapBlazor/Components/Validate/IValidateComponent.cs index 90781e89a3a..c00d08a52b1 100644 --- a/src/BootstrapBlazor/Components/Validate/IValidateComponent.cs +++ b/src/BootstrapBlazor/Components/Validate/IValidateComponent.cs @@ -33,5 +33,5 @@ public interface IValidateComponent /// 显示或者隐藏提示信息方法 /// /// - void ToggleMessage(IEnumerable results); + Task ToggleMessage(IReadOnlyCollection results); } diff --git a/src/BootstrapBlazor/Components/Validate/ValidateBase.cs b/src/BootstrapBlazor/Components/Validate/ValidateBase.cs index 6245ba47840..1f4ca2eb312 100644 --- a/src/BootstrapBlazor/Components/Validate/ValidateBase.cs +++ b/src/BootstrapBlazor/Components/Validate/ValidateBase.cs @@ -460,7 +460,7 @@ private void ValidateType(ValidationContext context, List resu /// 显示/隐藏验证结果方法 /// /// - public virtual void ToggleMessage(IEnumerable results) + public virtual Task ToggleMessage(IReadOnlyCollection results) { if (FieldIdentifier != null) { @@ -481,6 +481,7 @@ public virtual void ToggleMessage(IEnumerable results) // 必须刷新一次 UI 保证状态正确 StateHasChanged(); + return Task.CompletedTask; } private JSModule? ValidateModule { get; set; } From 436e2b1f09a8579fa8795f356c641936d77db195 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 29 May 2025 09:49:33 +0800 Subject: [PATCH 3/4] =?UTF-8?q?refactor:=20=E5=A2=9E=E5=8A=A0=20await=20?= =?UTF-8?q?=E5=85=B3=E9=94=AE=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Select/MultiSelect.razor.cs | 2 +- .../SelectGeneric/MultiSelectGeneric.razor.cs | 2 +- .../Components/Transfer/Transfer.razor.cs | 2 +- .../ValidateForm/ValidateForm.razor.cs | 20 +++++++++---------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/BootstrapBlazor/Components/Select/MultiSelect.razor.cs b/src/BootstrapBlazor/Components/Select/MultiSelect.razor.cs index cf4771c2ef1..04b277eae73 100644 --- a/src/BootstrapBlazor/Components/Select/MultiSelect.razor.cs +++ b/src/BootstrapBlazor/Components/Select/MultiSelect.razor.cs @@ -454,7 +454,7 @@ private async Task SetValue() var validationResults = new List(); await ValidatePropertyAsync(CurrentValue, validationContext, validationResults); - ToggleMessage(validationResults); + await ToggleMessage(validationResults); } if (OnSelectedItemsChanged != null) diff --git a/src/BootstrapBlazor/Components/SelectGeneric/MultiSelectGeneric.razor.cs b/src/BootstrapBlazor/Components/SelectGeneric/MultiSelectGeneric.razor.cs index e2ae8e1e182..096f5352a02 100644 --- a/src/BootstrapBlazor/Components/SelectGeneric/MultiSelectGeneric.razor.cs +++ b/src/BootstrapBlazor/Components/SelectGeneric/MultiSelectGeneric.razor.cs @@ -430,7 +430,7 @@ private async Task SetValue() var validationResults = new List(); await ValidatePropertyAsync(CurrentValue, validationContext, validationResults); - ToggleMessage(validationResults); + await ToggleMessage(validationResults); } if (OnSelectedItemsChanged != null) diff --git a/src/BootstrapBlazor/Components/Transfer/Transfer.razor.cs b/src/BootstrapBlazor/Components/Transfer/Transfer.razor.cs index e24245d6acf..e2ef7309c59 100644 --- a/src/BootstrapBlazor/Components/Transfer/Transfer.razor.cs +++ b/src/BootstrapBlazor/Components/Transfer/Transfer.razor.cs @@ -317,7 +317,7 @@ private async Task TransferItems(List source, List t var validationResults = new List(); await ValidatePropertyAsync(RightItems, validationContext, validationResults); - ToggleMessage(validationResults); + await ToggleMessage(validationResults); } } } diff --git a/src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.cs b/src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.cs index 315a1cb9d58..4e4c18250ad 100644 --- a/src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.cs +++ b/src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.cs @@ -169,20 +169,20 @@ internal void AddValidator((string FieldName, Type ModelType) key, (FieldIdentif /// /// /// 错误描述信息,可为空,为空时查找资源文件 - public void SetError(Expression> expression, string errorMessage) + public async Task SetError(Expression> expression, string errorMessage) { switch (expression.Body) { case UnaryExpression { Operand: MemberExpression mem }: - InternalSetError(mem, errorMessage); + await InternalSetError(mem, errorMessage); break; case MemberExpression exp: - InternalSetError(exp, errorMessage); + await InternalSetError(exp, errorMessage); break; } } - private void InternalSetError(MemberExpression exp, string errorMessage) + private async Task InternalSetError(MemberExpression exp, string errorMessage) { if (exp.Expression != null) { @@ -198,7 +198,7 @@ private void InternalSetError(MemberExpression exp, string errorMessage) { new(errorMessage, [fieldName]) }; - validator.ToggleMessage(results); + await validator.ToggleMessage(results); } } @@ -207,7 +207,7 @@ private void InternalSetError(MemberExpression exp, string errorMessage) /// /// 字段名,可以使用多层,如 a.b.c /// 错误描述信息,可为空,为空时查找资源文件 - public void SetError(string propertyName, string errorMessage) + public async Task SetError(string propertyName, string errorMessage) { if (TryGetModelField(propertyName, out var modelType, out var fieldName) && TryGetValidator(modelType, fieldName, out var validator)) { @@ -215,7 +215,7 @@ public void SetError(string propertyName, string errorMessage) { new(errorMessage, [fieldName]) }; - validator.ToggleMessage(results); + await validator.ToggleMessage(results); } } @@ -327,7 +327,7 @@ internal async Task ValidateObject(ValidationContext context, List _validateResults.Values.SelectMany(i => i).Any(i => i.MemberNames.Contains(name))); foreach (var (validator, messages) in _validateResults) { - validator.ToggleMessage(messages); + await validator.ToggleMessage(messages); } } } @@ -352,7 +352,7 @@ internal async Task ValidateFieldAsync(ValidationContext context, List Date: Thu, 29 May 2025 10:05:50 +0800 Subject: [PATCH 4/4] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E5=BC=82=E6=AD=A5=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Upload/InputUpload.razor.cs | 3 ++- src/BootstrapBlazor/Components/Upload/UploadBase.cs | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/BootstrapBlazor/Components/Upload/InputUpload.razor.cs b/src/BootstrapBlazor/Components/Upload/InputUpload.razor.cs index bcecdf40a2a..cf1df406861 100644 --- a/src/BootstrapBlazor/Components/Upload/InputUpload.razor.cs +++ b/src/BootstrapBlazor/Components/Upload/InputUpload.razor.cs @@ -153,7 +153,7 @@ private async Task OnDeleteFile() /// /// /// - public override void ToggleMessage(IEnumerable results) + public override Task ToggleMessage(IReadOnlyCollection results) { if (results.Any()) { @@ -166,5 +166,6 @@ public override void ToggleMessage(IEnumerable results) IsValid = true; } OnValidate(IsValid); + return Task.CompletedTask; } } diff --git a/src/BootstrapBlazor/Components/Upload/UploadBase.cs b/src/BootstrapBlazor/Components/Upload/UploadBase.cs index 3e6da1db6e3..bcbac5ad920 100644 --- a/src/BootstrapBlazor/Components/Upload/UploadBase.cs +++ b/src/BootstrapBlazor/Components/Upload/UploadBase.cs @@ -57,10 +57,10 @@ public abstract class UploadBase : ValidateBase, IUpload public Func? OnChange { get; set; } /// - /// 显示/隐藏验证结果方法 + /// /// /// - public override void ToggleMessage(IEnumerable results) + public override Task ToggleMessage(IReadOnlyCollection results) { if (FieldIdentifier != null) { @@ -84,6 +84,7 @@ public override void ToggleMessage(IEnumerable results) } OnValidate(IsValid); } + return Task.CompletedTask; } ///