Merge remote-tracking branch 'origin/master' into feat-1.4.0

pull/1236/head
tangjinzhou 2019-09-28 19:19:49 +08:00
commit de01b413db
3 changed files with 24 additions and 7 deletions

View File

@ -1,4 +1,13 @@
// Browser environment sniffing
export const inBrowser = typeof window !== 'undefined';
export const inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
export const weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
export const UA = inBrowser && window.navigator.userAgent.toLowerCase();
export const isIE = UA && /msie|trident/.test(UA);
export const isIE9 = UA && UA.indexOf('msie 9.0') > 0;
export const isEdge = UA && UA.indexOf('edge/') > 0;
export const isAndroid = (UA && UA.indexOf('android') > 0) || weexPlatform === 'android';
export const isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || weexPlatform === 'ios';
export const isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
export const isPhantomJS = UA && /phantomjs/.test(UA);
export const isFF = UA && UA.match(/firefox\/(\d+)/);

View File

@ -51,6 +51,7 @@ import {
} from './util';
import { SelectPropTypes } from './PropTypes';
import contains from '../_util/Dom/contains';
import { isIE, isEdge } from '../_util/env';
Vue.use(ref, { name: 'ant-ref' });
const SELECT_EMPTY_VALUE_KEY = 'RC_SELECT_EMPTY_VALUE_KEY';
@ -463,6 +464,7 @@ const Select = {
onArrowClick(e) {
e.stopPropagation();
e.preventDefault();
this.clearBlurTime();
if (!this.disabled) {
this.setOpenState(!this.$data._open, !this.$data._open);
}
@ -640,12 +642,17 @@ const Select = {
},
inputBlur(e) {
const target = e.relatedTarget || document.activeElement;
// https://github.com/vueComponent/ant-design-vue/issues/999
// https://github.com/vueComponent/ant-design-vue/issues/1223
if (
(target &&
this.selectTriggerRef &&
this.selectTriggerRef.getInnerMenu() &&
this.selectTriggerRef.getInnerMenu().$el === target) ||
contains(e.target, target)
(isIE || isEdge) &&
(e.relatedTarget === this.$refs.arrow ||
(target &&
this.selectTriggerRef &&
this.selectTriggerRef.getInnerMenu() &&
this.selectTriggerRef.getInnerMenu().$el === target) ||
contains(e.target, target))
) {
e.target.focus();
e.preventDefault();
@ -701,7 +708,7 @@ const Select = {
}
this.setOpenState(false);
this.$emit('blur', this.getVLForOnChange(value));
}, 10);
}, 200);
},
inputFocus(e) {
if (this.$props.disabled) {
@ -1434,6 +1441,7 @@ const Select = {
style={UNSELECTABLE_STYLE}
{...{ attrs: UNSELECTABLE_ATTRIBUTE }}
onClick={this.onArrowClick}
ref="arrow"
>
{inputIcon || defaultIcon}
</span>

View File

@ -237,7 +237,7 @@ export default {
},
onBlur(e) {
if (!contains(e.target, e.relatedTarget)) {
if (!contains(e.target, e.relatedTarget || document.activeElement)) {
this.fireEvents('blur', e);
this.clearDelayTimer();
if (this.isBlurToHide()) {