Skip to content

Commit fa76f5c

Browse files
committed
fix: blur & focus lose argumnet, close #5434
1 parent 0d06ce2 commit fa76f5c

File tree

9 files changed

+36
-36
lines changed

9 files changed

+36
-36
lines changed

components/date-picker/generatePicker/generateRangePicker.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ export default function generateRangePicker<DateType, ExtraProps = {}>(
8686
emit('update:open', open);
8787
emit('openChange', open);
8888
};
89-
const onFocus = () => {
90-
emit('focus');
89+
const onFocus = (e: FocusEvent) => {
90+
emit('focus', e);
9191
};
92-
const onBlur = () => {
93-
emit('blur');
92+
const onBlur = (e: FocusEvent) => {
93+
emit('blur', e);
9494
formItemContext.onFieldBlur();
9595
};
9696
const onPanelChange = (dates: RangeValue<DateType>, modes: [PanelMode, PanelMode]) => {

components/date-picker/generatePicker/generateSinglePicker.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ export default function generateSinglePicker<DateType, ExtraProps = {}>(
9595
emit('update:open', open);
9696
emit('openChange', open);
9797
};
98-
const onFocus = () => {
99-
emit('focus');
98+
const onFocus = (e: FocusEvent) => {
99+
emit('focus', e);
100100
};
101-
const onBlur = () => {
102-
emit('blur');
101+
const onBlur = (e: FocusEvent) => {
102+
emit('blur', e);
103103
formItemContext.onFieldBlur();
104104
};
105105
const onPanelChange = (date: DateType, mode: PanelMode | null) => {

components/input-number/index.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ const InputNumber = defineComponent({
6464
emit('change', val);
6565
formItemContext.onFieldChange();
6666
};
67-
const handleBlur = () => {
67+
const handleBlur = (e: FocusEvent) => {
6868
focused.value = false;
69-
emit('blur');
69+
emit('blur', e);
7070
formItemContext.onFieldBlur();
7171
};
72-
const handleFocus = () => {
72+
const handleFocus = (e: FocusEvent) => {
7373
focused.value = true;
74-
emit('focus');
74+
emit('focus', e);
7575
};
7676
onMounted(() => {
7777
nextTick(() => {

components/input-number/src/InputNumber.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ export const inputNumberProps = () => ({
7474
(value: ValueType, info: { offset: ValueType; type: 'up' | 'down' }) => void
7575
>,
7676
},
77-
onBlur: { type: Function as PropType<(e: InputEvent) => void> },
78-
onFocus: { type: Function as PropType<(e: InputEvent) => void> },
77+
onBlur: { type: Function as PropType<(e: FocusEvent) => void> },
78+
onFocus: { type: Function as PropType<(e: FocusEvent) => void> },
7979
});
8080

8181
export default defineComponent({
@@ -417,11 +417,11 @@ export default defineComponent({
417417
};
418418

419419
// >>> Focus & Blur
420-
const onBlur = () => {
420+
const onBlur = (e: FocusEvent) => {
421421
flushInputValue(false);
422422
focus.value = false;
423423
userTypingRef.value = false;
424-
emit('blur');
424+
emit('blur', e);
425425
};
426426

427427
// ========================== Controlled ==========================
@@ -557,9 +557,9 @@ export default defineComponent({
557557
value={inputValue.value}
558558
disabled={disabled}
559559
readonly={readonly}
560-
onFocus={() => {
560+
onFocus={(e: FocusEvent) => {
561561
focus.value = true;
562-
emit('focus');
562+
emit('focus', e);
563563
}}
564564
onInput={onInternalInput}
565565
onBlur={onBlur}

components/rate/index.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@ const Rate = defineComponent({
119119
changeValue(isReset ? 0 : newValue);
120120
state.cleanedValue = isReset ? newValue : null;
121121
};
122-
const onFocus = () => {
122+
const onFocus = (e: FocusEvent) => {
123123
state.focused = true;
124-
emit('focus');
124+
emit('focus', e);
125125
};
126-
const onBlur = () => {
126+
const onBlur = (e: FocusEvent) => {
127127
state.focused = false;
128-
emit('blur');
128+
emit('blur', e);
129129
formItemContext.onFieldBlur();
130130
};
131131
const onKeyDown = (event: KeyboardEvent) => {

components/slider/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ const Slider = defineComponent({
113113
emit('change', val);
114114
formItemContext.onFieldChange();
115115
};
116-
const handleBlur = () => {
117-
emit('blur');
116+
const handleBlur = (e: FocusEvent) => {
117+
emit('blur', e);
118118
};
119119
expose({
120120
focus,

components/switch/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ const Switch = defineComponent({
115115
formItemContext.onFieldChange();
116116
};
117117

118-
const handleBlur = () => {
119-
emit('blur');
118+
const handleBlur = (e: FocusEvent) => {
119+
emit('blur', e);
120120
};
121121

122122
const handleClick = (e: MouseEvent) => {

components/time-picker/time-picker.tsx

+8-8
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ function createTimePicker<
104104
emit('update:open', open);
105105
emit('openChange', open);
106106
};
107-
const onFocus = () => {
108-
emit('focus');
107+
const onFocus = (e: FocusEvent) => {
108+
emit('focus', e);
109109
};
110-
const onBlur = () => {
111-
emit('blur');
110+
const onBlur = (e: FocusEvent) => {
111+
emit('blur', e);
112112
formItemContext.onFieldBlur();
113113
};
114114
const onOk = (value: DateType) => {
@@ -174,11 +174,11 @@ function createTimePicker<
174174
emit('update:open', open);
175175
emit('openChange', open);
176176
};
177-
const onFocus = () => {
178-
emit('focus');
177+
const onFocus = (e: FocusEvent) => {
178+
emit('focus', e);
179179
};
180-
const onBlur = () => {
181-
emit('blur');
180+
const onBlur = (e: FocusEvent) => {
181+
emit('blur', e);
182182
formItemContext.onFieldBlur();
183183
};
184184
const onPanelChange = (

components/tree-select/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ const TreeSelect = defineComponent({
159159
emit('update:searchValue', value);
160160
emit('search', value);
161161
};
162-
const handleBlur = () => {
163-
emit('blur');
162+
const handleBlur = (e: FocusEvent) => {
163+
emit('blur', e);
164164
formItemContext.onFieldBlur();
165165
};
166166
return () => {

0 commit comments

Comments
 (0)