fix: blur & focus lose argumnet, close #5434
parent
0d06ce26ac
commit
fa76f5c480
|
@ -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]) => {
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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(() => {
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -115,8 +115,8 @@ const Switch = defineComponent({
|
|||
formItemContext.onFieldChange();
|
||||
};
|
||||
|
||||
const handleBlur = () => {
|
||||
emit('blur');
|
||||
const handleBlur = (e: FocusEvent) => {
|
||||
emit('blur', e);
|
||||
};
|
||||
|
||||
const handleClick = (e: MouseEvent) => {
|
||||
|
|
|
@ -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 = (
|
||||
|
|
|
@ -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 () => {
|
||||
|
|
Loading…
Reference in New Issue