@@ -470,7 +470,8 @@ public static void CreateDisplayByFieldType(this RenderTreeBuilder builder, IEdi
470470 /// <param name="changedType"></param>
471471 /// <param name="isSearch"></param>
472472 /// <param name="lookupService"></param>
473- public static void CreateComponentByFieldType ( this RenderTreeBuilder builder , ComponentBase component , IEditorItem item , object model , ItemChangedType changedType = ItemChangedType . Update , bool isSearch = false , ILookupService ? lookupService = null )
473+ /// <param name="skipValidate"></param>
474+ public static void CreateComponentByFieldType ( this RenderTreeBuilder builder , ComponentBase component , IEditorItem item , object model , ItemChangedType changedType = ItemChangedType . Update , bool isSearch = false , ILookupService ? lookupService = null , bool ? skipValidate = null )
474475 {
475476 var fieldType = item . PropertyType ;
476477 var fieldName = item . GetFieldName ( ) ;
@@ -488,7 +489,7 @@ public static void CreateComponentByFieldType(this RenderTreeBuilder builder, Co
488489 builder . AddAttribute ( 30 , nameof ( ValidateBase < string > . ValueChanged ) , fieldValueChanged ) ;
489490 builder . AddAttribute ( 40 , nameof ( ValidateBase < string > . ValueExpression ) , valueExpression ) ;
490491 builder . AddAttribute ( 41 , nameof ( ValidateBase < string > . ShowRequired ) , GetRequired ( item , changedType ) ) ;
491- builder . AddAttribute ( 41 , nameof ( ValidateBase < string > . RequiredErrorMessage ) , item . RequiredErrorMessage ) ;
492+ builder . AddAttribute ( 42 , nameof ( ValidateBase < string > . RequiredErrorMessage ) , item . RequiredErrorMessage ) ;
492493
493494 if ( ! item . CanWrite ( model . GetType ( ) , changedType , isSearch ) )
494495 {
@@ -504,6 +505,11 @@ public static void CreateComponentByFieldType(this RenderTreeBuilder builder, Co
504505 {
505506 builder . AddAttribute ( 70 , nameof ( ValidateBase < string > . ShowLabelTooltip ) , item . ShowLabelTooltip ) ;
506507 }
508+
509+ if ( skipValidate is true )
510+ {
511+ builder . AddAttribute ( 71 , nameof ( ValidateBase < string > . SkipValidate ) , true ) ;
512+ }
507513 }
508514
509515 if ( componentType == typeof ( NullSwitch ) && TryGetProperty ( model . GetType ( ) , fieldName , out var propertyInfo ) )
@@ -547,7 +553,7 @@ public static void CreateComponentByFieldType(this RenderTreeBuilder builder, Co
547553 }
548554
549555 // 设置 SkipValidate 参数
550- if ( IsValidComponent ( componentType ) )
556+ if ( skipValidate is not true && IsValidComponent ( componentType ) )
551557 {
552558 builder . AddAttribute ( 160 , nameof ( IEditorItem . SkipValidate ) , isSearch || item . SkipValidate ) ;
553559 }
0 commit comments