Skip to content

Commit

Permalink
fix: show choices when it's typed with string[] or expression (#2334)
Browse files Browse the repository at this point in the history
* fix🐞(uischema): fix choices string
According to sdk.schema, the 'choices' field of 'Microsoft.ChoiceInput' could be either object list or string list. Make Visual Editor support both of those formats.
#2319

* fix🐞(uischema):dynamic choices
According to sdk definition, 'choices' could be an expression string.

Co-authored-by: Andy Brown <asbrown002@gmail.com>
  • Loading branch information
yeze322 and a-b-r-o-w-n authored Mar 23, 2020
1 parent b6525eb commit 45f673c
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,18 @@ const BaseInputSchema: UIWidget = {
data.$type === SDKTypes.ChoiceInput && Array.isArray(data.choices) && data.choices.length ? (
<ListOverview
items={data.choices}
renderItem={item => (
<BorderedDiv height={20} title={item.value}>
{item.value}
</BorderedDiv>
)}
renderItem={item => {
const value = typeof item === 'object' ? item.value : item;
return (
<BorderedDiv height={20} title={value}>
{value}
</BorderedDiv>
);
}}
/>
) : null,
) : (
<>{data.choices}</>
),
footer: data =>
data.property ? (
<>
Expand Down

0 comments on commit 45f673c

Please sign in to comment.