diff --git a/antdv-demo b/antdv-demo
index d68062568..44f59845e 160000
--- a/antdv-demo
+++ b/antdv-demo
@@ -1 +1 @@
-Subproject commit d680625687a695a9b9a06a131e12f9611a480d5b
+Subproject commit 44f59845e9fa34578b79066f22fb14526f4ee7a6
diff --git a/components/_util/antDirective.js b/components/_util/antDirective.js
index bdd49a948..a67e327af 100644
--- a/components/_util/antDirective.js
+++ b/components/_util/antDirective.js
@@ -1,12 +1,11 @@
import ref from 'vue-ref';
-import { antInput } from './antInputDirective';
+// import { antInput } from './antInputDirective';
import { antDecorator } from './FormDecoratorDirective';
import { antPortal } from './portalDirective';
export default {
install: Vue => {
Vue.use(ref, { name: 'ant-ref' });
- antInput(Vue);
antDecorator(Vue);
antPortal(Vue);
},
diff --git a/components/_util/antInputDirective.js b/components/_util/antInputDirective.js
index abbb4d7fe..f07fd01ab 100644
--- a/components/_util/antInputDirective.js
+++ b/components/_util/antInputDirective.js
@@ -44,30 +44,29 @@ if (isIE9) {
});
}
-export function antInput(Vue) {
- return Vue.directive('ant-input', {
- inserted(el, binding, vnode) {
- if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
- if (!binding.modifiers || !binding.modifiers.lazy) {
- el.addEventListener('compositionstart', onCompositionStart);
- el.addEventListener('compositionend', onCompositionEnd);
- // Safari < 10.2 & UIWebView doesn't fire compositionend when
- // switching focus before confirming composition choice
- // this also fixes the issue where some browsers e.g. iOS Chrome
- // fires "change" instead of "input" on autocomplete.
- el.addEventListener('change', onCompositionEnd);
- /* istanbul ignore if */
- if (isIE9) {
- el.vmodel = true;
- }
+export const antInput = {
+ mounted(el, binding, vnode) {
+ if (vnode.type === 'textarea' || isTextInputType(el.type)) {
+ if (!binding.modifiers || !binding.modifiers.lazy) {
+ el.addEventListener('compositionstart', onCompositionStart);
+ el.addEventListener('compositionend', onCompositionEnd);
+ // Safari < 10.2 & UIWebView doesn't fire compositionend when
+ // switching focus before confirming composition choice
+ // this also fixes the issue where some browsers e.g. iOS Chrome
+ // fires "change" instead of "input" on autocomplete.
+ el.addEventListener('change', onCompositionEnd);
+ /* istanbul ignore if */
+ if (isIE9) {
+ el.vmodel = true;
}
}
- },
- });
-}
-
-export default {
- install: Vue => {
- antInput(Vue);
+ }
+ },
+};
+
+export default {
+ install: app => {
+ antInput(app);
+ app.directive('ant-input', antInput);
},
};
diff --git a/components/vc-select/OptGroup.jsx b/components/vc-select/OptGroup.jsx
index 336e94b26..1293870d5 100644
--- a/components/vc-select/OptGroup.jsx
+++ b/components/vc-select/OptGroup.jsx
@@ -5,4 +5,7 @@ export default {
label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
},
isSelectOptGroup: true,
+ render() {
+ return null;
+ },
};
diff --git a/components/vc-select/Option.jsx b/components/vc-select/Option.jsx
index ab7de1625..6704e4c42 100644
--- a/components/vc-select/Option.jsx
+++ b/components/vc-select/Option.jsx
@@ -8,4 +8,7 @@ export default {
title: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
},
isSelectOption: true,
+ render() {
+ return null;
+ },
};
diff --git a/components/vc-select/Select.jsx b/components/vc-select/Select.jsx
index 3666ab23c..10a61625d 100644
--- a/components/vc-select/Select.jsx
+++ b/components/vc-select/Select.jsx
@@ -1,4 +1,4 @@
-import {TransitionGroup} from 'vue';
+import { TransitionGroup } from 'vue';
import KeyCode from '../_util/KeyCode';
import PropTypes from '../_util/vue-types';
import classnames from 'classnames';
@@ -149,7 +149,7 @@ const Select = {
};
return {
...state,
- _mirrorInputValue: state._inputValue, // https://github.com/vueComponent/ant-design-vue/issues/1458
+ // _mirrorInputValue: state._inputValue, // https://github.com/vueComponent/ant-design-vue/issues/1458
...this.getDerivedState(props, state),
};
},
@@ -170,22 +170,10 @@ const Select = {
__propsSymbol__() {
Object.assign(this.$data, this.getDerivedState(getOptionProps(this), this.$data));
},
- _inputValue(val) {
- this.$data._mirrorInputValue = val;
- },
},
updated() {
this.$nextTick(() => {
- if (isMultipleOrTags(this.$props)) {
- const inputNode = this.getInputDOMNode();
- const mirrorNode = this.getInputMirrorDOMNode();
- if (inputNode && inputNode.value && mirrorNode) {
- inputNode.style.width = '';
- inputNode.style.width = `${mirrorNode.clientWidth + 10}px`;
- } else if (inputNode) {
- inputNode.style.width = '';
- }
- }
+ this.updateInputWidth();
this.forcePopupAlign();
});
},
@@ -199,6 +187,18 @@ const Select = {
}
},
methods: {
+ updateInputWidth() {
+ if (isMultipleOrTags(this.$props)) {
+ const inputNode = this.getInputDOMNode();
+ const mirrorNode = this.getInputMirrorDOMNode();
+ if (inputNode && inputNode.value && mirrorNode) {
+ inputNode.style.width = '';
+ inputNode.style.width = `${mirrorNode.clientWidth + 10}px`;
+ } else if (inputNode) {
+ inputNode.style.width = '';
+ }
+ }
+ },
getDerivedState(nextProps, prevState) {
const optionsInfo = prevState._skipBuildOptionsInfo
? prevState._optionsInfo
@@ -310,14 +310,7 @@ const Select = {
},
onInputChange(e) {
- const { value: val, composing } = e.target;
- const { _inputValue = '' } = this.$data;
- if (e.isComposing || composing || _inputValue === val) {
- this.setState({
- _mirrorInputValue: val,
- });
- return;
- }
+ const { value: val } = e.target;
const { tokenSeparators } = this.$props;
if (
isMultipleOrTags(this.$props) &&
@@ -639,20 +632,14 @@ const Select = {
getPlaceholderElement() {
const { $props: props, $data: state } = this;
let hidden = false;
- if (state._mirrorInputValue) {
+ if (state._inputValue) {
hidden = true;
}
const value = state._value;
if (value.length) {
hidden = true;
}
- if (
- !state._mirrorInputValue &&
- isCombobox(props) &&
- value.length === 1 &&
- state._value &&
- !state._value[0]
- ) {
+ if (isCombobox(props) && value.length === 1 && state._value && !state._value[0]) {
hidden = false;
}
const placeholder = props.placeholder;
@@ -781,9 +768,11 @@ const Select = {
},
_getInputElement() {
const props = this.$props;
- const { _inputValue: inputValue, _mirrorInputValue } = this.$data;
+ const { _inputValue: inputValue } = this.$data;
const attrs = this.$attrs;
- const defaultInput = ;
+ const defaultInput = (
+
+ );
const inputElement = props.getInputElement ? props.getInputElement() : defaultInput;
const inputCls = classnames(inputElement.class, {
@@ -816,7 +805,7 @@ const Select = {
onBlur: chaining(this.inputBlur, inputEvents.onBlur),
})}
- {_mirrorInputValue}
+ {inputValue}
);
@@ -1206,7 +1195,7 @@ const Select = {
});
sel.push(
-
+
{...innerItems}
,
);
@@ -1411,9 +1400,7 @@ const Select = {
tag: 'ul',
onAfterLeave: this.onChoiceAnimationLeave,
});
- innerNode = (
- {selectedValueNodes}
- );
+ innerNode = {selectedValueNodes};
} else {
innerNode = ;
}
diff --git a/examples/App.vue b/examples/App.vue
index 1ed1eccbf..e3126ce2c 100644
--- a/examples/App.vue
+++ b/examples/App.vue
@@ -4,7 +4,7 @@