react-admin icon indicating copy to clipboard operation
react-admin copied to clipboard

Fix support for readOnly on all RA Inputs

Open erwanMarmelab opened this issue 1 year ago • 2 comments

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
  • - [x]
  • - [x]
AutoCompleteInput
  • - [x]
  • - [x]
AutoCompleteArrayInput
  • - [x]
  • - [x]
BooleanInput
  • - [x]
  • - [x]
NullabeBooleanInput
  • - [x]
  • - [x]
CheckboxGroupInput
  • - [x]
  • - [x]
DateInput
  • - [x]
  • - [x]
DateTimeInput
  • - [x]
  • - [x]
FileInput
  • - [x]
  • - [x]
ImageInput
  • - [x]
  • - [x]
NumberInput
  • - [x]
  • - [x]
PasswordInput
  • - [x]
  • - [x]
RadioButtonGroupInput
  • - [x]
  • - [x]
ReferenceInput
  • - [x]
  • - [x]
ReferenceArrayInput
  • - [x]
  • - [x]
RichTextInput
  • - [x]
  • - [x]
SearchInput
  • - [x]
  • - [x]
SelectInput
  • - [x]
  • - [x]
SelectArrayInput
  • - [x]
  • - [x]
SimpleFormIterator
  • - [x]
  • - [x]
TextInput
  • - [x]
  • - [x]
TimeInput
  • - [x]
  • - [x]
TranslatableInput
  • - [x]
  • - [x]

erwanMarmelab avatar Feb 09 '24 15:02 erwanMarmelab

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

Nitix avatar Feb 14 '24 15:02 Nitix

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.

erwanMarmelab avatar Feb 15 '24 15:02 erwanMarmelab