parent
abd1b7f499
commit
c167740f63
|
@ -17,15 +17,12 @@ function makeMap(str, expectsLowerCase) {
|
||||||
const isTextInputType = makeMap('text,number,password,search,email,tel,url');
|
const isTextInputType = makeMap('text,number,password,search,email,tel,url');
|
||||||
|
|
||||||
function onCompositionStart(e) {
|
function onCompositionStart(e) {
|
||||||
e.target.originPlaceholder = e.target.placeholder;
|
|
||||||
e.target.placeholder = '';
|
|
||||||
e.target.composing = true;
|
e.target.composing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onCompositionEnd(e) {
|
function onCompositionEnd(e) {
|
||||||
// prevent triggering an input event for no reason
|
// prevent triggering an input event for no reason
|
||||||
if (!e.target.composing) return;
|
if (!e.target.composing) return;
|
||||||
e.target.placeholder = e.target.originPlaceholder;
|
|
||||||
e.target.composing = false;
|
e.target.composing = false;
|
||||||
trigger(e.target, 'input');
|
trigger(e.target, 'input');
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,12 +173,9 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleChange(e) {
|
handleChange(e) {
|
||||||
if (e.inputType === 'insertCompositionText') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const { value, composing } = e.target;
|
const { value, composing } = e.target;
|
||||||
// https://github.com/vueComponent/ant-design-vue/issues/2203
|
// https://github.com/vueComponent/ant-design-vue/issues/2203
|
||||||
if ((composing && this.lazy) || this.stateValue === value) return;
|
if (((e.isComposing || composing) && this.lazy) || this.stateValue === value) return;
|
||||||
this.setValue(value, this.clearPasswordValueAttribute);
|
this.setValue(value, this.clearPasswordValueAttribute);
|
||||||
resolveOnChange(this.$refs.input, e, this.onChange);
|
resolveOnChange(this.$refs.input, e, this.onChange);
|
||||||
},
|
},
|
||||||
|
|
|
@ -69,11 +69,8 @@ export default {
|
||||||
this.$emit('input', e);
|
this.$emit('input', e);
|
||||||
},
|
},
|
||||||
handleChange(e) {
|
handleChange(e) {
|
||||||
if (e.inputType === 'insertCompositionText') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const { value, composing } = e.target;
|
const { value, composing } = e.target;
|
||||||
if ((composing && this.lazy) || this.stateValue === value) return;
|
if (((e.isComposing || composing) && this.lazy) || this.stateValue === value) return;
|
||||||
|
|
||||||
this.setValue(e.target.value, () => {
|
this.setValue(e.target.value, () => {
|
||||||
this.$refs.resizableTextArea.resizeTextarea();
|
this.$refs.resizableTextArea.resizeTextarea();
|
||||||
|
|
|
@ -85,7 +85,7 @@ const DateInput = {
|
||||||
onInputChange(e) {
|
onInputChange(e) {
|
||||||
const { value: str, composing } = e.target;
|
const { value: str, composing } = e.target;
|
||||||
const { str: oldStr = '' } = this;
|
const { str: oldStr = '' } = this;
|
||||||
if (composing || oldStr === str) return;
|
if (e.isComposing || composing || oldStr === str) return;
|
||||||
|
|
||||||
const { disabledDate, format, selectedValue } = this.$props;
|
const { disabledDate, format, selectedValue } = this.$props;
|
||||||
|
|
||||||
|
|
|
@ -72,8 +72,8 @@ const Mentions = {
|
||||||
}
|
}
|
||||||
this.$emit('change', value);
|
this.$emit('change', value);
|
||||||
},
|
},
|
||||||
onChange({ target: { value, composing } }) {
|
onChange({ target: { value, composing }, isComposing }) {
|
||||||
if (composing) return;
|
if (isComposing || composing) return;
|
||||||
this.triggerChange(value);
|
this.triggerChange(value);
|
||||||
},
|
},
|
||||||
onKeyDown(event) {
|
onKeyDown(event) {
|
||||||
|
|
|
@ -33,7 +33,7 @@ export default {
|
||||||
},
|
},
|
||||||
handleChange(e) {
|
handleChange(e) {
|
||||||
const { value, composing } = e.target;
|
const { value, composing } = e.target;
|
||||||
if (composing || this.goInputText === value) return;
|
if (e.isComposing || composing || this.goInputText === value) return;
|
||||||
this.setState({
|
this.setState({
|
||||||
goInputText: value,
|
goInputText: value,
|
||||||
});
|
});
|
||||||
|
|
|
@ -195,7 +195,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleKeyUp(e) {
|
handleKeyUp(e) {
|
||||||
if (e.target.composing) return;
|
if (e.isComposing || e.target.composing) return;
|
||||||
const value = this.getValidValue(e);
|
const value = this.getValidValue(e);
|
||||||
const stateCurrentInputValue = this.stateCurrentInputValue;
|
const stateCurrentInputValue = this.stateCurrentInputValue;
|
||||||
|
|
||||||
|
|
|
@ -323,7 +323,7 @@ const Select = {
|
||||||
onInputChange(e) {
|
onInputChange(e) {
|
||||||
const { value: val, composing } = e.target;
|
const { value: val, composing } = e.target;
|
||||||
const { _inputValue = '' } = this.$data;
|
const { _inputValue = '' } = this.$data;
|
||||||
if (composing || _inputValue === val) {
|
if (e.isComposing || composing || _inputValue === val) {
|
||||||
this.setState({
|
this.setState({
|
||||||
_mirrorInputValue: val,
|
_mirrorInputValue: val,
|
||||||
});
|
});
|
||||||
|
|
|
@ -61,7 +61,7 @@ const Header = {
|
||||||
onInputChange(e) {
|
onInputChange(e) {
|
||||||
const { value: str, composing } = e.target;
|
const { value: str, composing } = e.target;
|
||||||
const { str: oldStr = '' } = this;
|
const { str: oldStr = '' } = this;
|
||||||
if (composing || oldStr === str) return;
|
if (e.isComposing || composing || oldStr === str) return;
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
str,
|
str,
|
||||||
|
|
|
@ -98,7 +98,7 @@ const SearchInput = {
|
||||||
handleInputChange(e) {
|
handleInputChange(e) {
|
||||||
const { value, composing } = e.target;
|
const { value, composing } = e.target;
|
||||||
const { searchValue = '' } = this;
|
const { searchValue = '' } = this;
|
||||||
if (composing || searchValue === value) {
|
if (e.isComposing || composing || searchValue === value) {
|
||||||
this.mirrorSearchValue = value;
|
this.mirrorSearchValue = value;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue