-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate AutocompleteArrayInput to MUI Autocomplete #6971
Conversation
djhi
commented
Dec 10, 2021
•
edited
Loading
edited
- Implementation
- Tests
- Stories
- Documentation
- Upgrade guide
- Refactor
- Remove options prop
The storybook isn't deployed by Vercel, is it normal? |
docs/Inputs.md
Outdated
@@ -647,7 +647,7 @@ If you want to limit the initial choices shown to the current value only, you ca | |||
When dealing with a large amount of `choices` you may need to limit the number of suggestions that are rendered in order to maintain usable performance. The `shouldRenderSuggestions` is an optional prop that allows you to set conditions on when to render suggestions. An easy way to improve performance would be to skip rendering until the user has entered 2 or 3 characters in the search box. This lowers the result set significantly, and might be all you need (depending on your data set). | |||
Ex. `<AutocompleteInput shouldRenderSuggestions={(val) => { return val.trim().length > 2 }} />` would not render any suggestions until the 3rd character has been entered. This prop is passed to the underlying `react-autosuggest` component and is documented [here](https://github.com/moroshko/react-autosuggest#should-render-suggestions-prop). | |||
|
|||
`<AutocompleteInput>` renders a [material-ui `<TextField>` component](https://material-ui.com/api/text-field/). Use the `options` attribute to override any of the `<TextField>` attributes: | |||
`<AutocompleteInput>` renders a [material-ui `<Autocomplete>` component](https://mui.com/components/autocomplete/). Use the `options` attribute to override any of the `<Autocomplete>` attributes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought you removed that possibility
useSupportCreateSuggestion, | ||
} from './useSupportCreateSuggestion'; | ||
|
||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should keep some jsDoc, at least to explain that it's deprecated
packages/ra-ui-materialui/src/input/useSupportCreateSuggestion.tsx
Outdated
Show resolved
Hide resolved
@@ -407,10 +457,74 @@ If you provided a React element for the optionText prop, you must also provide t | |||
); | |||
}; | |||
|
|||
export interface AutocompleteInputProps | |||
extends ChoicesInputProps<AutocompleteProps<any, false, false, false>>, | |||
// @ts-ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the ignore?
}, | ||
})); | ||
export const AutocompleteArrayInput = props => ( | ||
<AutocompleteInput multiple {...props} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<AutocompleteInput multiple {...props} /> | |
<AutocompleteInput {...props} multiple /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just in case
66268f8
to
1ef0bf6
Compare