fix: stop propagation when drawer is opened

This commit is contained in:
chenos 2022-04-18 10:43:29 +08:00
parent e21d819155
commit 4510242651
2 changed files with 69 additions and 61 deletions

View File

@ -21,67 +21,73 @@ export const ActionDrawer: ComposedActionDrawer = observer((props) => {
return (
<>
{createPortal(
<Drawer
width={'50%'}
title={field.title}
{...others}
destroyOnClose
visible={visible}
onClose={() => 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 && (
<div
className={css`
display: flex;
justify-content: flex-end;
width: 100%;
.ant-btn {
margin-right: 8px;
}
`}
>
<RecursionField
basePath={field.address}
schema={schema}
onlyRenderProperties
filterProperties={(s) => {
return s['x-component'] === footerNodeName;
}}
/>
</div>
)
}
<div
onClick={(e) => {
e.stopPropagation();
}}
>
<RecursionField
basePath={field.address}
schema={schema}
onlyRenderProperties
filterProperties={(s) => {
return s['x-component'] !== footerNodeName;
}}
/>
</Drawer>,
<Drawer
width={'50%'}
title={field.title}
{...others}
destroyOnClose
visible={visible}
onClose={() => 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 && (
<div
className={css`
display: flex;
justify-content: flex-end;
width: 100%;
.ant-btn {
margin-right: 8px;
}
`}
>
<RecursionField
basePath={field.address}
schema={schema}
onlyRenderProperties
filterProperties={(s) => {
return s['x-component'] === footerNodeName;
}}
/>
</div>
)
}
>
<RecursionField
basePath={field.address}
schema={schema}
onlyRenderProperties
filterProperties={(s) => {
return s['x-component'] !== footerNodeName;
}}
/>
</Drawer>
</div>,
document.body,
)}
</>

View File

@ -27,7 +27,9 @@ export const ReadPrettyRecordPicker: React.FC = observer((props: any) => {
return (
<span>
<a
onClick={() => {
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
setVisible(true);
setRecord(record);
}}