Skip to content

Commit 2882c01

Browse files
committed
Add disableValue to type ChoicesProps and refactor componentes using ChoicesProps
1 parent 776c0ab commit 2882c01

File tree

8 files changed

+8
-8
lines changed

8 files changed

+8
-8
lines changed

packages/ra-core/src/form/choices/useChoices.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export interface ChoicesProps {
2020
optionValue?: string;
2121
optionText?: OptionText;
2222
translateChoice?: boolean;
23+
disableValue?: string;
2324
}
2425

2526
export interface UseChoicesOptions {

packages/ra-ui-materialui/src/field/SelectField.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export const SelectField = genericMemo(SelectFieldImpl);
138138

139139
export interface SelectFieldProps<
140140
RecordType extends Record<string, any> = Record<string, any>,
141-
> extends ChoicesProps,
141+
> extends Omit<ChoicesProps, 'disableValue'>,
142142
FieldProps<RecordType>,
143143
Omit<TypographyProps, 'textAlign'> {}
144144

packages/ra-ui-materialui/src/input/AutocompleteInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ export interface AutocompleteInputProps<
780780
DisableClearable extends boolean | undefined = false,
781781
SupportCreate extends boolean | undefined = false,
782782
> extends Omit<CommonInputProps, 'source' | 'onChange'>,
783-
ChoicesProps,
783+
Omit<ChoicesProps, 'disableValue'>,
784784
UseSuggestionsOptions,
785785
Omit<SupportCreateSuggestionOptions, 'handleChange' | 'optionText'>,
786786
Omit<

packages/ra-ui-materialui/src/input/DatagridInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ export type DatagridInputProps = Omit<
177177
CommonInputProps,
178178
'source' | 'readOnly' | 'disabled'
179179
> &
180-
ChoicesProps &
180+
Omit<ChoicesProps, 'disableValue'> &
181181
Omit<SupportCreateSuggestionOptions, 'handleChange'> &
182182
DatagridProps & {
183183
children?: ReactNode;

packages/ra-ui-materialui/src/input/RadioButtonGroupInput.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,6 @@ export type RadioButtonGroupInputProps = Omit<CommonInputProps, 'source'> &
296296
RadioGroupProps & {
297297
options?: RadioGroupProps;
298298
source?: string;
299-
disableValue?: string;
300299
};
301300

302301
const PREFIX = 'RaRadioButtonGroupInput';

packages/ra-ui-materialui/src/input/RadioButtonGroupInputItem.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,12 @@ export default RadioButtonGroupInputItem;
5454

5555
export interface RadioButtonGroupInputItemProps
5656
extends Omit<FormControlLabelProps, 'control' | 'label'>,
57-
Pick<ChoicesProps, 'optionValue' | 'optionText' | 'translateChoice'> {
57+
Pick<
58+
ChoicesProps,
59+
'optionValue' | 'optionText' | 'translateChoice' | 'disableValue'
60+
> {
5861
choice: any;
5962
source: any;
60-
disableValue?: string;
6163
}
6264

6365
const PREFIX = 'RaRadioButtonGroupInputItem';

packages/ra-ui-materialui/src/input/SelectArrayInput.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,6 @@ export type SelectArrayInputProps = ChoicesProps &
380380
Omit<CommonInputProps, 'source'> &
381381
Omit<FormControlProps, 'defaultValue' | 'onBlur' | 'onChange'> & {
382382
options?: SelectProps;
383-
disableValue?: string;
384383
source?: string;
385384
onChange?: (event: ChangeEvent<HTMLInputElement> | RaRecord) => void;
386385
};

packages/ra-ui-materialui/src/input/SelectInput.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,6 @@ export type SelectInputProps = Omit<CommonInputProps, 'source'> &
415415
ChoicesProps &
416416
Omit<SupportCreateSuggestionOptions, 'handleChange'> &
417417
Omit<TextFieldProps, 'label' | 'helperText' | 'classes' | 'onChange'> & {
418-
disableValue?: string;
419418
emptyText?: string | ReactElement;
420419
emptyValue?: any;
421420
resettable?: boolean;

0 commit comments

Comments
 (0)