Skip to content

Commit

Permalink
feat: input not trigger input event when chinese not complete #1281
Browse files Browse the repository at this point in the history
  • Loading branch information
tangjinzhou committed Nov 15, 2019
1 parent bad8cc0 commit 6c05e25
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 14 deletions.
6 changes: 4 additions & 2 deletions components/input/Input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export default {
},

handleChange(e) {
if (e.target.composing) return;
this.setValue(e.target.value, e);
},

Expand Down Expand Up @@ -237,6 +238,7 @@ export default {
]);
const { stateValue, getInputClassName, handleKeyDown, handleChange, $listeners } = this;
const inputProps = {
directives: [{ name: 'ant-input' }],
domProps: {
value: fixControlledValue(stateValue),
},
Expand All @@ -251,7 +253,6 @@ export default {
ref: 'input',
key: 'ant-input',
};
inputProps.directives = [{ name: 'ant-input' }];
return this.renderLabeledIcon(prefixCls, <input {...inputProps} />);
},
},
Expand All @@ -263,8 +264,9 @@ export default {
attrs: this.$attrs,
on: {
...$listeners,
change: this.handleChange,
input: this.handleChange,
keydown: this.handleKeyDown,
change: noop,
},
directives: [
{
Expand Down
5 changes: 2 additions & 3 deletions components/input/TextArea.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export default {
},

handleTextareaChange(e) {
if (e.target.composing) return;
if (!hasProp(this, 'value')) {
this.stateValue = e.target.value;
this.resizeTextarea();
Expand Down Expand Up @@ -163,6 +164,7 @@ export default {
});

const textareaProps = {
directives: [{ name: 'ant-input' }],
attrs: { ...otherProps, ...$attrs },
on: {
...$listeners,
Expand All @@ -171,9 +173,6 @@ export default {
change: noop,
},
};
if ($listeners['change.value']) {
textareaProps.directives = [{ name: 'ant-input' }];
}
return (
<textarea
{...textareaProps}
Expand Down
1 change: 1 addition & 0 deletions components/vc-calendar/src/date/DateInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const DateInput = {
this.__emit('clear', null);
},
onInputChange(event) {
if (event.target.composing) return;
const str = event.target.value;
// https://github.com/vueComponent/ant-design-vue/issues/92
if (isIE && !isIE9 && this.str === str) {
Expand Down
3 changes: 2 additions & 1 deletion components/vc-pagination/Options.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default {
return `${opt.value} ${this.locale.items_per_page}`;
},
handleChange(e) {
if (e.target.composing) return;
this.setState({
goInputText: e.target.value,
});
Expand Down Expand Up @@ -126,7 +127,7 @@ export default {
disabled={disabled}
type="text"
value={goInputText}
onChange={this.handleChange}
onInput={this.handleChange}
onKeyup={this.go}
onBlur={this.handleBlur}
{...{
Expand Down
1 change: 1 addition & 0 deletions components/vc-pagination/Pagination.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ export default {
}
},
handleKeyUp(e) {
if (e.target.composing) return;
const value = this.getValidValue(e);
const stateCurrentInputValue = this.stateCurrentInputValue;

Expand Down
1 change: 1 addition & 0 deletions components/vc-select/Select.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ const Select = {
},

onInputChange(event) {
if (event.target.composing) return;
const { tokenSeparators } = this.$props;
const val = event.target.value;
if (
Expand Down
1 change: 1 addition & 0 deletions components/vc-time-picker/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const Header = {

methods: {
onInputChange(event) {
if (event.target.composing) return;
const str = event.target.value;
// https://github.com/vueComponent/ant-design-vue/issues/92
if (isIE && !isIE9 && this.str === str) {
Expand Down
7 changes: 0 additions & 7 deletions components/vc-time-picker/TimePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -377,13 +377,6 @@ export default {
autoFocus={autoFocus}
readOnly={!!inputReadOnly}
id={id}
{...{
directives: [
{
name: 'ant-input',
},
],
}}
/>
{inputIcon || <span class={`${prefixCls}-icon`} />}
{this.renderClearButton()}
Expand Down
4 changes: 3 additions & 1 deletion components/vc-tree-select/src/Select.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,9 @@ const Select = {
this.setOpenState(open, true);
},

onSearchInputChange({ target: { value } }) {
onSearchInputChange(event) {
if (event.target.composing) return;
const value = event.target.value;
const { _treeNodes: treeNodes, _valueEntities: valueEntities } = this.$data;
const { filterTreeNode, treeNodeFilterProp } = this.$props;
this.__emit('update:searchValue', value);
Expand Down

0 comments on commit 6c05e25

Please sign in to comment.