refactor: should not trigger event of row when clicking in drawer (#2400)
* refactor: should not fire event if row when clicking in drawer * refactor: rename
This commit is contained in:
parent
e3e4e63146
commit
8615804b6f
@ -128,7 +128,7 @@ export const Action: ComposedAction = observer(
|
||||
>
|
||||
{popover && <RecursionField basePath={field.address} onlyRenderProperties schema={fieldSchema} />}
|
||||
{!popover && renderButton()}
|
||||
{!popover && <div onClick={(e) => e.stopPropagation()}>{props.children}</div>}
|
||||
{!popover && props.children}
|
||||
{element}
|
||||
</ActionContextProvider>,
|
||||
);
|
||||
|
@ -22,7 +22,7 @@ import {
|
||||
import { useACLFieldWhitelist } from '../../../acl/ACLProvider';
|
||||
import { useToken } from '../__builtins__';
|
||||
import { ColumnFieldProvider } from './components/ColumnFieldProvider';
|
||||
import { extractIndex, isCollectionFieldComponent, isColumnComponent } from './utils';
|
||||
import { extractIndex, isCollectionFieldComponent, isColumnComponent, isPortalInBody } from './utils';
|
||||
|
||||
const useArrayField = (props) => {
|
||||
const field = useField<ArrayField>();
|
||||
@ -239,7 +239,12 @@ export const Table: any = observer(
|
||||
if (onClickRow) {
|
||||
onRow = (record) => {
|
||||
return {
|
||||
onClick: () => onClickRow(record, setSelectedRow, selectedRow),
|
||||
onClick: (e) => {
|
||||
if (isPortalInBody(e.target)) {
|
||||
return;
|
||||
}
|
||||
onClickRow(record, setSelectedRow, selectedRow);
|
||||
},
|
||||
};
|
||||
};
|
||||
highlightRow = css`
|
||||
@ -323,9 +328,9 @@ export const Table: any = observer(
|
||||
.nb-read-pretty-input-number {
|
||||
text-align: right;
|
||||
}
|
||||
.ant-color-picker-trigger{
|
||||
position:absolute;
|
||||
top:50%;
|
||||
.ant-color-picker-trigger {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
`,
|
||||
|
@ -17,3 +17,17 @@ export function extractIndex(str) {
|
||||
});
|
||||
return numbers.join('.');
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断一个 DOM 对象是否是由 createPortal 挂在到了 body 上
|
||||
* @param domNode DOM 对象
|
||||
*/
|
||||
export const isPortalInBody = (dom: HTMLElement) => {
|
||||
while (dom) {
|
||||
if (dom.id === 'root') {
|
||||
return false;
|
||||
}
|
||||
dom = dom.parentNode as HTMLElement;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user