@@ -8,7 +8,8 @@ import { BasicWrapper } from "./basicWrapper";
88import { option } from '../Option' ;
99import { type } from '../type' ;
1010import { cleanHash , isDefined } from '../utils' ;
11- import { ConditionnalSchema , Informations , SchemaEntry , SchemaRenderType } from "./types" ;
11+ import { ConditionnalSchema , Informations , Schema , SchemaEntry , SchemaRenderType } from "./types" ;
12+ import { cleanOutputArray } from "./formUtils" ;
1213
1314const CustomizableInput = React . memo (
1415 ( props : {
@@ -46,6 +47,7 @@ interface BaseProps {
4647 deactivateReactMemo : boolean ,
4748 inputWrapper ?: ( props : object ) => JSX . Element ,
4849 defaultFormValue : any
50+ schema : Schema
4951}
5052
5153interface ComponentProps extends BaseProps {
@@ -73,7 +75,7 @@ export const ControlledInput = (inputProps: Props) => {
7375
7476 const functionalProperty = ( entry : string , prop : any ) => {
7577 if ( typeof prop === 'function' ) {
76- return prop ( { rawValues : getValues ( ) , value : getValues ( entry ) , defaultFormValue, informations, error, getValue : ( key : string ) => getValues ( key ) } ) ;
78+ return prop ( { rawValues : cleanOutputArray ( getValues ( ) , inputProps . schema ) , value : getValues ( entry ) , defaultFormValue, informations, error, getValue : ( key : string ) => getValues ( key ) } ) ;
7779 } else {
7880 return prop ;
7981 }
@@ -102,7 +104,7 @@ export const ControlledInput = (inputProps: Props) => {
102104 } ) ( )
103105 field . onChange ( value )
104106 option ( step . onChange )
105- . map ( onChange => onChange ( { rawValues : getValues ( ) , value, setValue } ) )
107+ . map ( onChange => onChange ( { rawValues : cleanOutputArray ( getValues ( ) , inputProps . schema ) , value, setValue } ) )
106108 } ,
107109 value : field . value ,
108110 }
@@ -153,7 +155,7 @@ export const ControlledInput = (inputProps: Props) => {
153155 < CustomizableInput
154156 render = { step . render }
155157 step = { step }
156- field = { { setValue : ( key : string , value : any ) => setValue ( key , value ) , rawValues : getValues ( ) , getValue : ( key : string ) => getValues ( key ) , ...field } }
158+ field = { { setValue : ( key : string , value : any ) => setValue ( key , value ) , rawValues : cleanOutputArray ( getValues ( ) , inputProps . schema ) , getValue : ( key : string ) => getValues ( key ) , ...field } }
157159 error = { error } errorDisplayed = { errorDisplayed }
158160 informations = { informations }
159161 deactivateReactMemo = { deactivateReactMemo } >
0 commit comments