-const Input = (props: GenericInputProps) =>
- <ChipsInput
- values={props.input.value}
- onChange={props.input.onChange}
- createNewValue={v => v} />;
+class InputComponent extends React.PureComponent<GenericInputProps>{
+ render() {
+ const { commandInput, input, meta } = this.props;
+ return <ChipsInput
+ deletable={!commandInput.disabled}
+ orderable={!commandInput.disabled}
+ disabled={commandInput.disabled}
+ value={input.value}
+ onChange={this.handleChange}
+ createNewValue={identity}
+ inputComponent={Input}
+ inputProps={{
+ error: meta.error
+ }} />;
+ }
+
+ handleChange = (values: {}[]) => {
+ const { input, meta } = this.props;
+ if (!meta.touched) {
+ input.onBlur(values);
+ }
+ input.onChange(values);
+ }
+}