vocabulary: getVocabulary(state.properties),
});
+export const PROPERTY_KEY_FIELD_NAME = 'key';
+
export const PropertyKeyField = connect(mapStateToProps)(
({ vocabulary }: VocabularyProp) =>
<Field
- name='key'
+ name={PROPERTY_KEY_FIELD_NAME}
component={PropertyKeyInput}
vocabulary={vocabulary}
validate={getValidation(vocabulary)} />);
? undefined
: 'Incorrect key';
-const getSuggestions = (value: string, vocabulary: Vocabulary) =>
+const getSuggestions = (value: string, vocabulary: Vocabulary) =>
getTagsList(vocabulary).filter(tag => tag.includes(value) && tag !== value);
const getTagsList = ({ tags }: Vocabulary) =>
import { Autocomplete } from '~/components/autocomplete/autocomplete';
import { Vocabulary } from '~/models/vocabulary';
import { require } from '~/validators/require';
+import { PROPERTY_KEY_FIELD_NAME } from '~/views-components/resource-properties-form/property-key-field';
interface VocabularyProp {
vocabulary: Vocabulary;
export const PropertyValueField = compose(
connect(mapStateToProps),
- formValues({ propertyKey: 'key' })
+ formValues({ propertyKey: PROPERTY_KEY_FIELD_NAME })
)(
(props: PropertyValueFieldProps) =>
<Field