From 4510242651215eaf8a4954b035fa06d58ad8630a Mon Sep 17 00:00:00 2001 From: chenos Date: Mon, 18 Apr 2022 10:43:29 +0800 Subject: [PATCH] fix: stop propagation when drawer is opened --- .../antd/action/Action.Drawer.tsx | 126 +++++++++--------- .../record-picker/ReadPrettyRecordPicker.tsx | 4 +- 2 files changed, 69 insertions(+), 61 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/action/Action.Drawer.tsx b/packages/core/client/src/schema-component/antd/action/Action.Drawer.tsx index c55451e14..da9bef2ce 100644 --- a/packages/core/client/src/schema-component/antd/action/Action.Drawer.tsx +++ b/packages/core/client/src/schema-component/antd/action/Action.Drawer.tsx @@ -21,67 +21,73 @@ export const ActionDrawer: ComposedActionDrawer = observer((props) => { return ( <> {createPortal( - setVisible(false)} - className={classNames( - others.className, - css` - &.nb-action-popup { - .ant-drawer-content { - background: #f0f2f5; - } - } - &.nb-record-picker-selector { - .nb-block-item { - margin-bottom: 24px; - .general-schema-designer { - top: -8px; - bottom: -8px; - left: -8px; - right: -8px; - } - } - } - `, - )} - footer={ - footerSchema && ( -
- { - return s['x-component'] === footerNodeName; - }} - /> -
- ) - } +
{ + e.stopPropagation(); + }} > - { - return s['x-component'] !== footerNodeName; - }} - /> - , + setVisible(false)} + className={classNames( + others.className, + css` + &.nb-action-popup { + .ant-drawer-content { + background: #f0f2f5; + } + } + &.nb-record-picker-selector { + .nb-block-item { + margin-bottom: 24px; + .general-schema-designer { + top: -8px; + bottom: -8px; + left: -8px; + right: -8px; + } + } + } + `, + )} + footer={ + footerSchema && ( +
+ { + return s['x-component'] === footerNodeName; + }} + /> +
+ ) + } + > + { + return s['x-component'] !== footerNodeName; + }} + /> +
+
, document.body, )} diff --git a/packages/core/client/src/schema-component/antd/record-picker/ReadPrettyRecordPicker.tsx b/packages/core/client/src/schema-component/antd/record-picker/ReadPrettyRecordPicker.tsx index f118d8c32..4ff84d684 100644 --- a/packages/core/client/src/schema-component/antd/record-picker/ReadPrettyRecordPicker.tsx +++ b/packages/core/client/src/schema-component/antd/record-picker/ReadPrettyRecordPicker.tsx @@ -27,7 +27,9 @@ export const ReadPrettyRecordPicker: React.FC = observer((props: any) => { return ( { + onClick={(e) => { + e.stopPropagation(); + e.preventDefault(); setVisible(true); setRecord(record); }}