Fixed empty default values extra field range breaking page
Resolves #652
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
import { PlusOutlined } from "@ant-design/icons";
|
||||
import { useTranslate } from "@refinedev/core";
|
||||
import {
|
||||
Button,
|
||||
Checkbox,
|
||||
Flex,
|
||||
Form,
|
||||
FormInstance,
|
||||
Input,
|
||||
InputNumber,
|
||||
Popconfirm,
|
||||
Select,
|
||||
Space,
|
||||
Table,
|
||||
message,
|
||||
Button,
|
||||
Checkbox,
|
||||
Flex,
|
||||
Form,
|
||||
FormInstance,
|
||||
Input,
|
||||
InputNumber,
|
||||
Popconfirm,
|
||||
Select,
|
||||
Space,
|
||||
Table,
|
||||
message,
|
||||
} from "antd";
|
||||
import { FormItemProps, Rule } from "antd/es/form";
|
||||
import { ColumnType } from "antd/es/table";
|
||||
@@ -488,10 +488,16 @@ export function ExtraFieldsSettings() {
|
||||
} else if (Array.isArray(val) && record.field.field_type === FieldType.choice) {
|
||||
return val.join(", ");
|
||||
} else if (
|
||||
(Array.isArray(val) && record.field.field_type === FieldType.integer_range) ||
|
||||
record.field.field_type === FieldType.float_range
|
||||
Array.isArray(val) && (
|
||||
record.field.field_type === FieldType.integer_range || record.field.field_type === FieldType.float_range
|
||||
)
|
||||
) {
|
||||
return `${val[0]} \u2013 ${val[1]}`;
|
||||
let lower = val[0] ?? "";
|
||||
let upper = val[1] ?? "";
|
||||
if (lower === "" && upper === "") {
|
||||
return null;
|
||||
}
|
||||
return `${lower} \u2013 ${upper}`;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user