Commit 4816d234 by heheer Committed by GitHub

compatible with old enums\ (#5221)

parent 4275de96
...@@ -385,7 +385,7 @@ const TableItem = ({ ...@@ -385,7 +385,7 @@ const TableItem = ({
onClick={() => { onClick={() => {
const formattedItem = { const formattedItem = {
...item, ...item,
list: item.enums || [] list: item.enums?.map((item) => ({ label: item.value, value: item.value })) || []
}; };
reset(formattedItem); reset(formattedItem);
}} }}
......
...@@ -100,11 +100,14 @@ const InputRender = (props: InputRenderProps) => { ...@@ -100,11 +100,14 @@ const InputRender = (props: InputRenderProps) => {
} }
if (inputType === InputTypeEnum.select) { if (inputType === InputTypeEnum.select) {
return <MySelect {...commonProps} list={props.list || []} h={10} />; const list =
props.list || props.enums?.map((item) => ({ label: item.value, value: item.value })) || [];
return <MySelect {...commonProps} list={list} h={10} />;
} }
if (inputType === InputTypeEnum.multipleSelect) { if (inputType === InputTypeEnum.multipleSelect) {
const { list = [] } = props; const list =
props.list || props.enums?.map((item) => ({ label: item.value, value: item.value })) || [];
return ( return (
<MultipleSelect<string> <MultipleSelect<string>
{...commonProps} {...commonProps}
......
...@@ -40,6 +40,9 @@ type SpecificProps = ...@@ -40,6 +40,9 @@ type SpecificProps =
// select & multipleSelect // select & multipleSelect
inputType: InputTypeEnum.select | InputTypeEnum.multipleSelect; inputType: InputTypeEnum.select | InputTypeEnum.multipleSelect;
list?: { label: string; value: string }[]; list?: { label: string; value: string }[];
// old version
enums?: { value: string }[];
} }
| { | {
// JSONEditor // JSONEditor
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment