Skip to content

Commit a3d4883

Browse files
committed
Merge branch 'next' of github.com:vueComponent/ant-design-vue into next
2 parents 4de6dbe + 7e53c43 commit a3d4883

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

components/input/Input.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ import { hasProp, getComponent, getOptionProps } from '../_util/props-util';
77
import { defaultConfigProvider } from '../config-provider';
88
import ClearableLabeledInput from './ClearableLabeledInput';
99

10-
export function fixControlledValue(value) {
10+
export function fixControlledValue(value: string | number) {
1111
if (typeof value === 'undefined' || value === null) {
1212
return '';
1313
}
1414
return value;
1515
}
1616

17-
export function resolveOnChange(target, e, onChange) {
17+
export function resolveOnChange(target: HTMLInputElement, e: Event, onChange?: Function) {
1818
if (onChange) {
19-
const event = e;
19+
const event = e as any;
2020
if (e.type === 'click') {
2121
// click clear icon
2222
//event = Object.create(e);
@@ -40,7 +40,7 @@ export function resolveOnChange(target, e, onChange) {
4040
}
4141
}
4242

43-
export function getInputClassName(prefixCls, size, disabled) {
43+
export function getInputClassName(prefixCls: string, size: string, disabled: boolean) {
4444
return classNames(prefixCls, {
4545
[`${prefixCls}-sm`]: size === 'small',
4646
[`${prefixCls}-lg`]: size === 'large',
@@ -91,12 +91,12 @@ export default defineComponent({
9191
}
9292
},
9393
methods: {
94-
handleInputFocus(e) {
94+
handleInputFocus(e: Event) {
9595
this.isFocused = true;
9696
this.onFocus && this.onFocus(e);
9797
},
9898

99-
handleInputBlur(e) {
99+
handleInputBlur(e: Event) {
100100
this.isFocused = false;
101101
this.onBlur && this.onBlur(e);
102102
},
@@ -112,15 +112,15 @@ export default defineComponent({
112112
this.input.select();
113113
},
114114

115-
saveClearableInput(input: any) {
115+
saveClearableInput(input: HTMLInputElement) {
116116
this.clearableInput = input;
117117
},
118118

119-
saveInput(input: any) {
119+
saveInput(input: HTMLInputElement) {
120120
this.input = input;
121121
},
122122

123-
setValue(value: any, callback?: Function) {
123+
setValue(value: string | number, callback?: Function) {
124124
if (this.stateValue === value) {
125125
return;
126126
}
@@ -134,7 +134,7 @@ export default defineComponent({
134134
});
135135
},
136136
triggerChange(e: Event) {
137-
this.$emit('update:value', (e.target as any).value);
137+
this.$emit('update:value', (e.target as HTMLInputElement).value);
138138
this.$emit('change', e);
139139
this.$emit('input', e);
140140
},

components/input/Password.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ export default defineComponent({
5757
const iconTrigger = ActionMap[action] || '';
5858
const iconProps = {
5959
[iconTrigger]: this.onVisibleChange,
60-
onMousedown: e => {
60+
onMousedown: (e: Event) => {
6161
// Prevent focused state lost
6262
// https://github.com/ant-design/ant-design/issues/15173
6363
e.preventDefault();
6464
},
65-
onMouseup: e => {
65+
onMouseup: (e: Event) => {
6666
// Prevent focused state lost
6767
// https://github.com/ant-design/ant-design/pull/23633/files
6868
e.preventDefault();

components/input/ResizableTextArea.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const ResizableTextArea = defineComponent({
6161
raf.cancel(this.resizeFrameId);
6262
},
6363
methods: {
64-
saveTextArea(textArea: any) {
64+
saveTextArea(textArea: HTMLTextAreaElement) {
6565
this.textArea = textArea;
6666
},
6767
handleResize(size: any) {

components/input/Search.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ export default defineComponent({
2828
};
2929
},
3030
methods: {
31-
saveInput(node: any) {
31+
saveInput(node: HTMLInputElement) {
3232
this.input = node;
3333
},
34-
handleChange(e) {
34+
handleChange(e: Event) {
3535
if (e && e.target && e.type === 'click') {
36-
this.$emit('search', e.target.value, e);
36+
this.$emit('search', (e.target as HTMLInputElement).value, e);
3737
}
38-
this.$emit('update:value', e.target.value);
38+
this.$emit('update:value', (e.target as HTMLInputElement).value);
3939
this.$emit('change', e);
4040
},
41-
handleSearch(e) {
41+
handleSearch(e: Event) {
4242
if (this.loading || this.disabled) {
4343
return;
4444
}

components/input/TextArea.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default defineComponent({
3535
};
3636
},
3737
watch: {
38-
value(val) {
38+
value(val: string) {
3939
this.stateValue = val;
4040
},
4141
},
@@ -49,7 +49,7 @@ export default defineComponent({
4949
});
5050
},
5151
methods: {
52-
setValue(value: any, callback?: Function) {
52+
setValue(value: string, callback?: Function) {
5353
if (!hasProp(this, 'value')) {
5454
this.stateValue = value;
5555
} else {
@@ -74,7 +74,7 @@ export default defineComponent({
7474
const { value, composing, isComposing } = e.target as any;
7575
if (((isComposing || composing) && this.lazy) || this.stateValue === value) return;
7676

77-
this.setValue((e.target as any).value, () => {
77+
this.setValue((e.target as HTMLTextAreaElement).value, () => {
7878
this.resizableTextArea.resizeTextarea();
7979
});
8080
resolveOnChange(this.resizableTextArea.textArea, e, this.triggerChange);
@@ -91,7 +91,7 @@ export default defineComponent({
9191
this.resizableTextArea = resizableTextArea;
9292
},
9393

94-
saveClearableInput(clearableInput: any) {
94+
saveClearableInput(clearableInput: HTMLTextAreaElement) {
9595
this.clearableInput = clearableInput;
9696
},
9797
handleReset(e: Event) {
@@ -124,7 +124,7 @@ export default defineComponent({
124124
const { style, class: customClass } = this.$attrs;
125125
const getPrefixCls = this.configProvider.getPrefixCls;
126126
const prefixCls = getPrefixCls('input', customizePrefixCls);
127-
let value = fixControlledValue(stateValue);
127+
let value = fixControlledValue(stateValue) as string;
128128
// Max length value
129129
const hasMaxlength = Number(maxlength) > 0;
130130
value = hasMaxlength ? value.slice(0, maxlength) : value;

0 commit comments

Comments
 (0)