-
-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f8765e
commit a583df6
Showing
27 changed files
with
315 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { defineConfig } from 'dumi'; | ||
|
||
export default defineConfig({ | ||
favicons: [ | ||
'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4', | ||
], | ||
themeConfig: { | ||
name: 'InputNumber', | ||
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4' | ||
}, | ||
outputPath: '.doc', | ||
exportStatic: {}, | ||
styles: [`body .dumi-default-header-left { width: 230px; } body .dumi-default-hero-title { font-size: 100px; }`], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,8 @@ package-lock.json | |
.umi-production | ||
.umi-test | ||
.env.local | ||
|
||
# dumi | ||
.dumi/tmp | ||
.dumi/tmp-production | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
--- | ||
title: API | ||
nav: | ||
order: 10 | ||
title: API | ||
path: /api | ||
--- | ||
|
||
<table class="table table-bordered table-striped"> | ||
<thead> | ||
<tr> | ||
<th style="width: 100px;">name</th> | ||
<th style="width: 50px;">type</th> | ||
<th style="width: 50px;">default</th> | ||
<th>description</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>prefixCls</td> | ||
<td>string</td> | ||
<td>rc-input-number</td> | ||
<td>Specifies the class prefix</td> | ||
</tr> | ||
<tr> | ||
<td>min</td> | ||
<td>Number</td> | ||
<td></td> | ||
<td>Specifies the minimum value</td> | ||
</tr> | ||
<tr> | ||
<td>onClick</td> | ||
<td></td> | ||
<td></td> | ||
<td></td> | ||
</tr> | ||
<tr> | ||
<td>placeholder</td> | ||
<td>string</td> | ||
<td></td> | ||
<td></td> | ||
</tr> | ||
<tr> | ||
<td>max</td> | ||
<td>Number</td> | ||
<td></td> | ||
<td>Specifies the maximum value</td> | ||
</tr> | ||
<tr> | ||
<td>step</td> | ||
<td>Number or String</td> | ||
<td>1</td> | ||
<td>Specifies the legal number intervals</td> | ||
</tr> | ||
<tr> | ||
<td>precision</td> | ||
<td>Number</td> | ||
<td></td> | ||
<td>Specifies the precision length of value</td> | ||
</tr> | ||
<tr> | ||
<td>disabled</td> | ||
<td>Boolean</td> | ||
<td>false</td> | ||
<td>Specifies that an InputNumber should be disabled</td> | ||
</tr> | ||
<tr> | ||
<td>focusOnUpDown</td> | ||
<td>Boolean</td> | ||
<td>true</td> | ||
<td>whether focus input when click up or down button</td> | ||
</tr> | ||
<tr> | ||
<td>required</td> | ||
<td>Boolean</td> | ||
<td>false</td> | ||
<td>Specifies that an InputNumber is required</td> | ||
</tr> | ||
<tr> | ||
<td>autoFocus</td> | ||
<td>Boolean</td> | ||
<td>false</td> | ||
<td>Specifies that an InputNumber should automatically get focus when the page loads</td> | ||
</tr> | ||
<tr> | ||
<td>readOnly</td> | ||
<td>Boolean</td> | ||
<td>false</td> | ||
<td>Specifies that an InputNumber is read only </td> | ||
</tr> | ||
<tr> | ||
<td>controls</td> | ||
<td>Boolean</td> | ||
<td>true</td> | ||
<td>Whether to enable the control buttons</td> | ||
</tr> | ||
<tr> | ||
<td>name</td> | ||
<td>String</td> | ||
<td></td> | ||
<td>Specifies the name of an InputNumber</td> | ||
</tr> | ||
<tr> | ||
<td>id</td> | ||
<td>String</td> | ||
<td></td> | ||
<td>Specifies the id of an InputNumber</td> | ||
</tr> | ||
<tr> | ||
<td>value</td> | ||
<td>Number</td> | ||
<td></td> | ||
<td>Specifies the value of an InputNumber</td> | ||
</tr> | ||
<tr> | ||
<td>defaultValue</td> | ||
<td>Number</td> | ||
<td></td> | ||
<td>Specifies the defaultValue of an InputNumber</td> | ||
</tr> | ||
<tr> | ||
<td>onChange</td> | ||
<td>Function</td> | ||
<td></td> | ||
<td>Called when value of an InputNumber changed</td> | ||
</tr> | ||
<tr> | ||
<td>onBlur</td> | ||
<td>Function</td> | ||
<td></td> | ||
<td>Called when user leaves an input field</td> | ||
</tr> | ||
<tr> | ||
<td>onPressEnter</td> | ||
<td>Function</td> | ||
<td></td> | ||
<td>The callback function that is triggered when Enter key is pressed.</td> | ||
</tr> | ||
<tr> | ||
<td>onFocus</td> | ||
<td>Function</td> | ||
<td></td> | ||
<td>Called when an element gets focus</td> | ||
</tr> | ||
<tr> | ||
<td>style</td> | ||
<td>Object</td> | ||
<td></td> | ||
<td>root style. such as {width:100}</td> | ||
</tr> | ||
<tr> | ||
<td>upHandler</td> | ||
<td>React.Node</td> | ||
<td></td> | ||
<td>custom the up step element</td> | ||
</tr> | ||
<tr> | ||
<td>downHandler</td> | ||
<td>React.Node</td> | ||
<td></td> | ||
<td>custom the down step element</td> | ||
</tr> | ||
<tr> | ||
<td>formatter</td> | ||
<td>(value: number|string): displayValue: string</td> | ||
<td></td> | ||
<td>Specifies the format of the value presented</td> | ||
</tr> | ||
<tr> | ||
<td>parser</td> | ||
<td>(displayValue: string) => value: number</td> | ||
<td>`input => input.replace(/[^\w\.-]*/g, '')`</td> | ||
<td>Specifies the value extracted from formatter</td> | ||
</tr> | ||
<tr> | ||
<td>pattern</td> | ||
<td>string</td> | ||
<td></td> | ||
<td>Specifies a regex pattern to be added to the input number element - useful for forcing iOS to open the number pad instead of the normal keyboard (supply a regex of "\d*" to do this) or form validation</td> | ||
</tr> | ||
<tr> | ||
<td>decimalSeparator</td> | ||
<td>string</td> | ||
<td></td> | ||
<td>Specifies the decimal separator</td> | ||
</tr> | ||
<tr> | ||
<td>inputMode</td> | ||
<td>string</td> | ||
<td></td> | ||
<td>Specifies the inputmode of input</td> | ||
</tr> | ||
</tbody> | ||
</table> |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
title: Example | ||
nav: | ||
title: Example | ||
path: /example | ||
--- | ||
|
||
## simple | ||
|
||
<code src="./demo/simple.tsx"></code> | ||
|
||
## combination-key-format | ||
|
||
<code src="./demo/combination-key-format.tsx"></code> | ||
|
||
## custom | ||
|
||
<code src="./demo/custom.tsx"></code> | ||
|
||
## debug | ||
|
||
<code src="./demo/debug.tsx"></code> | ||
|
||
## decimal | ||
|
||
<code src="./demo/decimal.tsx"></code> | ||
|
||
## formatter | ||
|
||
<code src="./demo/formatter.tsx"></code> | ||
|
||
## input-control | ||
|
||
<code src="./demo/input-control.tsx"></code> | ||
|
||
## precision | ||
|
||
<code src="./demo/precision.tsx"></code> | ||
|
||
## simple-use-touch | ||
|
||
<code src="./demo/simple-use-touch.tsx"></code> | ||
|
||
## small-step | ||
|
||
<code src="./demo/small-step.tsx"></code> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,55 @@ | ||
--- | ||
title: rc-input-number | ||
hero: | ||
title: rc-input-number | ||
description: React InputNumber Component | ||
--- | ||
|
||
<embed src="../README.md"></embed> | ||
## Install | ||
|
||
```sh | ||
# npm | ||
npm install --save rc-input-number | ||
|
||
# yarn | ||
yarn install rc-input-number | ||
|
||
# pnpm | ||
pnpm i rc-input-number | ||
``` | ||
|
||
## Usage | ||
|
||
```ts | ||
import InputNumber from 'rc-input-number'; | ||
|
||
export default () => <InputNumber defaultValue={10} />; | ||
``` | ||
|
||
## Development | ||
|
||
```sh | ||
npm install | ||
npm start | ||
``` | ||
|
||
### Keyboard Navigation | ||
|
||
- When you hit the ⬆ or ⬇ key, the input value will be increased or decreased by step | ||
- With the Shift key (Shift+⬆, Shift+⬇), the input value will be changed by 10 * step | ||
- With the Ctrl or ⌘ key (Ctrl+⬆ or ⌘+⬆ or Ctrl+⬇ or ⌘+⬇ ), the input value will be changed by 0.1 * step | ||
|
||
## Test Case | ||
|
||
```sh | ||
npm test | ||
``` | ||
|
||
## Coverage | ||
|
||
```sh | ||
npm run coverage | ||
``` | ||
|
||
## License | ||
|
||
rc-input-number is released under the MIT license. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters