import { connect } from 'react-redux';
import { WrappedFieldMetaProps, WrappedFieldInputProps, WrappedFieldProps } from 'redux-form';
-import { identity } from 'lodash';
-import { Vocabulary } from '~/models/vocabulary';
+import { Vocabulary, PropFieldSuggestion } from '~/models/vocabulary';
import { RootState } from '~/store/store';
-import { getVocabulary } from '~/store/vocabulary/vocabulary-selctors';
+import { getVocabulary } from '~/store/vocabulary/vocabulary-selectors';
export interface VocabularyProp {
vocabulary: Vocabulary;
() =>
onBlur(value);
-export const buildProps = ({ input, meta }: WrappedFieldProps) => ({
- value: input.value,
- onChange: input.onChange,
- onBlur: handleBlur(input),
- items: ITEMS_PLACEHOLDER,
- onSelect: input.onChange,
- renderSuggestion: identity,
- error: hasError(meta),
- helperText: getErrorMsg(meta),
-});
+export const buildProps = ({ input, meta }: WrappedFieldProps) => {
+ return {
+ value: input.value,
+ onChange: input.onChange,
+ onBlur: handleBlur(input),
+ items: ITEMS_PLACEHOLDER,
+ renderSuggestion: (item:PropFieldSuggestion) => item.label,
+ error: hasError(meta),
+ helperText: getErrorMsg(meta),
+ };
+};