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 ( return (
<> <>
{createPortal( {createPortal(
<Drawer <div
width={'50%'} onClick={(e) => {
title={field.title} e.stopPropagation();
{...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 <Drawer
basePath={field.address} width={'50%'}
schema={schema} title={field.title}
onlyRenderProperties {...others}
filterProperties={(s) => { destroyOnClose
return s['x-component'] !== footerNodeName; visible={visible}
}} onClose={() => setVisible(false)}
/> className={classNames(
</Drawer>, 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, document.body,
)} )}
</> </>

View File

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