fix: blur & focus lose argumnet, close #5434

pull/5440/head
tangjinzhou 2022-04-01 21:31:20 +08:00
parent 0d06ce26ac
commit fa76f5c480
9 changed files with 36 additions and 36 deletions

View File

@ -86,11 +86,11 @@ export default function generateRangePicker<DateType, ExtraProps = {}>(
emit('update:open', open);
emit('openChange', open);
};
const onFocus = () => {
emit('focus');
const onFocus = (e: FocusEvent) => {
emit('focus', e);
};
const onBlur = () => {
emit('blur');
const onBlur = (e: FocusEvent) => {
emit('blur', e);
formItemContext.onFieldBlur();
};
const onPanelChange = (dates: RangeValue<DateType>, modes: [PanelMode, PanelMode]) => {

View File

@ -95,11 +95,11 @@ export default function generateSinglePicker<DateType, ExtraProps = {}>(
emit('update:open', open);
emit('openChange', open);
};
const onFocus = () => {
emit('focus');
const onFocus = (e: FocusEvent) => {
emit('focus', e);
};
const onBlur = () => {
emit('blur');
const onBlur = (e: FocusEvent) => {
emit('blur', e);
formItemContext.onFieldBlur();
};
const onPanelChange = (date: DateType, mode: PanelMode | null) => {

View File

@ -64,14 +64,14 @@ const InputNumber = defineComponent({
emit('change', val);
formItemContext.onFieldChange();
};
const handleBlur = () => {
const handleBlur = (e: FocusEvent) => {
focused.value = false;
emit('blur');
emit('blur', e);
formItemContext.onFieldBlur();
};
const handleFocus = () => {
const handleFocus = (e: FocusEvent) => {
focused.value = true;
emit('focus');
emit('focus', e);
};
onMounted(() => {
nextTick(() => {

View File

@ -74,8 +74,8 @@ export const inputNumberProps = () => ({
(value: ValueType, info: { offset: ValueType; type: 'up' | 'down' }) => void
>,
},
onBlur: { type: Function as PropType<(e: InputEvent) => void> },
onFocus: { type: Function as PropType<(e: InputEvent) => void> },
onBlur: { type: Function as PropType<(e: FocusEvent) => void> },
onFocus: { type: Function as PropType<(e: FocusEvent) => void> },
});
export default defineComponent({
@ -417,11 +417,11 @@ export default defineComponent({
};
// >>> Focus & Blur
const onBlur = () => {
const onBlur = (e: FocusEvent) => {
flushInputValue(false);
focus.value = false;
userTypingRef.value = false;
emit('blur');
emit('blur', e);
};
// ========================== Controlled ==========================
@ -557,9 +557,9 @@ export default defineComponent({
value={inputValue.value}
disabled={disabled}
readonly={readonly}
onFocus={() => {
onFocus={(e: FocusEvent) => {
focus.value = true;
emit('focus');
emit('focus', e);
}}
onInput={onInternalInput}
onBlur={onBlur}

View File

@ -119,13 +119,13 @@ const Rate = defineComponent({
changeValue(isReset ? 0 : newValue);
state.cleanedValue = isReset ? newValue : null;
};
const onFocus = () => {
const onFocus = (e: FocusEvent) => {
state.focused = true;
emit('focus');
emit('focus', e);
};
const onBlur = () => {
const onBlur = (e: FocusEvent) => {
state.focused = false;
emit('blur');
emit('blur', e);
formItemContext.onFieldBlur();
};
const onKeyDown = (event: KeyboardEvent) => {

View File

@ -113,8 +113,8 @@ const Slider = defineComponent({
emit('change', val);
formItemContext.onFieldChange();
};
const handleBlur = () => {
emit('blur');
const handleBlur = (e: FocusEvent) => {
emit('blur', e);
};
expose({
focus,

View File

@ -115,8 +115,8 @@ const Switch = defineComponent({
formItemContext.onFieldChange();
};
const handleBlur = () => {
emit('blur');
const handleBlur = (e: FocusEvent) => {
emit('blur', e);
};
const handleClick = (e: MouseEvent) => {

View File

@ -104,11 +104,11 @@ function createTimePicker<
emit('update:open', open);
emit('openChange', open);
};
const onFocus = () => {
emit('focus');
const onFocus = (e: FocusEvent) => {
emit('focus', e);
};
const onBlur = () => {
emit('blur');
const onBlur = (e: FocusEvent) => {
emit('blur', e);
formItemContext.onFieldBlur();
};
const onOk = (value: DateType) => {
@ -174,11 +174,11 @@ function createTimePicker<
emit('update:open', open);
emit('openChange', open);
};
const onFocus = () => {
emit('focus');
const onFocus = (e: FocusEvent) => {
emit('focus', e);
};
const onBlur = () => {
emit('blur');
const onBlur = (e: FocusEvent) => {
emit('blur', e);
formItemContext.onFieldBlur();
};
const onPanelChange = (

View File

@ -159,8 +159,8 @@ const TreeSelect = defineComponent({
emit('update:searchValue', value);
emit('search', value);
};
const handleBlur = () => {
emit('blur');
const handleBlur = (e: FocusEvent) => {
emit('blur', e);
formItemContext.onFieldBlur();
};
return () => {