diff --git a/src/BootstrapBlazor.Server/Components/Samples/ValidateForms.razor b/src/BootstrapBlazor.Server/Components/Samples/ValidateForms.razor index 340e637c789..b587dca0539 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/ValidateForms.razor +++ b/src/BootstrapBlazor.Server/Components/Samples/ValidateForms.razor @@ -33,143 +33,143 @@
- - -
- -
-
- -
-
- -
-
- - - + + + + +
+
+ +
+
+ +
+
+ + + - -
-

@Localizer["ValidateFormInnerComponentInnerComponentLabel"]

-

@Localizer["ValidateFormInnerComponentInnerComponentDescription1"]

-
    -
  • @Localizer["ValidateFormInnerComponentInnerComponentLi1"]
  • -
  • @Localizer["ValidateFormInnerComponentInnerComponentLi2"]
  • -
  • @Localizer["ValidateFormInnerComponentInnerComponentLi3"]
  • -
  • @Localizer["ValidateFormInnerComponentInnerComponentLi4"]
  • -
  • @Localizer["ValidateFormInnerComponentInnerComponentLi5"]
  • -
-

@((MarkupString)Localizer["ValidateFormInnerComponentInnerComponentDescription2"].Value)

-
+ +
+

@Localizer["ValidateFormInnerComponentInnerComponentLabel"]

+

@Localizer["ValidateFormInnerComponentInnerComponentDescription1"]

+
    +
  • @Localizer["ValidateFormInnerComponentInnerComponentLi1"]
  • +
  • @Localizer["ValidateFormInnerComponentInnerComponentLi2"]
  • +
  • @Localizer["ValidateFormInnerComponentInnerComponentLi3"]
  • +
  • @Localizer["ValidateFormInnerComponentInnerComponentLi4"]
  • +
  • @Localizer["ValidateFormInnerComponentInnerComponentLi5"]
  • +
+

@((MarkupString)Localizer["ValidateFormInnerComponentInnerComponentDescription2"].Value)

+
- -
-
- - - - - -
-
- -
-
- -
-
- +
+
+ +
+
+
+
+
+ +
- -
@((MarkupString)Localizer["ValidateFormCustomDisplayErrorDescription"].Value)
- -
-
- -
-
- -
-
- -
-
- +
+
+ +
+
+
+
+
+
- -
@((MarkupString)Localizer["ValidateFormValidatorAllFieldDescription"].Value)
- -
-
- -
-
- -
-
- -
-
- +
+
+ +
+
+
+
+
+ +
- -
-

@((MarkupString)Localizer["ValidateFormComplexValidationDescription"].Value)

-
@Localizer["ValidateFormComplexValidationPre"]
-
+ +
+

@((MarkupString)Localizer["ValidateFormComplexValidationDescription"].Value)

+
@Localizer["ValidateFormComplexValidationPre"]
+
- -
-
- -
-
- -
-
-
-
-
- + +
+
+ +
+
+ +
+
+
+
+
+ -
- @foreach (var key in GetValueChangedFieldCollection()) +
+ @foreach (var key in GetValueChangedFieldCollection()) {
@key.Key.Model.GetType().Name.@key.Key.FieldName: @key.Value diff --git a/src/BootstrapBlazor/Components/Select/MultiSelect.razor.cs b/src/BootstrapBlazor/Components/Select/MultiSelect.razor.cs index 7f4e0e4ec60..10f2559a0ac 100644 --- a/src/BootstrapBlazor/Components/Select/MultiSelect.razor.cs +++ b/src/BootstrapBlazor/Components/Select/MultiSelect.razor.cs @@ -303,7 +303,7 @@ private async Task SetValue() var validationResults = new List(); await ValidatePropertyAsync(CurrentValue, validationContext, validationResults); - ToggleMessage(validationResults, true); + ToggleMessage(validationResults); } if (OnSelectedItemsChanged != null) diff --git a/src/BootstrapBlazor/Components/Transfer/Transfer.razor.cs b/src/BootstrapBlazor/Components/Transfer/Transfer.razor.cs index 548a9b6c50e..b37ea928c9d 100644 --- a/src/BootstrapBlazor/Components/Transfer/Transfer.razor.cs +++ b/src/BootstrapBlazor/Components/Transfer/Transfer.razor.cs @@ -323,7 +323,7 @@ private async Task TransferItems(List source, List t var validationResults = new List(); await ValidatePropertyAsync(RightItems, validationContext, validationResults); - ToggleMessage(validationResults, true); + ToggleMessage(validationResults); } } } diff --git a/src/BootstrapBlazor/Components/Upload/InputUpload.razor.cs b/src/BootstrapBlazor/Components/Upload/InputUpload.razor.cs index 0debc2be1a9..12686418116 100644 --- a/src/BootstrapBlazor/Components/Upload/InputUpload.razor.cs +++ b/src/BootstrapBlazor/Components/Upload/InputUpload.razor.cs @@ -152,8 +152,7 @@ private async Task OnDeleteFile() /// /// /// - /// - public override void ToggleMessage(IEnumerable results, bool validProperty) + public override void ToggleMessage(IEnumerable results) { if (results.Any()) { diff --git a/src/BootstrapBlazor/Components/Upload/UploadBase.cs b/src/BootstrapBlazor/Components/Upload/UploadBase.cs index 91fe293d2bc..36336a58884 100644 --- a/src/BootstrapBlazor/Components/Upload/UploadBase.cs +++ b/src/BootstrapBlazor/Components/Upload/UploadBase.cs @@ -59,8 +59,7 @@ public abstract class UploadBase : ValidateBase, IUpload /// 显示/隐藏验证结果方法 /// /// - /// 是否对本属性进行数据验证 - public override void ToggleMessage(IEnumerable results, bool validProperty) + public override void ToggleMessage(IEnumerable results) { if (FieldIdentifier != null) { diff --git a/src/BootstrapBlazor/Components/Validate/IValidateComponent.cs b/src/BootstrapBlazor/Components/Validate/IValidateComponent.cs index f35e8eec050..1725f3a6b4d 100644 --- a/src/BootstrapBlazor/Components/Validate/IValidateComponent.cs +++ b/src/BootstrapBlazor/Components/Validate/IValidateComponent.cs @@ -32,6 +32,5 @@ public interface IValidateComponent /// 显示或者隐藏提示信息方法 /// /// - /// 是否为模型验证 true 为属性验证 false 为整个模型验证 - void ToggleMessage(IEnumerable results, bool validProperty); + void ToggleMessage(IEnumerable results); } diff --git a/src/BootstrapBlazor/Components/Validate/ValidateBase.cs b/src/BootstrapBlazor/Components/Validate/ValidateBase.cs index 94eefa28f3f..1aaf3e1d809 100644 --- a/src/BootstrapBlazor/Components/Validate/ValidateBase.cs +++ b/src/BootstrapBlazor/Components/Validate/ValidateBase.cs @@ -441,8 +441,7 @@ private void ValidateType(ValidationContext context, List resu /// 显示/隐藏验证结果方法 /// /// - /// 是否对本属性进行数据验证 - public virtual void ToggleMessage(IEnumerable results, bool validProperty) + public virtual void ToggleMessage(IEnumerable results) { if (FieldIdentifier != null) { diff --git a/src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.cs b/src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.cs index 592f0bc71de..f8e0dca518e 100644 --- a/src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.cs +++ b/src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.cs @@ -163,7 +163,7 @@ private void InternalSetError(MemberExpression exp, string errorMessage) { new(errorMessage, new string[] { fieldName }) }; - validator.ToggleMessage(results, true); + validator.ToggleMessage(results); } } } @@ -181,7 +181,7 @@ public void SetError(string propertyName, string errorMessage) { new(errorMessage, new string[] { fieldName }) }; - validator.ToggleMessage(results, true); + validator.ToggleMessage(results); } } @@ -253,7 +253,7 @@ internal async Task ValidateObject(ValidationContext context, List LoadModule(this IJSRuntime jsRuntime, string var jSObjectReference = await jsRuntime.InvokeAsync(identifier: "import", fileName); module = new JSModule(jSObjectReference); } - catch (OperationCanceledException) { } + catch (Exception) { } return module ?? new JSModule(null); } diff --git a/test/UnitTest/Components/UploadTest.cs b/test/UnitTest/Components/UploadTest.cs index 2a2dc8aed29..96b0060d4fc 100644 --- a/test/UnitTest/Components/UploadTest.cs +++ b/test/UnitTest/Components/UploadTest.cs @@ -452,7 +452,7 @@ public void ButtonUpload_ValidateForm_Ok() { new("test", memberNames) }; - uploader.Instance.ToggleMessage(results, true); + uploader.Instance.ToggleMessage(results); } [Fact]