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 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 UA = inBrowser && window.navigator.userAgent.toLowerCase();
export const isIE = UA && /msie|trident/.test(UA); export const isIE = UA && /msie|trident/.test(UA);
export const isIE9 = UA && UA.indexOf('msie 9.0') > 0; 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'; } from './util';
import { SelectPropTypes } from './PropTypes'; import { SelectPropTypes } from './PropTypes';
import contains from '../_util/Dom/contains'; import contains from '../_util/Dom/contains';
import { isIE, isEdge } from '../_util/env';
Vue.use(ref, { name: 'ant-ref' }); Vue.use(ref, { name: 'ant-ref' });
const SELECT_EMPTY_VALUE_KEY = 'RC_SELECT_EMPTY_VALUE_KEY'; const SELECT_EMPTY_VALUE_KEY = 'RC_SELECT_EMPTY_VALUE_KEY';
@ -463,6 +464,7 @@ const Select = {
onArrowClick(e) { onArrowClick(e) {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
this.clearBlurTime();
if (!this.disabled) { if (!this.disabled) {
this.setOpenState(!this.$data._open, !this.$data._open); this.setOpenState(!this.$data._open, !this.$data._open);
} }
@ -640,12 +642,17 @@ const Select = {
}, },
inputBlur(e) { inputBlur(e) {
const target = e.relatedTarget || document.activeElement; 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 ( if (
(target && (isIE || isEdge) &&
this.selectTriggerRef && (e.relatedTarget === this.$refs.arrow ||
this.selectTriggerRef.getInnerMenu() && (target &&
this.selectTriggerRef.getInnerMenu().$el === target) || this.selectTriggerRef &&
contains(e.target, target) this.selectTriggerRef.getInnerMenu() &&
this.selectTriggerRef.getInnerMenu().$el === target) ||
contains(e.target, target))
) { ) {
e.target.focus(); e.target.focus();
e.preventDefault(); e.preventDefault();
@ -701,7 +708,7 @@ const Select = {
} }
this.setOpenState(false); this.setOpenState(false);
this.$emit('blur', this.getVLForOnChange(value)); this.$emit('blur', this.getVLForOnChange(value));
}, 10); }, 200);
}, },
inputFocus(e) { inputFocus(e) {
if (this.$props.disabled) { if (this.$props.disabled) {
@ -1434,6 +1441,7 @@ const Select = {
style={UNSELECTABLE_STYLE} style={UNSELECTABLE_STYLE}
{...{ attrs: UNSELECTABLE_ATTRIBUTE }} {...{ attrs: UNSELECTABLE_ATTRIBUTE }}
onClick={this.onArrowClick} onClick={this.onArrowClick}
ref="arrow"
> >
{inputIcon || defaultIcon} {inputIcon || defaultIcon}
</span> </span>

View File

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