fix: snapshot display fix (#1328)
This commit is contained in:
parent
c851e65459
commit
72e9533b7d
@ -47,9 +47,11 @@ export const ReadPrettyRecordPicker: React.FC = observer((props: any) => {
|
||||
return (
|
||||
<Fragment key={`${record.id}_${index}`}>
|
||||
<span>
|
||||
{snapshot ? (
|
||||
getLabelFormatValue(labelUiSchema, val)
|
||||
) : (
|
||||
<a
|
||||
onClick={(e) => {
|
||||
if (snapshot) return;
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
setVisible(true);
|
||||
@ -59,6 +61,7 @@ export const ReadPrettyRecordPicker: React.FC = observer((props: any) => {
|
||||
>
|
||||
{getLabelFormatValue(labelUiSchema, val)}
|
||||
</a>
|
||||
)}
|
||||
</span>
|
||||
{index < arr.length - 1 ? <span style={{ marginRight: 4, color: '#aaa' }}>,</span> : null}
|
||||
</Fragment>
|
||||
|
@ -3,6 +3,7 @@ import { observer, useField } from '@formily/react';
|
||||
import { isValid } from '@formily/shared';
|
||||
import { Tag } from 'antd';
|
||||
import React from 'react';
|
||||
import { useCompile } from '../../hooks';
|
||||
import { defaultFieldNames, getCurrentOptions } from './shared';
|
||||
|
||||
type Composed = {
|
||||
@ -13,6 +14,8 @@ type Composed = {
|
||||
export const ReadPretty = observer((props: any) => {
|
||||
const fieldNames = { ...defaultFieldNames, ...props.fieldNames };
|
||||
const field = useField<any>();
|
||||
const compile = useCompile();
|
||||
|
||||
if (!isValid(props.value)) {
|
||||
return <div />;
|
||||
}
|
||||
@ -25,7 +28,7 @@ export const ReadPretty = observer((props: any) => {
|
||||
<div>
|
||||
{options.map((option, key) => (
|
||||
<Tag key={key} color={option[fieldNames.color]} icon={option.icon}>
|
||||
{option[fieldNames.label]}
|
||||
{compile(option[fieldNames.label])}
|
||||
</Tag>
|
||||
))}
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user