diff --git a/components/auto-complete/InputElement.jsx b/components/auto-complete/InputElement.jsx index 5a2bbf4ed..10cdefcc4 100644 --- a/components/auto-complete/InputElement.jsx +++ b/components/auto-complete/InputElement.jsx @@ -30,7 +30,7 @@ export default { }, render() { - const { $slots = {}, $listeners = {}, $props = {}, $attrs = {} } = this; + const { $slots = {}, $listeners = {}, $attrs = {} } = this; const props = getOptionProps(this); const value = props.value === undefined ? '' : props.value; const children = $slots.default[0]; diff --git a/components/auto-complete/index.jsx b/components/auto-complete/index.jsx index 881c2c8b5..a138b919f 100644 --- a/components/auto-complete/index.jsx +++ b/components/auto-complete/index.jsx @@ -69,10 +69,11 @@ const AutoComplete = { savePopupRef(ref) { this.popupRef = ref; }, + getInputElement() { const { $slots } = this; const children = filterEmpty($slots.default); - const element = children.length ? children[0] : ; + const element = children.length ? children[0] : ; return {element}; }, diff --git a/components/input/Input.jsx b/components/input/Input.jsx index c638954dc..37cf31e13 100644 --- a/components/input/Input.jsx +++ b/components/input/Input.jsx @@ -3,7 +3,6 @@ import TextArea from './TextArea'; import omit from 'omit.js'; import inputProps from './inputProps'; import { hasProp, getComponentFromProp } from '../_util/props-util'; -import { isIE, isIE9 } from '../_util/env'; import { ConfigConsumerProps } from '../config-provider'; import Icon from '../icon'; @@ -122,7 +121,7 @@ export default { handleChange(e) { const { value, composing } = e.target; - if (composing || this.stateValue === value) return; + if (composing && this.lazy) return; this.setValue(value, e); }, @@ -233,6 +232,7 @@ export default { 'allowClear', 'value', 'defaultValue', + 'lazy', ]); const { stateValue, getInputClassName, handleKeyDown, handleChange, $listeners } = this; const inputProps = { diff --git a/components/input/TextArea.jsx b/components/input/TextArea.jsx index 3a43f00e1..3301bc322 100644 --- a/components/input/TextArea.jsx +++ b/components/input/TextArea.jsx @@ -155,6 +155,7 @@ export default { 'type', 'value', 'defaultValue', + 'lazy', ]); const getPrefixCls = this.configProvider.getPrefixCls; const prefixCls = getPrefixCls('input', customizePrefixCls); diff --git a/components/input/inputProps.js b/components/input/inputProps.js index d63c358d9..4c2ebe28e 100644 --- a/components/input/inputProps.js +++ b/components/input/inputProps.js @@ -33,4 +33,8 @@ export default { spellCheck: Boolean, autoFocus: Boolean, allowClear: Boolean, + lazy: { + default: true, + type: Boolean, + }, }; diff --git a/components/vc-select/Select.jsx b/components/vc-select/Select.jsx index 0e7695ac5..e84bc3cce 100644 --- a/components/vc-select/Select.jsx +++ b/components/vc-select/Select.jsx @@ -622,7 +622,7 @@ const Select = { if (value.length) { hidden = true; } - if (isCombobox(props) && value.length === 1 && (state._value && !state._value[0])) { + if (!state._mirrorInputValue && isCombobox(props) && value.length === 1 && (state._value && !state._value[0])) { hidden = false; } const placeholder = props.placeholder; @@ -744,19 +744,7 @@ const Select = { const props = this.$props; const { _inputValue: inputValue, _mirrorInputValue } = this.$data; const attrs = getAttrs(this); - const defaultInput = ( - - ); + const defaultInput = ; const inputElement = props.getInputElement ? props.getInputElement() : defaultInput; const inputCls = classnames(getClass(inputElement), { @@ -787,6 +775,9 @@ const Select = { name: 'ant-ref', value: this.saveInputRef, }, + { + name: 'ant-input', + }, ], on: { input: this.onInputChange,