Skip to content

Commit 7ea8de4

Browse files
committed
fix: input compositionend not trigger change
1 parent 122e374 commit 7ea8de4

File tree

7 files changed

+77
-52
lines changed

7 files changed

+77
-52
lines changed

components/input/ResizableTextArea.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import BaseMixin from '../_util/BaseMixin';
88
import inputProps from './inputProps';
99
import PropTypes from '../_util/vue-types';
1010
import { getOptionProps } from '../_util/props-util';
11+
import { withDirectives } from 'vue';
12+
import antInput from '../_util/antInputDirective';
1113

1214
const RESIZE_STATUS_NONE = 0;
1315
const RESIZE_STATUS_RESIZING = 1;
@@ -139,7 +141,7 @@ const ResizableTextArea = {
139141
}
140142
return (
141143
<ResizeObserver onResize={this.handleResize} disabled={!(autoSize || autosize)}>
142-
<textarea {...textareaProps} ref={this.saveTextArea} />
144+
{withDirectives(<textarea {...textareaProps} ref={this.saveTextArea} />, [[antInput]])}
143145
</ResizeObserver>
144146
);
145147
},

components/vc-calendar/src/date/DateInput.jsx

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { getComponent, findDOMNode } from '../../../_util/props-util';
44
import moment from 'moment';
55
import { formatDate } from '../util';
66
import KeyCode from '../../../_util/KeyCode';
7+
import { withDirectives } from 'vue';
8+
import antInput from '../../../_util/antInputDirective';
79

810
let cachedSelectionStart;
911
let cachedSelectionEnd;
@@ -193,20 +195,23 @@ const DateInput = {
193195
return (
194196
<div class={`${prefixCls}-input-wrap`}>
195197
<div class={`${prefixCls}-date-input-wrap`}>
196-
<input
197-
ref={this.saveDateInput}
198-
class={`${prefixCls}-input ${invalidClass}`}
199-
value={str}
200-
disabled={disabled}
201-
placeholder={placeholder}
202-
onInput={this.onInputChange}
203-
onChange={this.onInputChange}
204-
onKeydown={this.onKeyDown}
205-
onFocus={this.onFocus}
206-
onBlur={this.onBlur}
207-
inputMode={inputMode}
208-
readonly={inputReadOnly}
209-
/>
198+
{withDirectives(
199+
<input
200+
ref={this.saveDateInput}
201+
class={`${prefixCls}-input ${invalidClass}`}
202+
value={str}
203+
disabled={disabled}
204+
placeholder={placeholder}
205+
onInput={this.onInputChange}
206+
onChange={this.onInputChange}
207+
onKeydown={this.onKeyDown}
208+
onFocus={this.onFocus}
209+
onBlur={this.onBlur}
210+
inputMode={inputMode}
211+
readonly={inputReadOnly}
212+
/>,
213+
[[antInput]],
214+
)}
210215
</div>
211216
{showClear ? (
212217
<a role="button" title={locale.clear} onClick={this.onClear}>

components/vc-mentions/src/Mentions.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { provide } from 'vue';
1+
import { provide, withDirectives } from 'vue';
22
import classNames from '../../_util/classNames';
33
import omit from 'omit.js';
44
import KeyCode from '../../_util/KeyCode';
@@ -13,6 +13,7 @@ import {
1313
} from './util';
1414
import KeywordTrigger from './KeywordTrigger';
1515
import { vcMentionsProps, defaultProps } from './mentionsProps';
16+
import antInput from '../../_util/antInputDirective';
1617

1718
function noop() {}
1819

@@ -286,7 +287,7 @@ const Mentions = {
286287
};
287288
return (
288289
<div class={classNames(prefixCls, className)} style={style}>
289-
<textarea ref="textarea" {...textareaProps} />
290+
{withDirectives(<textarea ref="textarea" {...textareaProps} />, [[antInput]])}
290291
{measuring && (
291292
<div ref="measure" class={`${prefixCls}-measure`}>
292293
{value.slice(0, measureLocation)}

components/vc-pagination/Options.jsx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import PropTypes from '../_util/vue-types';
22
import KEYCODE from './KeyCode';
33
import BaseMixin from '../_util/BaseMixin';
4+
import { withDirectives } from 'vue';
5+
import antInput from '../_util/antInputDirective';
46

57
export default {
68
mixins: [BaseMixin],
@@ -131,15 +133,18 @@ export default {
131133
goInput = (
132134
<div class={`${prefixCls}-quick-jumper`}>
133135
{locale.jump_to}
134-
<input
135-
disabled={disabled}
136-
type="text"
137-
value={goInputText}
138-
onInput={this.handleChange}
139-
onChange={this.handleChange}
140-
onKeyup={this.go}
141-
onBlur={this.handleBlur}
142-
/>
136+
{withDirectives(
137+
<input
138+
disabled={disabled}
139+
type="text"
140+
value={goInputText}
141+
onInput={this.handleChange}
142+
onChange={this.handleChange}
143+
onKeyup={this.go}
144+
onBlur={this.handleBlur}
145+
/>,
146+
[[antInput]],
147+
)}
143148
{locale.page}
144149
{gotoButton}
145150
</div>

components/vc-pagination/Pagination.jsx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import Options from './Options';
66
import LOCALE from './locale/zh_CN';
77
import KEYCODE from './KeyCode';
88
import classNames from '../_util/classNames';
9+
import { withDirectives } from 'vue';
10+
import antInput from '../_util/antInputDirective';
911

1012
function noop() {}
1113

@@ -379,15 +381,18 @@ export default {
379381
title={this.showTitle ? `${stateCurrent}/${allPages}` : null}
380382
class={`${prefixCls}-simple-pager`}
381383
>
382-
<input
383-
type="text"
384-
value={this.stateCurrentInputValue}
385-
onKeydown={this.handleKeyDown}
386-
onKeyup={this.handleKeyUp}
387-
onInput={this.handleKeyUp}
388-
onChange={this.handleKeyUp}
389-
size="3"
390-
/>
384+
{withDirectives(
385+
<input
386+
type="text"
387+
value={this.stateCurrentInputValue}
388+
onKeydown={this.handleKeyDown}
389+
onKeyup={this.handleKeyUp}
390+
onInput={this.handleKeyUp}
391+
onChange={this.handleKeyUp}
392+
size="3"
393+
/>,
394+
[[antInput]],
395+
)}
391396
<span class={`${prefixCls}-slash`}></span>
392397
{allPages}
393398
</li>

components/vc-time-picker/Header.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import PropTypes from '../_util/vue-types';
22
import BaseMixin from '../_util/BaseMixin';
33
import moment from 'moment';
4+
import { withDirectives } from 'vue';
5+
import antInput from '../_util/antInputDirective';
46

57
const Header = {
68
inheritAttrs: false,
@@ -159,7 +161,7 @@ const Header = {
159161
getInput() {
160162
const { prefixCls, placeholder, inputReadOnly, invalid, str } = this;
161163
const invalidClass = invalid ? `${prefixCls}-input-invalid` : '';
162-
return (
164+
return withDirectives(
163165
<input
164166
class={`${prefixCls}-input ${invalidClass}`}
165167
ref={ref => {
@@ -171,7 +173,8 @@ const Header = {
171173
onInput={this.onInputChange}
172174
onChange={this.onInputChange}
173175
readonly={!!inputReadOnly}
174-
/>
176+
/>,
177+
[[antInput]],
175178
);
176179
},
177180
},

components/vc-tree-select/src/SearchInput.jsx

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
* - multiple: in the selector
55
* Move the code as a SearchInput for easy management.
66
*/
7-
import { inject } from 'vue';
7+
import { inject, withDirectives } from 'vue';
8+
import antInput from '../../_util/antInputDirective';
89
import PropTypes from '../../_util/vue-types';
910
import { createRef } from './util';
1011

@@ -118,20 +119,23 @@ const SearchInput = {
118119
} = this;
119120
return (
120121
<span class={`${prefixCls}-search__field__wrap`}>
121-
<input
122-
type="text"
123-
ref={this.inputRef}
124-
onInput={handleInputChange}
125-
onChange={handleInputChange}
126-
onKeydown={onSearchInputKeyDown}
127-
value={searchValue}
128-
disabled={disabled}
129-
class={`${prefixCls}-search__field`}
130-
aria-label="filter select"
131-
aria-autocomplete="list"
132-
aria-controls={open ? ariaId : undefined}
133-
aria-multiline="false"
134-
/>
122+
{withDirectives(
123+
<input
124+
type="text"
125+
ref={this.inputRef}
126+
onInput={handleInputChange}
127+
onChange={handleInputChange}
128+
onKeydown={onSearchInputKeyDown}
129+
value={searchValue}
130+
disabled={disabled}
131+
class={`${prefixCls}-search__field`}
132+
aria-label="filter select"
133+
aria-autocomplete="list"
134+
aria-controls={open ? ariaId : undefined}
135+
aria-multiline="false"
136+
/>,
137+
[[antInput]],
138+
)}
135139
<span ref={this.mirrorInputRef} class={`${prefixCls}-search__field__mirror`}>
136140
{mirrorSearchValue}&nbsp;
137141
</span>

0 commit comments

Comments
 (0)