Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui): support onFocus event in InputNumber #4085

Merged
merged 1 commit into from
Nov 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions packages/design/src/components/input-number/InputNumber.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

import type { InputNumberProps } from 'rc-input-number';
import RcInputNumber from 'rc-input-number';
import React, { forwardRef } from 'react';
import type { InputNumberProps } from 'rc-input-number';

import styles from './index.module.less';

Expand Down Expand Up @@ -71,9 +71,15 @@ export interface IInputNumberProps {
onClick?: (e: React.MouseEvent<HTMLInputElement>) => void;

/**
* Callback when user blur
* @param e
*/
* Callback when user focus
VicKun4937 marked this conversation as resolved.
Show resolved Hide resolved
* @param e
*/
onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;

/**
* Callback when user blur
* @param e
*/
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;

/**
Expand Down Expand Up @@ -110,6 +116,7 @@ export const InputNumber = forwardRef<HTMLInputElement, IInputNumberProps>((prop
onChange,
onPressEnter,
onBlur,
onFocus,
} = props;

function handleChange(value: number | null) {
Expand All @@ -134,6 +141,7 @@ export const InputNumber = forwardRef<HTMLInputElement, IInputNumberProps>((prop
onKeyDown={onKeyDown}
onChange={handleChange}
onPressEnter={onPressEnter}
onFocus={onFocus}
onBlur={onBlur}
/>
);
Expand Down
Loading