From 22f681024db2637f76178d9cd4e927aabe01216e 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, 6 Sep 2023 11:11:35 +0800 Subject: [PATCH] fix: fix collapsed panels not working when clicked (#2600) * refactor: rename * fix: fix collapsed panels not working when clicked --- .../src/schema-component/antd/action/Action.tsx | 3 +-- .../association-field/InternalPopoverNester.tsx | 6 +++--- .../antd/filter/FilterAction.tsx | 6 +++--- .../antd/icon-picker/IconPicker.tsx | 6 +++--- .../antd/input/EllipsisWithTooltip.tsx | 2 +- .../schema-component/antd/popover/Popover.tsx | 2 +- .../antd/quick-edit/QuickEdit.tsx | 6 +++--- .../charts/src/client/select/CustomSelect.tsx | 10 +++++----- .../src/client/GraphDrawPage.tsx | 16 ++++++++-------- .../src/client/components/Entity.tsx | 12 ++++++------ .../src/client/Localization.tsx | 6 +++--- .../token-panel-pro/TokenContent.tsx | 6 +++--- 12 files changed, 40 insertions(+), 41 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/action/Action.tsx b/packages/core/client/src/schema-component/antd/action/Action.tsx index bcea781d6..1f75d11c6 100644 --- a/packages/core/client/src/schema-component/antd/action/Action.tsx +++ b/packages/core/client/src/schema-component/antd/action/Action.tsx @@ -1,5 +1,5 @@ import { observer, RecursionField, useField, useFieldSchema, useForm } from '@formily/react'; -import { App, Button } from 'antd'; +import { App, Button, Popover } from 'antd'; import classnames from 'classnames'; import lodash from 'lodash'; import React, { useEffect, useState } from 'react'; @@ -11,7 +11,6 @@ import { useRecord } from '../../../record-provider'; import { SortableItem } from '../../common'; import { useCompile, useComponent, useDesigner } from '../../hooks'; import { useProps } from '../../hooks/useProps'; -import { Popover } from '../popover'; import ActionContainer from './Action.Container'; import { ActionDesigner } from './Action.Designer'; import { ActionDrawer } from './Action.Drawer'; diff --git a/packages/core/client/src/schema-component/antd/association-field/InternalPopoverNester.tsx b/packages/core/client/src/schema-component/antd/association-field/InternalPopoverNester.tsx index 7b6839858..54807bd39 100644 --- a/packages/core/client/src/schema-component/antd/association-field/InternalPopoverNester.tsx +++ b/packages/core/client/src/schema-component/antd/association-field/InternalPopoverNester.tsx @@ -4,7 +4,7 @@ import { observer } from '@formily/react'; import React, { useContext, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { ActionContext, ActionContextProvider } from '../action/context'; -import { Popover } from '../popover'; +import { PopoverWithStopPropagation } from '../popover'; import { InternalNester } from './InternalNester'; import { ReadPrettyInternalViewer } from './InternalViewer'; import { useAssociationFieldContext } from './hooks'; @@ -46,7 +46,7 @@ export const InternaPopoverNester = observer( }; return ( - - + {visible && (
setVisible(false)} diff --git a/packages/core/client/src/schema-component/antd/filter/FilterAction.tsx b/packages/core/client/src/schema-component/antd/filter/FilterAction.tsx index 2edc93f6a..ff09e181b 100644 --- a/packages/core/client/src/schema-component/antd/filter/FilterAction.tsx +++ b/packages/core/client/src/schema-component/antd/filter/FilterAction.tsx @@ -8,7 +8,7 @@ import { FormProvider, SchemaComponent } from '../../core'; import { useDesignable } from '../../hooks'; import { useProps } from '../../hooks/useProps'; import { Action } from '../action'; -import { Popover } from '../popover'; +import { PopoverWithStopPropagation } from '../popover'; export const FilterActionContext = createContext(null); @@ -27,7 +27,7 @@ export const FilterAction = observer( return ( - - + ); }, diff --git a/packages/core/client/src/schema-component/antd/icon-picker/IconPicker.tsx b/packages/core/client/src/schema-component/antd/icon-picker/IconPicker.tsx index 1062bc4cd..0c2bd3bab 100644 --- a/packages/core/client/src/schema-component/antd/icon-picker/IconPicker.tsx +++ b/packages/core/client/src/schema-component/antd/icon-picker/IconPicker.tsx @@ -6,7 +6,7 @@ import { Button, Input } from 'antd'; import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Icon, hasIcon, icons } from '../../../icon'; -import { Popover } from '../popover'; +import { PopoverWithStopPropagation } from '../popover'; function IconField(props: any) { const layout = useFormLayout(); @@ -16,7 +16,7 @@ function IconField(props: any) { return (
- { @@ -47,7 +47,7 @@ function IconField(props: any) { - + {value && !disabled && (
- + ); }); diff --git a/packages/plugins/charts/src/client/select/CustomSelect.tsx b/packages/plugins/charts/src/client/select/CustomSelect.tsx index 1e5c364f8..4ff798e82 100644 --- a/packages/plugins/charts/src/client/select/CustomSelect.tsx +++ b/packages/plugins/charts/src/client/select/CustomSelect.tsx @@ -1,7 +1,7 @@ import { LoadingOutlined } from '@ant-design/icons'; import { connect, mapProps, mapReadPretty } from '@formily/react'; import { isValid } from '@formily/shared'; -import { Icon, Popover, css } from '@nocobase/client'; +import { Icon, PopoverWithStopPropagation, css } from '@nocobase/client'; import type { SelectProps } from 'antd'; import { Select as AntdSelect } from 'antd'; import React from 'react'; @@ -36,7 +36,7 @@ const InternalSelect = connect( {group1.map((option) => (
- + ))} {group2.map((option) => ( ))} diff --git a/packages/plugins/graph-collection-manager/src/client/GraphDrawPage.tsx b/packages/plugins/graph-collection-manager/src/client/GraphDrawPage.tsx index 94d28899a..aa5657a4d 100644 --- a/packages/plugins/graph-collection-manager/src/client/GraphDrawPage.tsx +++ b/packages/plugins/graph-collection-manager/src/client/GraphDrawPage.tsx @@ -7,7 +7,6 @@ import { Snapline } from '@antv/x6-plugin-snapline'; import { register } from '@antv/x6-react-shape'; import { cx } from '@emotion/css'; import { SchemaOptionsContext } from '@formily/react'; -import { useSearchParams } from 'react-router-dom'; import { APIClientProvider, CollectionCategroriesContext, @@ -25,13 +24,19 @@ import { useCurrentAppInfo, useGlobalTheme, } from '@nocobase/client'; -import lodash from 'lodash'; -import { Button, ConfigProvider, Layout, Switch, Tooltip, App, Spin } from 'antd'; +import { App, Button, ConfigProvider, Layout, Spin, Switch, Tooltip } from 'antd'; import dagre from 'dagre'; +import lodash from 'lodash'; import React, { createContext, forwardRef, useContext, useEffect, useLayoutEffect, useState } from 'react'; +import { useSearchParams } from 'react-router-dom'; import { useAsyncDataSource, useCreateActionAndRefreshCM } from './action-hooks'; import { AddCollectionAction } from './components/AddCollectionAction'; +import { ConnectorAction } from './components/ConnectorAction'; +import { DirectionAction } from './components/DirectionAction'; import Entity from './components/Entity'; +import { FullscreenAction } from './components/FullScreenAction'; +import { LocateCollectionAction } from './components/LocateCollectionAction'; +import { SelectCollectionsAction } from './components/SelectCollectionsAction'; import { SimpleNodeView } from './components/ViewNode'; import useStyles from './style'; import { @@ -43,11 +48,6 @@ import { getPopupContainer, useGCMTranslation, } from './utils'; -import { LocateCollectionAction } from './components/LocateCollectionAction'; -import { SelectCollectionsAction } from './components/SelectCollectionsAction'; -import { DirectionAction } from './components/DirectionAction'; -import { ConnectorAction } from './components/ConnectorAction'; -import { FullscreenAction } from './components/FullScreenAction'; const { drop, groupBy, last, maxBy, minBy, take, uniq } = lodash; const LINE_HEIGHT = 40; diff --git a/packages/plugins/graph-collection-manager/src/client/components/Entity.tsx b/packages/plugins/graph-collection-manager/src/client/components/Entity.tsx index 1d77afa4e..3756318ac 100644 --- a/packages/plugins/graph-collection-manager/src/client/components/Entity.tsx +++ b/packages/plugins/graph-collection-manager/src/client/components/Entity.tsx @@ -5,7 +5,7 @@ import { uid } from '@formily/shared'; import { CollectionCategroriesContext, CollectionProvider, - Popover, + PopoverWithStopPropagation, SchemaComponent, SchemaComponentProvider, Select, @@ -30,14 +30,14 @@ 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 { EditFieldAction } from './EditFieldAction'; import { FieldSummary } from './FieldSummary'; import { OverrideFieldAction } from './OverrideFieldAction'; import { ViewFieldAction } from './ViewFieldAction'; -import { ConnectAssociationAction } from './ConnectAssociationAction'; -import { ConnectChildAction } from './ConnectChildAction'; -import { ConnectParentAction } from './ConnectParentAction'; const OperationButton: any = React.memo((props: any) => { const { property, loadCollections, collectionData, setTargetNode, node, handelOpenPorts, title, name, targetGraph } = @@ -256,7 +256,7 @@ const PopoverContent = React.forwardRef((props: any, ref) => { }} onMouseLeave={() => setIsHovered(false)} > - { {compile(property.uiSchema?.title)} - +
{compile(getInterface(property.interface)?.title)}
{isHovered && } diff --git a/packages/plugins/localization-management/src/client/Localization.tsx b/packages/plugins/localization-management/src/client/Localization.tsx index eaccff8cd..cef3b3249 100644 --- a/packages/plugins/localization-management/src/client/Localization.tsx +++ b/packages/plugins/localization-management/src/client/Localization.tsx @@ -4,7 +4,7 @@ import { Field, useField, useForm } from '@formily/react'; import { FormProvider, Input, - Popover, + PopoverWithStopPropagation, Radio, SchemaComponent, locale, @@ -115,7 +115,7 @@ const Sync = () => { }; return ( - @@ -158,7 +158,7 @@ const Sync = () => { > {t('Sync')} - + ); }; diff --git a/packages/plugins/theme-editor/src/client/antd-token-previewer/token-panel-pro/TokenContent.tsx b/packages/plugins/theme-editor/src/client/antd-token-previewer/token-panel-pro/TokenContent.tsx index 05d94011f..294e44eff 100644 --- a/packages/plugins/theme-editor/src/client/antd-token-previewer/token-panel-pro/TokenContent.tsx +++ b/packages/plugins/theme-editor/src/client/antd-token-previewer/token-panel-pro/TokenContent.tsx @@ -1,5 +1,5 @@ import { CaretRightOutlined, ExpandOutlined, QuestionCircleOutlined } from '@ant-design/icons'; -import { Popover } from '@nocobase/client'; +import { PopoverWithStopPropagation } from '@nocobase/client'; import { Button, Checkbox, Collapse, ConfigProvider, Switch, Tooltip, Typography } from 'antd'; import type { ThemeConfig } from 'antd/es/config-provider/context'; import seed from 'antd/es/theme/themes/seed'; @@ -304,7 +304,7 @@ const SeedTokenPreview: FC = ({ theme, tokenName, disabled, alph {tokenName.startsWith('color') && ( - = ({ theme, tokenName, disabled, alph />
{tokenValue}
-
+ )} {['fontSize', 'sizeUnit', 'sizeStep', 'borderRadius'].includes(tokenName) && (