mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
Merge pull request #10986 from z1769057083/master
fix: 移动端弹窗、抽屉配置了closeOnOutside, 移动端下拉类型的表单选择后整个弹窗关闭
This commit is contained in:
commit
fd7fbd7b58
@ -44,6 +44,7 @@ export interface DrawerProps {
|
||||
onEntered?: () => void;
|
||||
drawerClassName?: string;
|
||||
drawerMaskClassName?: string;
|
||||
mobileUI?: boolean;
|
||||
}
|
||||
export interface DrawerState {}
|
||||
const fadeStyles: {
|
||||
@ -168,7 +169,7 @@ export class Drawer extends React.Component<DrawerProps, DrawerState> {
|
||||
@autobind
|
||||
handleRootMouseDownCapture(e: MouseEvent) {
|
||||
const target = e.target as HTMLElement;
|
||||
const {closeOnOutside, classPrefix: ns} = this.props;
|
||||
const {closeOnOutside, classPrefix: ns, mobileUI} = this.props;
|
||||
const isLeftButton =
|
||||
(e.button === 1 && window.event !== null) || e.button === 0;
|
||||
|
||||
@ -177,7 +178,9 @@ export class Drawer extends React.Component<DrawerProps, DrawerState> {
|
||||
closeOnOutside &&
|
||||
target &&
|
||||
this.modalDom &&
|
||||
((!this.modalDom.contains(target) && !target.closest('[role=dialog]')) ||
|
||||
((!mobileUI &&
|
||||
!this.modalDom.contains(target) &&
|
||||
!target.closest('[role=dialog]')) ||
|
||||
(target.matches(`.${ns}Drawer-overlay`) &&
|
||||
target.parentElement === this.modalDom))
|
||||
); // 干脆过滤掉来自弹框里面的点击
|
||||
|
@ -270,7 +270,7 @@ export class Modal extends React.Component<ModalProps, ModalState> {
|
||||
@autobind
|
||||
handleRootMouseDownCapture(e: MouseEvent) {
|
||||
const target = e.target as HTMLElement;
|
||||
const {closeOnOutside, classPrefix: ns} = this.props;
|
||||
const {closeOnOutside, classPrefix: ns, mobileUI} = this.props;
|
||||
const isLeftButton =
|
||||
(e.button === 1 && window.event !== null) || e.button === 0;
|
||||
|
||||
@ -279,7 +279,9 @@ export class Modal extends React.Component<ModalProps, ModalState> {
|
||||
closeOnOutside &&
|
||||
target &&
|
||||
this.modalDom &&
|
||||
((!this.modalDom.contains(target) && !target.closest('[role=dialog]')) ||
|
||||
((!mobileUI &&
|
||||
!this.modalDom.contains(target) &&
|
||||
!target.closest('[role=dialog]')) ||
|
||||
(target.matches(`.${ns}Modal`) && target === this.modalDom))
|
||||
); // 干脆过滤掉来自弹框里面的点击
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user