diff --git a/invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/CustomAwardForm.js b/invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/CustomAwardForm.js index 918167e7..0161811b 100644 --- a/invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/CustomAwardForm.js +++ b/invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/CustomAwardForm.js @@ -12,6 +12,8 @@ import { TextField, RemoteSelectField } from "react-invenio-forms"; import { i18next } from "@translations/invenio_rdm_records/i18next"; import _isEmpty from "lodash/isEmpty"; +import Overridable from "react-overridable"; + function CustomAwardForm({ deserializeFunder, selectedFunding }) { function deserializeFunderToDropdown(funderItem) { let funderName = null; @@ -53,64 +55,85 @@ function CustomAwardForm({ deserializeFunder, selectedFunding }) { return (
- { - return funders.map((funder) => - deserializeFunderToDropdown(deserializeFunder(funder)) - ); - }} - searchInput={{ - autoFocus: _isEmpty(selectedFunding), - }} - label={i18next.t("Funder")} - noQueryMessage={i18next.t("Search for funder...")} - clearable - allowAdditions={false} - multiple={false} - selectOnBlur={false} - selectOnNavigation={false} - required - search={(options) => options} - isFocused - onValueChange={({ formikProps }, selectedFundersArray) => { - if (selectedFundersArray.length === 1) { - const selectedFunder = selectedFundersArray[0]; - if (selectedFunder) { - const deserializedFunder = serializeFunderFromDropdown(selectedFunder); - formikProps.form.setFieldValue( - "selectedFunding.funder", - deserializedFunder - ); + > + { + return funders.map((funder) => + deserializeFunderToDropdown(deserializeFunder(funder)) + ); + }} + searchInput={{ + autoFocus: _isEmpty(selectedFunding), + }} + label={i18next.t("Funder")} + noQueryMessage={i18next.t("Search for funder...")} + clearable + allowAdditions={false} + multiple={false} + selectOnBlur={false} + selectOnNavigation={false} + required + search={(options) => options} + isFocused + onValueChange={({ formikProps }, selectedFundersArray) => { + if (selectedFundersArray.length === 1) { + const selectedFunder = selectedFundersArray[0]; + if (selectedFunder) { + const deserializedFunder = serializeFunderFromDropdown(selectedFunder); + formikProps.form.setFieldValue( + "selectedFunding.funder", + deserializedFunder + ); + } } - } - }} - /> - -
- {i18next.t("Award information")} ({i18next.t("optional")}) -
+ }} + /> + + +
+ {i18next.t("Award information")} ({i18next.t("optional")}) +
+
- - + + + - + + + + > + + ); diff --git a/invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingField.js b/invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingField.js index 819c4dd6..62d424f1 100644 --- a/invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingField.js +++ b/invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingField.js @@ -18,6 +18,8 @@ import FundingModal from "./FundingModal"; import { i18next } from "@translations/invenio_rdm_records/i18next"; +import Overridable from "react-overridable"; + function FundingFieldForm(props) { const { label, @@ -108,46 +110,52 @@ function FundingFieldForm(props) { ); })} - - - {i18next.t("Add award")} - - } - onAwardChange={(selectedFunding) => { - formikArrayPush(selectedFunding); - }} - mode="standard" - action="add" - deserializeAward={deserializeAward} - deserializeFunder={deserializeFunder} - computeFundingContents={computeFundingContents} - /> - - - {i18next.t("Add custom")} - - } - onAwardChange={(selectedFunding) => { - formikArrayPush(selectedFunding); - }} - mode="custom" - action="add" - deserializeAward={deserializeAward} - deserializeFunder={deserializeFunder} - computeFundingContents={computeFundingContents} - /> + + + + + {i18next.t("Add award")} + + } + onAwardChange={(selectedFunding) => { + formikArrayPush(selectedFunding); + }} + mode="standard" + action="add" + deserializeAward={deserializeAward} + deserializeFunder={deserializeFunder} + computeFundingContents={computeFundingContents} + /> + + + + + + {i18next.t("Add custom")} + + } + onAwardChange={(selectedFunding) => { + formikArrayPush(selectedFunding); + }} + mode="custom" + action="add" + deserializeAward={deserializeAward} + deserializeFunder={deserializeFunder} + computeFundingContents={computeFundingContents} + /> + );