Skip to content

Commit 80ce003

Browse files
authored
Merge branch 'master' into master
2 parents afe99b4 + 4470642 commit 80ce003

32 files changed

+133
-67
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ Input number control.
1313
[npm-url]: http://npmjs.org/package/rc-input-number
1414
[travis-image]: https://img.shields.io/travis/react-component/input-number/master?style=flat-square
1515
[travis-url]: https://travis-ci.com/react-component/input-number
16-
[github-actions-image]: https://github.com/react-component/input-number/workflows/CI/badge.svg
17-
[github-actions-url]: https://github.com/react-component/input-number/actions
16+
[github-actions-image]: https://github.com/react-component/input-number/actions/workflows/react-component-ci.yml/badge.svg
17+
[github-actions-url]: https://github.com/react-component/input-number/actions/workflows/react-component-ci.yml
1818
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/input-number/master.svg?style=flat-square
1919
[codecov-url]: https://app.codecov.io/gh/react-component/input-number
2020
[david-url]: https://david-dm.org/react-component/input-number

docs/api.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,13 @@ nav:
8080
<td>readOnly</td>
8181
<td>Boolean</td>
8282
<td>false</td>
83-
<td>Specifies that an InputNumber is read only </td>
83+
<td>Specifies that an InputNumber is read only</td>
84+
</tr>
85+
<tr>
86+
<td>changeOnWheel</td>
87+
<td>Boolean</td>
88+
<td>false</td>
89+
<td>Specifies that the value is set using the mouse wheel</td>
8490
</tr>
8591
<tr>
8692
<td>controls</td>
@@ -136,6 +142,12 @@ nav:
136142
<td></td>
137143
<td>Called when an element gets focus</td>
138144
</tr>
145+
<tr>
146+
<td>onStep</td>
147+
<td>(value: T, info: { offset: ValueType; type: 'up' | 'down', emitter: 'handler' | 'keydown' | 'wheel' }) => void</td>
148+
<td></td>
149+
<td>Called when the user clicks the arrows on the keyboard or interface and when the mouse wheel is spun.</td>
150+
</tr>
139151
<tr>
140152
<td>style</td>
141153
<td>Object</td>

docs/demo/combination-key-format.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint no-console:0 */
22
import React from 'react';
3-
import InputNumber from 'rc-input-number';
3+
import InputNumber from '@rc-component/input-number';
44
import '../../assets/index.less';
55

66
class Component extends React.Component {

docs/demo/custom.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint no-console:0 */
22
import React from 'react';
3-
import InputNumber from 'rc-input-number';
3+
import InputNumber from '@rc-component/input-number';
44
import '../../assets/index.less';
55

66
class Component extends React.Component {

docs/demo/debug.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint no-console:0 */
22
import React, { useEffect } from 'react';
3-
import InputNumber from 'rc-input-number';
3+
import InputNumber from '@rc-component/input-number';
44
import '../../assets/index.less';
55

66
export default () => {

docs/demo/decimal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint no-console:0 */
22
import React from 'react';
3-
import InputNumber from 'rc-input-number';
3+
import InputNumber from '@rc-component/input-number';
44
import '../../assets/index.less';
55

66
export default class Demo extends React.Component {

docs/demo/focus.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint no-console:0 */
2-
import InputNumber, { InputNumberRef } from 'rc-input-number';
2+
import InputNumber, { InputNumberRef } from '@rc-component/input-number';
33
import React from 'react';
44
import '../../assets/index.less';
55

docs/demo/formatter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint no-console:0 */
22
import React from 'react';
3-
import InputNumber from 'rc-input-number';
3+
import InputNumber from '@rc-component/input-number';
44
import '../../assets/index.less';
55

66
function getSum(str) {

docs/demo/input-control.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint no-console:0 */
22
import React from 'react';
3-
import type { ValueType} from 'rc-input-number'
4-
import InputNumber from 'rc-input-number';
3+
import type { ValueType} from '@rc-component/input-number'
4+
import InputNumber from '@rc-component/input-number';
55
import '../../assets/index.less';
66

77
export default () => {

docs/demo/on-step.tsx

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/* eslint no-console:0 */
2+
import InputNumber from '@rc-component/input-number';
3+
import React, { useState } from 'react';
4+
import '../../assets/index.less';
5+
6+
export default () => {
7+
const [emitter, setEmitter] = useState('interface buttons (up)');
8+
const [value, setValue] = React.useState<string | number>(0);
9+
10+
const onChange = (val: number) => {
11+
console.warn('onChange:', val, typeof val);
12+
setValue(val);
13+
};
14+
15+
const onStep = (_: number, info: { offset: number; type: 'up' | 'down', emitter: 'handler' | 'keyboard' | 'wheel' }) => {
16+
if (info.emitter === 'handler') {
17+
setEmitter(`interface buttons (${info.type})`);
18+
}
19+
20+
if (info.emitter === 'keyboard') {
21+
setEmitter(`keyboard (${info.type})`);
22+
}
23+
24+
if (info.emitter === 'wheel') {
25+
setEmitter(`mouse wheel (${info.type})`);
26+
}
27+
};
28+
29+
return (
30+
<div style={{ margin: 10 }}>
31+
<h3>onStep callback</h3>
32+
<InputNumber
33+
aria-label="onStep callback example"
34+
min={0}
35+
max={10}
36+
style={{ width: 100 }}
37+
value={value}
38+
changeOnWheel
39+
onChange={onChange}
40+
onStep={onStep}
41+
/>
42+
43+
<div style={{ marginTop: 10 }}>Triggered by: {emitter}</div>
44+
</div>
45+
);
46+
};

0 commit comments

Comments
 (0)