fix: dataSource in select readPretty is missing (#3574)
This commit is contained in:
parent
28222fce99
commit
fc5e67d96b
@ -5,6 +5,7 @@ import { Checkbox as AntdCheckbox, Tag } from 'antd';
|
||||
import type { CheckboxGroupProps, CheckboxProps } from 'antd/es/checkbox';
|
||||
import uniq from 'lodash/uniq';
|
||||
import React from 'react';
|
||||
import { useCollectionField } from '../../../collection-manager';
|
||||
import { EllipsisWithTooltip } from '../input/EllipsisWithTooltip';
|
||||
|
||||
type ComposedCheckbox = React.ForwardRefExoticComponent<
|
||||
@ -50,7 +51,8 @@ Checkbox.Group = connect(
|
||||
return null;
|
||||
}
|
||||
const field = useField<any>();
|
||||
const dataSource = field.dataSource || [];
|
||||
const { uiSchema } = useCollectionField();
|
||||
const dataSource = field.dataSource || uiSchema.enum || [];
|
||||
const value = uniq(field.value ? field.value : []);
|
||||
return (
|
||||
<EllipsisWithTooltip ellipsis={props.ellipsis}>
|
||||
|
@ -3,6 +3,7 @@ import { isValid } from '@formily/shared';
|
||||
import { Radio as AntdRadio, Tag } from 'antd';
|
||||
import type { RadioGroupProps, RadioProps } from 'antd/es/radio';
|
||||
import React from 'react';
|
||||
import { useCollectionField } from '../../../collection-manager';
|
||||
|
||||
type ComposedRadio = React.FC<RadioProps> & {
|
||||
Group?: React.FC<RadioGroupProps>;
|
||||
@ -29,7 +30,8 @@ Radio.Group = connect(
|
||||
}
|
||||
const { value } = props;
|
||||
const field = useField<any>();
|
||||
const dataSource = field.dataSource || [];
|
||||
const { uiSchema } = useCollectionField();
|
||||
const dataSource = field.dataSource || uiSchema.enum || [];
|
||||
return (
|
||||
<div>
|
||||
{dataSource
|
||||
|
@ -5,6 +5,7 @@ import { Tag } from 'antd';
|
||||
import React from 'react';
|
||||
import { EllipsisWithTooltip } from '../input/EllipsisWithTooltip';
|
||||
import { defaultFieldNames, getCurrentOptions } from './utils';
|
||||
import { useCollectionField } from '../../../collection-manager';
|
||||
|
||||
export const ReadPretty = observer(
|
||||
(props: any) => {
|
||||
@ -17,7 +18,8 @@ export const ReadPretty = observer(
|
||||
if (isArrayField(field) && field?.value?.length === 0) {
|
||||
return <div />;
|
||||
}
|
||||
const dataSource = field.dataSource || props.options || [];
|
||||
const { uiSchema } = useCollectionField();
|
||||
const dataSource = field.dataSource || props.options || uiSchema.enum || [];
|
||||
const currentOptions = getCurrentOptions(field.value, dataSource, fieldNames);
|
||||
|
||||
return (
|
||||
|
Loading…
Reference in New Issue
Block a user