From 09f576d779763c5533f9b01f2af21746a8eb5cac Mon Sep 17 00:00:00 2001 From: 2betop <2betop.cn@gmail.com> Date: Mon, 3 Aug 2020 14:39:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20Picker=20=E4=B8=AD=20selec?= =?UTF-8?q?t=20=E5=BC=B9=E5=87=BA=E4=BD=8D=E7=BD=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderers/Dialog.tsx | 10 +++++++++- src/renderers/Form/Picker.tsx | 5 +++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/renderers/Dialog.tsx b/src/renderers/Dialog.tsx index 226fc08c1..a4c3fda16 100644 --- a/src/renderers/Dialog.tsx +++ b/src/renderers/Dialog.tsx @@ -5,7 +5,7 @@ import {SchemaNode, Schema, Action} from '../types'; import {filter} from '../utils/tpl'; import Modal from '../components/Modal'; import findLast from 'lodash/findLast'; -import {guid, isVisible} from '../utils/helper'; +import {guid, isVisible, autobind} from '../utils/helper'; import {reaction} from 'mobx'; import {Icon} from '../components/icons'; import {ModalStore, IModalStore} from '../store/modal'; @@ -294,6 +294,13 @@ export default class Dialog extends React.Component { }); } + @autobind + getPopOverContainer() { + return (findDOMNode(this) as HTMLElement).querySelector( + `.${this.props.classPrefix}Modal-content` + ); + } + renderBody(body: SchemaNode, key?: any): React.ReactNode { let {render, store} = this.props; @@ -306,6 +313,7 @@ export default class Dialog extends React.Component { disabled: (body && (body as any).disabled) || store.loading, onAction: this.handleAction, onFinished: this.handleChildFinished, + popOverContainer: this.getPopOverContainer, affixOffsetTop: 0, onChange: this.handleFormChange, onInit: this.handleFormInit, diff --git a/src/renderers/Form/Picker.tsx b/src/renderers/Form/Picker.tsx index 43367e7e2..999f41dd1 100644 --- a/src/renderers/Form/Picker.tsx +++ b/src/renderers/Form/Picker.tsx @@ -346,7 +346,7 @@ export default class PickerControl extends React.PureComponent< } @autobind - renderBody() { + renderBody({popOverContainer}: any) { const { render, selectedOptions, @@ -363,7 +363,8 @@ export default class PickerControl extends React.PureComponent< options: options, multiple, onSelect: embed ? this.handleChange : undefined, - ref: this.crudRef + ref: this.crudRef, + popOverContainer }) as JSX.Element; }