From 26186d7aadd8298bf3c8cb1a1147e9ace4409793 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Mon, 29 Oct 2018 20:49:38 +0800 Subject: [PATCH] feat: update dialog from 7.1.8 to 7.2.1 --- components/vc-dialog/Dialog.jsx | 27 +++++++++++++--------- components/vc-dialog/IDialogPropTypes.js | 1 + components/vc-dialog/demo/ant-design.vue | 29 ++++++++++++++++++++++++ components/vc-dialog/index.js | 2 +- 4 files changed, 47 insertions(+), 12 deletions(-) diff --git a/components/vc-dialog/Dialog.jsx b/components/vc-dialog/Dialog.jsx index 10b9be568..cd396f723 100644 --- a/components/vc-dialog/Dialog.jsx +++ b/components/vc-dialog/Dialog.jsx @@ -1,4 +1,4 @@ - +import { getComponentFromProp } from '../_util/props-util' import KeyCode from '../_util/KeyCode' import contains from '../_util/Dom/contains' import LazyRenderBox from './LazyRenderBox' @@ -139,7 +139,7 @@ export default { tryFocus () { if (!contains(this.$refs.wrap, document.activeElement)) { this.lastOutSideFocusNode = document.activeElement - this.$refs.wrap.focus() + this.$refs.sentinelStart.focus() } }, onAnimateLeave () { @@ -178,20 +178,20 @@ export default { if (props.visible) { if (e.keyCode === KeyCode.TAB) { const activeElement = document.activeElement - const dialogRoot = this.$refs.wrap + const sentinelStart = this.$refs.sentinelStart if (e.shiftKey) { - if (activeElement === dialogRoot) { - this.$refs.sentinel.focus() + if (activeElement === sentinelStart) { + this.$refs.sentinelEnd.focus() } - } else if (activeElement === this.$refs.sentinel) { - dialogRoot.focus() + } else if (activeElement === this.$refs.sentinelEnd) { + sentinelStart.focus() } } } }, getDialogElement () { const { closable, prefixCls, width, height, - title, footer: tempFooter, bodyStyle, visible, bodyProps } = this + title, footer: tempFooter, bodyStyle, visible, bodyProps, $props } = this const dest = {} if (width !== undefined) { dest.width = typeof width === 'number' ? `${width}px` : width @@ -222,6 +222,7 @@ export default { let closer if (closable) { + const closeIcon = getComponentFromProp(this, 'closeIcon') closer = ( ) } const style = { ...this.dialogStyle, ...dest } + const sentinelStyle = { width: 0, height: 0, overflow: 'hidden' } const cls = { [prefixCls]: true, ...this.dialogClass, @@ -248,6 +250,9 @@ export default { style={style} class={cls} > +