react-admin
react-admin copied to clipboard
Fix support for readOnly on all RA Inputs
Problem
warnWhenUnsavedChanges does not function properly with disabled inputs · Issue #9498 · marmelab/react-admin highlighted that not all our inputs support the readOnly prop.
For instance <ArrayInput> is still modifiable even with this prop.
We need to fix the support for this prop on all RA inputs, because it is not the same as disabled and we should support both.
Solution
When a developer passes readOnly, we pass readOnly to useInput and disabled to MUI.
Note that some inputs may not yet support readOnly or disabled
Out of scope
Fix the style of the inputs to make it clear that inputs with readOnly cannot be changed → this can be done in user-land (with sx for now)
Todos
| Input | Story | Prop |
|---|---|---|
| ArrayInput |
|
|
| AutoCompleteInput |
|
|
| AutoCompleteArrayInput |
|
|
| BooleanInput |
|
|
| NullabeBooleanInput |
|
|
| CheckboxGroupInput |
|
|
| DateInput |
|
|
| DateTimeInput |
|
|
| FileInput |
|
|
| ImageInput |
|
|
| NumberInput |
|
|
| PasswordInput |
|
|
| RadioButtonGroupInput |
|
|
| ReferenceInput |
|
|
| ReferenceArrayInput |
|
|
| RichTextInput |
|
|
| SearchInput |
|
|
| SelectInput |
|
|
| SelectArrayInput |
|
|
| SimpleFormIterator |
|
|
| TextInput |
|
|
| TimeInput |
|
|
| TranslatableInput |
|
|
In AutoCompleteInput the field appears two times.
Isn't DatagridInput missing ?
FileInput, ImageInput is missing some visual differences to display it as a read only input
In AutoCompleteInput the field appears two times.
Isn't DatagridInput missing ?
FileInput, ImageInput is missing some visual differences to display it as a read only input
Yes DatagridInput is missing. We will not support readOnly and disabled in this component for the moment.