diff --git a/invenio_administration/assets/semantic-ui/js/invenio_administration/src/formik/fields/dropdown.js b/invenio_administration/assets/semantic-ui/js/invenio_administration/src/formik/fields/dropdown.js new file mode 100644 index 0000000..1ad2108 --- /dev/null +++ b/invenio_administration/assets/semantic-ui/js/invenio_administration/src/formik/fields/dropdown.js @@ -0,0 +1,24 @@ +import { generateFieldProps } from "./props_generator"; + +export const generateDropdownFieldProps = ( + fieldName, + fieldSchema, + parentField, + isCreate, + formFieldConfig, + formikProps, + formFieldsConfig +) => { + const fieldProps = generateFieldProps( + fieldName, + fieldSchema, + parentField, + isCreate, + formFieldConfig, + formikProps + ); + const arrayFieldProps = { + defaultValue: formFieldConfig.dump_default, + }; + return { ...fieldProps, ...arrayFieldProps }; +}; diff --git a/invenio_administration/assets/semantic-ui/js/invenio_administration/src/formik/fields/fields.js b/invenio_administration/assets/semantic-ui/js/invenio_administration/src/formik/fields/fields.js index d91de62..4700719 100644 --- a/invenio_administration/assets/semantic-ui/js/invenio_administration/src/formik/fields/fields.js +++ b/invenio_administration/assets/semantic-ui/js/invenio_administration/src/formik/fields/fields.js @@ -18,6 +18,7 @@ import { AdminBoolField, generateBoolFieldProps } from "./bool"; import { generateFieldProps } from "./props_generator"; import { generateVocabularyFieldProps } from "./vocabulary"; import { generateArrayFieldProps } from "./array"; +import { generateDropdownFieldProps } from "./dropdown"; const fieldsMap = { string: { element: Input, props: generateFieldProps }, @@ -30,7 +31,7 @@ const fieldsMap = { vocabulary: { element: AutocompleteDropdown, props: generateVocabularyFieldProps }, dynamic: { element: DynamicSubFormField, props: generateDynamicFieldProps }, object: { element: ObjectField, props: generateObjectFieldProps }, - dropdown: { element: Dropdown, props: generateFieldProps }, + dropdown: { element: Dropdown, props: generateDropdownFieldProps }, textarea: { element: TextArea, props: generateFieldProps }, html: { element: RichInput, props: generateFieldProps }, function: null,