@@ -12,6 +12,8 @@ import {
12
12
FieldProps ,
13
13
FormContextType ,
14
14
IdSchema ,
15
+ PathSchema ,
16
+ PathSegment ,
15
17
RJSFSchema ,
16
18
StrictRJSFSchema ,
17
19
TranslatableString ,
@@ -502,6 +504,7 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
502
504
uiSchema = { } ,
503
505
errorSchema,
504
506
idSchema,
507
+ pathSchema,
505
508
name,
506
509
title,
507
510
disabled = false ,
@@ -534,6 +537,14 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
534
537
const itemIdPrefix = idSchema . $id + idSeparator + index ;
535
538
const itemIdSchema = schemaUtils . toIdSchema ( itemSchema , itemIdPrefix , itemCast , idPrefix , idSeparator ) ;
536
539
540
+ // Create path schema for array item with segments
541
+ const itemPathSegments : PathSegment [ ] = [ ...( pathSchema ?. $segments || [ ] ) , { type : 'array' , key : index } ] ;
542
+
543
+ const itemPathSchema : PathSchema < T > = {
544
+ $name : `${ pathSchema ?. $name || '' } .${ index } ` ,
545
+ $segments : itemPathSegments ,
546
+ } ;
547
+
537
548
// Compute the item UI schema using the helper method
538
549
const itemUiSchema = this . computeItemUiSchema ( uiSchema , item , index , formContext ) ;
539
550
@@ -547,6 +558,7 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
547
558
canMoveDown : index < formData . length - 1 ,
548
559
itemSchema,
549
560
itemIdSchema,
561
+ itemPathSchema,
550
562
itemErrorSchema,
551
563
itemData : itemCast ,
552
564
itemUiSchema,
@@ -738,6 +750,7 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
738
750
idPrefix,
739
751
idSeparator = '_' ,
740
752
idSchema,
753
+ pathSchema,
741
754
name,
742
755
title,
743
756
disabled = false ,
@@ -787,6 +800,15 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
787
800
: itemSchemas [ index ] ) || { } ;
788
801
const itemIdPrefix = idSchema . $id + idSeparator + index ;
789
802
const itemIdSchema = schemaUtils . toIdSchema ( itemSchema , itemIdPrefix , itemCast , idPrefix , idSeparator ) ;
803
+
804
+ // Create path schema for array item with segments
805
+ const itemPathSegments : PathSegment [ ] = [ ...( pathSchema ?. $segments || [ ] ) , { type : 'array' , key : index } ] ;
806
+
807
+ const itemPathSchema : PathSchema < T > = {
808
+ $name : `${ pathSchema ?. $name || '' } .${ index } ` ,
809
+ $segments : itemPathSegments ,
810
+ } ;
811
+
790
812
// Compute the item UI schema - handle both static and dynamic cases
791
813
let itemUiSchema : UiSchema < T [ ] , S , F > | undefined ;
792
814
if ( additional ) {
@@ -816,6 +838,7 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
816
838
itemData : itemCast ,
817
839
itemUiSchema,
818
840
itemIdSchema,
841
+ itemPathSchema,
819
842
itemErrorSchema,
820
843
autofocus : autofocus && index === 0 ,
821
844
onBlur,
@@ -857,6 +880,7 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
857
880
itemData : T [ ] ;
858
881
itemUiSchema : UiSchema < T [ ] , S , F > | undefined ;
859
882
itemIdSchema : IdSchema < T [ ] > ;
883
+ itemPathSchema ?: PathSchema < T > ;
860
884
itemErrorSchema ?: ErrorSchema < T [ ] > ;
861
885
autofocus ?: boolean ;
862
886
onBlur : FieldProps < T [ ] , S , F > [ 'onBlur' ] ;
@@ -876,6 +900,7 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
876
900
itemData,
877
901
itemUiSchema,
878
902
itemIdSchema,
903
+ itemPathSchema,
879
904
itemErrorSchema,
880
905
autofocus,
881
906
onBlur,
@@ -914,6 +939,7 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
914
939
idPrefix = { idPrefix }
915
940
idSeparator = { idSeparator }
916
941
idSchema = { itemIdSchema }
942
+ pathSchema = { itemPathSchema }
917
943
required = { this . isItemRequired ( itemSchema ) }
918
944
onChange = { this . onChangeForIndex ( index ) }
919
945
onBlur = { onBlur }
0 commit comments