From daa933a70d99031a27e08538161186e6f8886036 Mon Sep 17 00:00:00 2001 From: gitstart Date: Thu, 13 Jul 2023 10:14:23 +0000 Subject: [PATCH] revert change - change docs Co-authored-by: gitstart Co-authored-by: passy4ucj Co-authored-by: gitstart_bot --- docs/AutocompleteArrayInput.md | 17 ----------------- .../src/input/AutocompleteInput.tsx | 2 +- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/docs/AutocompleteArrayInput.md b/docs/AutocompleteArrayInput.md index ecd7dca3b5c..af019050e03 100644 --- a/docs/AutocompleteArrayInput.md +++ b/docs/AutocompleteArrayInput.md @@ -63,7 +63,6 @@ The form value for the source must be an array of the selected values, e.g. | `createLabel` | Optional | `string` | `ra.action. create` | The label for the menu item allowing users to create a new choice. Used when the filter is empty | | `createItemLabel` | Optional | `string` | `ra.action .create_item` | The label for the menu item allowing users to create a new choice. Used when the filter is not empty | | `debounce` | Optional | `number` | `250` | The delay to wait before calling the setFilter function injected when used in a ReferenceArray Input. | -| `emptyText` | Optional | `string` | `''` | The text to use for the empty element | | `emptyValue` | Optional | `any` | `''` | The value to use for the empty element | | `filterToQuery` | Optional | `string` => `Object` | `q => ({ q })` | How to transform the searchText into a parameter for the data provider | | `inputText` | Optional | `Function` | `-` | Required if `optionText` is a custom Component, this function must return the text displayed for the current selection. | @@ -228,22 +227,6 @@ This delay can be customized by setting the `debounce` prop. ``` -## `emptyText` - -If the input isn't required (using `validate={required()}`), and you need a choice to represent the empty value, set `emptyText` prop and a choice will be added at the top, with its value as label. - -```jsx - -``` - -The `emptyText` prop accepts either a string or a React Element. - -And if you want to hide that empty choice, make the input required. - -```jsx - -``` - ## `emptyValue` If the input isn't required (using `validate={required()}`), users can select an empty choice. The default value for that empty choice is the empty string (`''`), or `null` if the input is inside a [``](./ReferenceArrayInput.md). diff --git a/packages/ra-ui-materialui/src/input/AutocompleteInput.tsx b/packages/ra-ui-materialui/src/input/AutocompleteInput.tsx index 5fa7bac92ba..7496f2d8522 100644 --- a/packages/ra-ui-materialui/src/input/AutocompleteInput.tsx +++ b/packages/ra-ui-materialui/src/input/AutocompleteInput.tsx @@ -222,7 +222,7 @@ export const AutocompleteInput = < const finalChoices = useMemo( () => // eslint-disable-next-line eqeqeq - emptyText == undefined || isRequired + emptyText == undefined || isRequired || multiple ? allChoices : [ {