Skip to content

Commit

Permalink
form: add dropdown specific props
Browse files Browse the repository at this point in the history
  • Loading branch information
kpsherva committed Sep 26, 2024
1 parent 93ac736 commit a263804
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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 };
};
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand All @@ -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,
Expand Down

0 comments on commit a263804

Please sign in to comment.