From f0db975c1d28d0c4d3fa3897da2444bdbffdf7f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A2=AB=E9=9B=A8=E6=B0=B4=E8=BF=87=E6=BB=A4=E7=9A=84?= =?UTF-8?q?=E7=A9=BA=E6=B0=94-Rain?= <958414905@qq.com> Date: Wed, 15 Nov 2023 16:32:28 +0800 Subject: [PATCH] chore: hide linkage rule option in some buttons (#3046) --- .../src/schema-component/antd/action/Action.Designer.tsx | 8 ++++---- .../src/schema-initializer/components/DuplicateAction.tsx | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx b/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx index 7d06f08eb..0119dfe70 100644 --- a/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx @@ -1,12 +1,13 @@ import { ArrayTable } from '@formily/antd-v5'; -import { onFieldValueChange, onFieldInputValueChange, onFieldInit } from '@formily/core'; -import { connect, ISchema, mapProps, useField, useFieldSchema, useForm, useFormEffects } from '@formily/react'; +import { onFieldInputValueChange, onFieldValueChange } from '@formily/core'; +import { ISchema, connect, mapProps, useField, useFieldSchema, useForm, useFormEffects } from '@formily/react'; import { isValid, uid } from '@formily/shared'; import { Alert, Tree as AntdTree, ModalProps } from 'antd'; import { cloneDeep } from 'lodash'; import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { RemoteSelect, useCompile, useDesignable } from '../..'; +import { usePlugin } from '../../../application/hooks'; import { CollectionOptions, useCollection, useCollectionManager } from '../../../collection-manager'; import { FlagProvider } from '../../../flag-provider'; import { useRecord } from '../../../record-provider'; @@ -17,7 +18,6 @@ import { useSyncFromForm } from '../../../schema-settings/DataTemplates/utils'; import { DefaultValueProvider } from '../../../schema-settings/hooks/useIsAllowToSetDefaultValue'; import { useLinkageAction } from './hooks'; import { requestSettingsSchema } from './utils'; -import { usePlugin } from '../../../application/hooks'; const Tree = connect( AntdTree, @@ -910,7 +910,7 @@ export const ActionDesigner = (props) => { fieldSchema['x-action'] || '', ); const isUpdateModePopupAction = ['customize:bulkUpdate', 'customize:bulkEdit'].includes(fieldSchema['x-action']); - const isLinkageAction = linkageAction || isAction; + const isLinkageAction = (linkageAction || isAction) && !['destroy', 'refresh'].includes(fieldSchema['x-action']); const isChildCollectionAction = getChildrenCollections(name).length > 0 && fieldSchema['x-action'] === 'create'; const isDraggable = fieldSchema?.parent['x-component'] !== 'CollectionField'; const isDuplicateAction = fieldSchema['x-action'] === 'duplicate'; diff --git a/packages/core/client/src/schema-initializer/components/DuplicateAction.tsx b/packages/core/client/src/schema-initializer/components/DuplicateAction.tsx index 87dbb621a..8df82d579 100644 --- a/packages/core/client/src/schema-initializer/components/DuplicateAction.tsx +++ b/packages/core/client/src/schema-initializer/components/DuplicateAction.tsx @@ -90,8 +90,6 @@ export const DuplicateAction = observer( } }; - console.log('props', props); - return ( <div className={cx(actionDesignerCss, {