15766: Clicking on a property chip copies its text to clipboard
[arvados-workbench2.git] / src / views-components / resource-properties-form / property-key-field.tsx
index 18be627e025d29f9eebe3a5514d246cdb27d2ff3..3fb2d377aeff56574a06a919f2f33e3aea5f142e 100644 (file)
@@ -4,11 +4,11 @@
 
 import * as React from 'react';
 import { WrappedFieldProps, Field } from 'redux-form';
-import { identity, memoize } from 'lodash';
+import { memoize } from 'lodash';
 import { Autocomplete } from '~/components/autocomplete/autocomplete';
 import { Vocabulary } from '~/models/vocabulary';
-import { require } from '~/validators/require';
-import { ITEMS_PLACEHOLDER, connectVocabulary, VocabularyProp, hasError, getErrorMsg, handleBlur, buildProps } from '~/views-components/resource-properties-form/property-field-common';
+import { connectVocabulary, VocabularyProp, buildProps } from '~/views-components/resource-properties-form/property-field-common';
+import { TAG_KEY_VALIDATION } from '~/validators/validators';
 
 export const PROPERTY_KEY_FIELD_NAME = 'key';
 
@@ -20,7 +20,7 @@ export const PropertyKeyField = connectVocabulary(
             vocabulary={vocabulary}
             validate={getValidation(vocabulary)} />);
 
-const PropertyKeyInput = ({ vocabulary, ...props }: WrappedFieldProps & VocabularyProp) =>
+export const PropertyKeyInput = ({ vocabulary, ...props }: WrappedFieldProps & VocabularyProp) =>
     <Autocomplete
         label='Key'
         suggestions={getSuggestions(props.input.value, vocabulary)}
@@ -30,8 +30,8 @@ const PropertyKeyInput = ({ vocabulary, ...props }: WrappedFieldProps & Vocabula
 const getValidation = memoize(
     (vocabulary: Vocabulary) =>
         vocabulary.strict
-            ? [require, matchTags(vocabulary)]
-            : [require]);
+            ? [...TAG_KEY_VALIDATION, matchTags(vocabulary)]
+            : TAG_KEY_VALIDATION);
 
 const matchTags = (vocabulary: Vocabulary) =>
     (value: string) =>