X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/9a37cc202448e431064b247d36ac0229a6bfa9b2..e125aa439a61755852c3bd16412e2fb621aa58c2:/src/components/autocomplete/autocomplete.tsx diff --git a/src/components/autocomplete/autocomplete.tsx b/src/components/autocomplete/autocomplete.tsx index 4b19b771..0044807b 100644 --- a/src/components/autocomplete/autocomplete.tsx +++ b/src/components/autocomplete/autocomplete.tsx @@ -2,8 +2,14 @@ // // SPDX-License-Identifier: AGPL-3.0 -import * as React from 'react'; -import { Input as MuiInput, Chip as MuiChip, Popper as MuiPopper, Paper as MuiPaper, FormControl, InputLabel, StyleRulesCallback, withStyles, RootRef, ListItemText, ListItem, List, FormHelperText } from '@material-ui/core'; +import React from 'react'; +import { + Input as MuiInput, + Chip as MuiChip, + Popper as MuiPopper, + Paper as MuiPaper, + FormControl, InputLabel, StyleRulesCallback, withStyles, RootRef, ListItemText, ListItem, List, FormHelperText +} from '@material-ui/core'; import { PopperProps } from '@material-ui/core/Popper'; import { WithStyles } from '@material-ui/core/styles'; import { noop } from 'lodash'; @@ -12,6 +18,7 @@ export interface AutocompleteProps { label?: string; value: string; items: Item[]; + disabled?: boolean; suggestions?: Suggestion[]; error?: boolean; helperText?: string; @@ -61,6 +68,7 @@ export class Autocomplete extends React.Component extends React.Component onDelete ? onDelete(item, index) : undefined} /> + onDelete={onDelete && !this.props.disabled ? (() => onDelete(item, index)) : undefined} /> ); }