File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
packages/ra-ui-materialui/src/input Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,24 @@ export const CustomRemoveIcon = () => (
114114 </ Wrapper >
115115) ;
116116
117+ export const OnChange = ( { onChange = console . log } ) => (
118+ < Wrapper >
119+ < FileInput source = "attachment" onChange = { onChange } >
120+ < FileField source = "src" title = "title" />
121+ </ FileInput >
122+ < FormInspector name = "attachment" />
123+ </ Wrapper >
124+ ) ;
125+
126+ export const OnChangeMultiple = ( { onChange = console . log } ) => (
127+ < Wrapper >
128+ < FileInput source = "attachment" onChange = { onChange } multiple >
129+ < FileField source = "src" title = "title" />
130+ </ FileInput >
131+ < FormInspector name = "attachment" />
132+ </ Wrapper >
133+ ) ;
134+
117135const i18nProvider = polyglotI18nProvider ( ( ) => englishMessages ) ;
118136
119137const Wrapper = ( { children } ) => (
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ export const FileInput = (props: FileInputProps) => {
4040 labelMultiple = 'ra.input.file.upload_several' ,
4141 labelSingle = 'ra.input.file.upload_single' ,
4242 options = { } ,
43+ onChange : onChangeProp ,
4344 onRemove : onRemoveProp ,
4445 parse,
4546 placeholder,
@@ -95,6 +96,7 @@ export const FileInput = (props: FileInputProps) => {
9596 validate,
9697 disabled,
9798 readOnly,
99+ onChange : onChangeProp ,
98100 ...rest ,
99101 } ) ;
100102 const { error, invalid } = fieldState ;
You can’t perform that action at this time.
0 commit comments