Skip to content

Commit

Permalink
Merge pull request #677 from SUI-Components/feat/MMAA-42893-use-rende…
Browse files Browse the repository at this point in the history
…rer-datalist

feat(components/form/builder): use datalist from renderer prop
  • Loading branch information
codemaoz90 authored Dec 3, 2024
2 parents e91b00b + a7ec502 commit bce5f64
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions components/form/builder/src/Select/Default/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ const DefaultSelect = ({
// render custom component
if (isValidElement(rendererResponse)) return rendererResponse

const nextDataList = rendererResponse?.dataList || datalist

// render SUI component
return (
<div className={`sui-FormBuilder-field sui-FormBuilder-DefaultSelect sui-FormBuilder-${selectProps.id}`}>
Expand All @@ -119,14 +121,9 @@ const DefaultSelect = ({
)}

<MoleculeSelectField {...selectProps} {...rendererResponse} multiselection={multiselection}>
{datalist.map(data => (
<MoleculeSelectOption
key={data.value}
value={data.value}
description={data.description}
leftAddon={data.leftAddon}
>
{data.text}
{nextDataList.map(({value, text, description, leftAddon, ...others}) => (
<MoleculeSelectOption key={value} value={value} description={description} leftAddon={leftAddon} {...others}>
{text}
</MoleculeSelectOption>
))}
</MoleculeSelectField>
Expand Down

0 comments on commit bce5f64

Please sign in to comment.