drawer下传给table popoverContainer

This commit is contained in:
rickcole 2020-03-20 10:23:11 +08:00
parent 5c163da831
commit d11bb08930
3 changed files with 16 additions and 5 deletions

View File

@ -1576,6 +1576,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
classnames: cx,
keepItemSelectionOnPageChange,
onAction,
popOverContainer,
...rest
} = this.props;
@ -1642,6 +1643,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
query: store.query,
orderBy: store.query.orderBy,
orderDir: store.query.orderDir,
popOverContainer,
onAction: this.handleAction,
onSave: this.handleSave,
onSaveOrder: this.handleSaveOrder,

View File

@ -4,7 +4,7 @@ import {Renderer, RendererProps} from '../factory';
import {SchemaNode, Schema, Action} from '../types';
import {default as DrawerContainer} from '../components/Drawer';
import findLast from 'lodash/findLast';
import {guid, isVisible} from '../utils/helper';
import {guid, isVisible, autobind} from '../utils/helper';
import {reaction} from 'mobx';
import {findDOMNode} from 'react-dom';
import {IModalStore, ModalStore} from '../store/modal';
@ -252,6 +252,11 @@ export default class Drawer extends React.Component<DrawerProps, object> {
store.reset();
}
@autobind
getPopOverContainer() {
return findDOMNode(this);
}
renderBody(body: SchemaNode, key?: any): React.ReactNode {
let {render, store} = this.props;
@ -264,7 +269,8 @@ export default class Drawer extends React.Component<DrawerProps, object> {
key,
disabled: store.loading,
onAction: this.handleAction,
onFinished: this.handleChildFinished
onFinished: this.handleChildFinished,
popOverContainer: this.getPopOverContainer
};
if (schema.type === 'form') {

View File

@ -96,6 +96,7 @@ export interface TableProps extends RendererProps {
hideCheckToggler?: boolean;
rowClassName?: string;
rowClassNameExpr?: string;
popOverContainer?: any;
}
export default class Table extends React.Component<TableProps, object> {
@ -129,7 +130,8 @@ export default class Table extends React.Component<TableProps, object> {
'valueField',
'saveImmediately',
'rowClassName',
'rowClassNameExpr'
'rowClassNameExpr',
'popOverContainer'
];
static defaultProps: Partial<TableProps> = {
className: '',
@ -1175,7 +1177,8 @@ export default class Table extends React.Component<TableProps, object> {
env,
classPrefix: ns,
classnames: cx,
checkOnItemClick
checkOnItemClick,
popOverContainer
} = this.props;
if (column.name && item.rowSpans[column.name] === 0) {
@ -1253,7 +1256,7 @@ export default class Table extends React.Component<TableProps, object> {
btnDisabled: store.dragging,
data: item.locals,
value: column.name ? resolveVariable(column.name, item.data) : undefined,
popOverContainer: this.getPopOverContainer,
popOverContainer: popOverContainer || this.getPopOverContainer,
rowSpan: item.rowSpans[column.name as string],
quickEditFormRef: this.subFormRef,
prefix,