import { DeleteOutlined, DownOutlined, EditOutlined, UpOutlined } from '@ant-design/icons'; import { css } from '@emotion/css'; import { SchemaOptionsContext } from '@formily/react'; import { uid } from '@formily/shared'; import { CollectionCategroriesContext, CollectionProvider, PopoverWithStopPropagation, SchemaComponent, SchemaComponentProvider, Select, collection, useCollectionManager, useCompile, useCurrentAppInfo, useRecord, } from '@nocobase/client'; import { Badge, Tag } from 'antd'; import lodash from 'lodash'; import React, { useContext, useRef, useState } from 'react'; import { useAsyncDataSource, useCancelAction, useDestroyActionAndRefreshCM, useDestroyFieldActionAndRefreshCM, useUpdateCollectionActionAndRefreshCM, useValuesFromRecord, } from '../action-hooks'; import useStyles from '../style'; import { getPopupContainer, useGCMTranslation } from '../utils'; import { AddFieldAction } from './AddFieldAction'; import { CollectionNodeProvder } from './CollectionNodeProvder'; import { ConnectAssociationAction } from './ConnectAssociationAction'; import { ConnectChildAction } from './ConnectChildAction'; import { ConnectParentAction } from './ConnectParentAction'; import { EditCollectionAction } from './EditCollectionAction'; import { DeleteCollectionAction } from './DeleteCollectionAction'; import { EditFieldAction } from './EditFieldAction'; import { FieldSummary } from './FieldSummary'; import { OverrideFieldAction } from './OverrideFieldAction'; import { ViewFieldAction } from './ViewFieldAction'; const OperationButton: any = React.memo((props: any) => { const { property, loadCollections, collectionData, setTargetNode, node, handelOpenPorts, title, name, targetGraph } = props; const isInheritField = !(property.collectionName !== name); const options = useContext(SchemaOptionsContext); const isAssociationField = ['hasOne', 'hasMany', 'belongsTo', 'belongsToMany'].includes(property.type); const isShowAssocition = isAssociationField && !(property.through ? targetGraph.hasCell(property.through) : targetGraph.hasCell(property.target)); const { data: { database }, } = useCurrentAppInfo(); const useNewId = (prefix) => { return `${prefix || ''}${uid()}`; }; // 获取当前字段列表 const useCurrentFields = () => { const record = useRecord(); const { getCollectionFields } = useCollectionManager(); const fields = getCollectionFields(record.collectionName || record.name) as any[]; return fields; }; return (