compatible with old enums\ (#5221)

This commit is contained in:
heheer
2025-07-16 14:36:27 +08:00
committed by GitHub
parent 4275de96fd
commit 4816d2346b
3 changed files with 9 additions and 3 deletions

View File

@@ -385,7 +385,7 @@ const TableItem = ({
onClick={() => {
const formattedItem = {
...item,
list: item.enums || []
list: item.enums?.map((item) => ({ label: item.value, value: item.value })) || []
};
reset(formattedItem);
}}

View File

@@ -100,11 +100,14 @@ const InputRender = (props: InputRenderProps) => {
}
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) {
const { list = [] } = props;
const list =
props.list || props.enums?.map((item) => ({ label: item.value, value: item.value })) || [];
return (
<MultipleSelect<string>
{...commonProps}

View File

@@ -40,6 +40,9 @@ type SpecificProps =
// select & multipleSelect
inputType: InputTypeEnum.select | InputTypeEnum.multipleSelect;
list?: { label: string; value: string }[];
// old version
enums?: { value: string }[];
}
| {
// JSONEditor