import { InputProps } from '@material-ui/core/Input';
interface ChipsInputProps<Value> {
- value: Value[];
+ values: Value[];
getLabel?: (value: Value) => string;
onChange: (value: Value[]) => void;
createNewValue: (value: string) => Value;
if (this.state.text) {
const newValue = this.props.createNewValue(this.state.text);
this.setState({ text: '' });
- this.props.onChange([...this.props.value, newValue]);
+ this.props.onChange([...this.props.values, newValue]);
}
}
deleteLastValue = () => {
- if (this.state.text.length === 0 && this.props.value.length > 0) {
- this.props.onChange(this.props.value.slice(0, -1));
+ if (this.state.text.length === 0 && this.props.values.length > 0) {
+ this.props.onChange(this.props.values.slice(0, -1));
}
}
}
renderChips() {
- const { classes, value, ...props } = this.props;
+ const { classes, ...props } = this.props;
return <div className={classes.chips}>
<Chips
{...props}
clickable={!props.disabled}
- values={value}
filler={<div ref={this.filler} />}
/>
</div>;
}
componentDidUpdate(prevProps: ChipsInputProps<Value>) {
- if (prevProps.value !== this.props.value) {
+ if (prevProps.values !== this.props.values) {
this.updateCursorPosition();
}
}
deletable={!commandInput.disabled}
orderable={!commandInput.disabled}
disabled={commandInput.disabled}
- value={input.value}
+ values={input.value}
onChange={this.handleChange}
createNewValue={parseFloat}
inputComponent={FloatInput}
deletable={!commandInput.disabled}
orderable={!commandInput.disabled}
disabled={commandInput.disabled}
- value={input.value}
+ values={input.value}
onChange={this.handleChange}
createNewValue={value => parseInt(value, 10)}
inputComponent={IntInput}