Skip to content

Commit

Permalink
chore: upgrade dumi v4
Browse files Browse the repository at this point in the history
  • Loading branch information
wangxingkang committed Dec 11, 2022
1 parent 0f8765e commit a583df6
Show file tree
Hide file tree
Showing 27 changed files with 315 additions and 53 deletions.
14 changes: 14 additions & 0 deletions .dumirc.ts
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; }`],
});
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@ package-lock.json
.umi-production
.umi-test
.env.local

# dumi
.dumi/tmp
.dumi/tmp-production

19 changes: 0 additions & 19 deletions .umirc.ts

This file was deleted.

194 changes: 194 additions & 0 deletions docs/api.md
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>
3 changes: 0 additions & 3 deletions docs/demo/combination-key-format.md

This file was deleted.

File renamed without changes.
3 changes: 0 additions & 3 deletions docs/demo/custom.md

This file was deleted.

File renamed without changes.
3 changes: 0 additions & 3 deletions docs/demo/debug.md

This file was deleted.

File renamed without changes.
3 changes: 0 additions & 3 deletions docs/demo/decimal.md

This file was deleted.

File renamed without changes.
3 changes: 0 additions & 3 deletions docs/demo/formatter.md

This file was deleted.

File renamed without changes.
3 changes: 0 additions & 3 deletions docs/demo/input-control.md

This file was deleted.

File renamed without changes.
3 changes: 0 additions & 3 deletions docs/demo/precision.md

This file was deleted.

File renamed without changes.
3 changes: 0 additions & 3 deletions docs/demo/simple-use-touch.md

This file was deleted.

File renamed without changes.
3 changes: 0 additions & 3 deletions docs/demo/simple.md

This file was deleted.

File renamed without changes.
3 changes: 0 additions & 3 deletions docs/demo/small-step.md

This file was deleted.

File renamed without changes.
48 changes: 48 additions & 0 deletions docs/example.md
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>


54 changes: 52 additions & 2 deletions docs/index.md
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.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
"@types/responselike": "^1.0.0",
"@umijs/test": "^4.0.36",
"@umijs/fabric": "^2.0.0",
"cross-env": "^7.0.0",
"dumi": "^1.1.0",
"cross-env": "^7.0.3",
"dumi": "^2.0.13",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"eslint": "^7.1.0",
Expand Down

0 comments on commit a583df6

Please sign in to comment.