ux: admin: clearly state when a multiselect has no options
Massimo Melina committed
Mar 2, 2024 at 11:42 UTC
08c5ada8977f7a0cfce0c2f0e20e02686a4acc59
1 file changed
+2
-1
mui-grid-form/SelectField.ts
+2
-1
@@ -80,7 +80,8 @@ export function MultiSelectField<T>({ renderOption, ...props }: MultiSelectField
80
}),
81
...rest,
82
},
83
- h(Button, {
83
+ !normalizedOptions.length && h(ListItemText, { sx: { fontStyle: 'italic', ml: 1 }, onClickCapture(ev) { ev.stopPropagation() } }, "No options available"),
84
+ normalizedOptions.length > 1 && h(Button, {
85
ref: x => x && Object.assign(x, { role: undefined }), // cancel the role=option on this
86
onClickCapture(event) {
87
event.stopPropagation()