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: trigger props.onStep when value stepps up/down #269

Merged
merged 1 commit into from
Oct 9, 2020

Conversation

cyjake
Copy link
Contributor

@cyjake cyjake commented Oct 9, 2020

... to tell the source of the value change

In certain scenarios, such as Yuque Show, value changes are only necessary to handle in following cases:

  • enter pressed
  • blurred
  • value stepped by clicking or pressing up/down arrow

props.onChange triggers too often since any temporary edits change value.

@vercel
Copy link

vercel bot commented Oct 9, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/react-component/input-number/jdiwzcv23
✅ Preview: https://input-number-git-feat-onstep.react-component.vercel.app

@codecov
Copy link

codecov bot commented Oct 9, 2020

Codecov Report

Merging #269 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #269      +/-   ##
==========================================
+ Coverage   92.99%   93.01%   +0.01%     
==========================================
  Files           1        1              
  Lines         371      372       +1     
  Branches      134      135       +1     
==========================================
+ Hits          345      346       +1     
  Misses         26       26              
Impacted Files Coverage Δ
src/InputNumber.tsx 93.01% <100.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e6877a8...b389e46. Read the comment docs.

@@ -613,6 +613,7 @@ class InputNumber extends React.Component<Partial<InputNumberProps>, InputNumber
val = props.min;
}
this.setValue(val, null);
if (props.onStep) props.onStep(type, val);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onStep(value, info: { offset: number, type: 'up' | 'down' })

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@zombieJ
Copy link
Member

zombieJ commented Oct 9, 2020

+6.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants