diff --git a/packages/core/client/src/schema-component/antd/association-field/InternalViewer.tsx b/packages/core/client/src/schema-component/antd/association-field/InternalViewer.tsx index 0183ad36ad..55adfa8043 100644 --- a/packages/core/client/src/schema-component/antd/association-field/InternalViewer.tsx +++ b/packages/core/client/src/schema-component/antd/association-field/InternalViewer.tsx @@ -7,7 +7,7 @@ * For more information, please refer to: https://www.nocobase.com/agreement. */ -import { observer, RecursionField, useField, useFieldSchema } from '@formily/react'; +import { RecursionField, useField, useFieldSchema } from '@formily/react'; import { toArr } from '@formily/shared'; import _ from 'lodash'; import React, { FC, Fragment, useEffect, useRef, useState } from 'react'; @@ -241,68 +241,64 @@ const getSourceData = (recordData, fieldSchema) => { return _.get(recordData, sourceRecordKey); }; -export const ReadPrettyInternalViewer: React.FC = observer( - (props: ReadPrettyInternalViewerProps) => { - const { value, ButtonList = ButtonLinkList } = props; - const fieldSchema = useFieldSchema(); - const { enableLink } = fieldSchema['x-component-props'] || {}; - // value 做了转换,但 props.value 和原来 useField().value 的值不一致 - const field = useField(); - const [visible, setVisible] = useState(false); - const { options: collectionField } = useAssociationFieldContext(); - const ellipsisWithTooltipRef = useRef(); - const { visibleWithURL, setVisibleWithURL } = usePopupUtils(); - const [btnHover, setBtnHover] = useState(!!visibleWithURL); - const { defaultOpenMode } = useOpenModeContext(); - const recordData = useCollectionRecordData(); +export const ReadPrettyInternalViewer: React.FC = (props) => { + const { value, ButtonList = ButtonLinkList } = props; + const fieldSchema = useFieldSchema(); + const { enableLink } = fieldSchema['x-component-props'] || {}; + // value 做了转换,但 props.value 和原来 useField().value 的值不一致 + const field = useField(); + const [visible, setVisible] = useState(false); + const { options: collectionField } = useAssociationFieldContext(); + const { visibleWithURL, setVisibleWithURL } = usePopupUtils(); + const [btnHover, setBtnHover] = useState(!!visibleWithURL); + const { defaultOpenMode } = useOpenModeContext(); + const recordData = useCollectionRecordData(); - const btnElement = ( - - - - - - ); + const btnElement = ( + + + + + + ); - if (enableLink === false || !btnHover) { - return btnElement; - } + if (enableLink === false || !btnHover) { + return btnElement; + } - const renderWithoutTableFieldResourceProvider = () => ( - // The recordData here is only provided when the popup is opened, not the current row record - - - { - return s['x-component'] === 'AssociationField.Viewer'; - }} - /> - - - ); - - return ( - - { - setVisible?.(value); - setVisibleWithURL?.(value); - }, - openMode: defaultOpenMode, - snapshot: collectionField?.interface === 'snapshot', - fieldSchema: fieldSchema, + const renderWithoutTableFieldResourceProvider = () => ( + // The recordData here is only provided when the popup is opened, not the current row record + + + { + return s['x-component'] === 'AssociationField.Viewer'; }} - > - {btnElement} - {renderWithoutTableFieldResourceProvider()} - - - ); - }, - { displayName: 'ReadPrettyInternalViewer' }, -); + /> + + + ); + + return ( + + { + setVisible?.(value); + setVisibleWithURL?.(value); + }, + openMode: defaultOpenMode, + snapshot: collectionField?.interface === 'snapshot', + fieldSchema: fieldSchema, + }} + > + {btnElement} + {renderWithoutTableFieldResourceProvider()} + + + ); +}; diff --git a/packages/core/client/src/schema-component/antd/table-v2/components/ColumnFieldProvider.tsx b/packages/core/client/src/schema-component/antd/table-v2/components/ColumnFieldProvider.tsx index 2632a58ad5..3221f7142b 100644 --- a/packages/core/client/src/schema-component/antd/table-v2/components/ColumnFieldProvider.tsx +++ b/packages/core/client/src/schema-component/antd/table-v2/components/ColumnFieldProvider.tsx @@ -7,9 +7,9 @@ * For more information, please refer to: https://www.nocobase.com/agreement. */ -import { RecursionField } from '@formily/react'; import React, { useMemo } from 'react'; import { useCollection } from '../../../../data-source'; +import { NocoBaseRecursionField } from '../../../../formily/NocoBaseRecursionField'; import { useRecord } from '../../../../record-provider'; export const ColumnFieldProvider = (props: { schema: any; basePath: any; children: any }) => { @@ -45,7 +45,7 @@ export const ColumnFieldProvider = (props: { schema: any; basePath: any; childre }, }, }; - return ; + return ; } return props.children; };