mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 12:56:13 +00:00
fix: compile the label field
This commit is contained in:
parent
13248af671
commit
aca91bd2cf
@ -7,6 +7,7 @@ import { BlockAssociationContext } from '../../../block-provider';
|
|||||||
import { CollectionProvider, useCollection } from '../../../collection-manager';
|
import { CollectionProvider, useCollection } from '../../../collection-manager';
|
||||||
import { RecordProvider } from '../../../record-provider';
|
import { RecordProvider } from '../../../record-provider';
|
||||||
import { FormProvider } from '../../core';
|
import { FormProvider } from '../../core';
|
||||||
|
import { useCompile } from '../../hooks';
|
||||||
import { ActionContext } from '../action';
|
import { ActionContext } from '../action';
|
||||||
import { useFieldNames } from './useFieldNames';
|
import { useFieldNames } from './useFieldNames';
|
||||||
|
|
||||||
@ -18,6 +19,7 @@ export const ReadPrettyRecordPicker: React.FC = observer((props: any) => {
|
|||||||
const { getField } = useCollection();
|
const { getField } = useCollection();
|
||||||
const collectionField = getField(fieldSchema.name);
|
const collectionField = getField(fieldSchema.name);
|
||||||
const [record, setRecord] = useState({});
|
const [record, setRecord] = useState({});
|
||||||
|
const compile = useCompile();
|
||||||
return collectionField ? (
|
return collectionField ? (
|
||||||
<div>
|
<div>
|
||||||
<BlockAssociationContext.Provider value={`${collectionField.collectionName}.${collectionField.name}`}>
|
<BlockAssociationContext.Provider value={`${collectionField.collectionName}.${collectionField.name}`}>
|
||||||
@ -34,7 +36,7 @@ export const ReadPrettyRecordPicker: React.FC = observer((props: any) => {
|
|||||||
setRecord(record);
|
setRecord(record);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{record?.[fieldNames?.label || 'label']}
|
{compile(record?.[fieldNames?.label || 'label'])}
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user