Skip to content

Commit

Permalink
docs(NumberPicker): generate numberpicker api for 1.24
Browse files Browse the repository at this point in the history
  • Loading branch information
galo.gm committed Jun 4, 2021
1 parent f1e3ded commit cf3cf89
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 37 deletions.
4 changes: 2 additions & 2 deletions docs/number-picker/demo/accessibility.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# 无障碍支持

- order: 8
- order: 11

组件内置了部分支持无障碍, 但是额外需要开发者手动设置才能完整支持无障碍: 设置upBtnprops以及downBtnprops,使得读屏软件可以正确表达按键的具体功能。设置`aria-live`目的是`NumberPicker`组件值发生改变时,读屏软件会进行读取。

:::lang=en-us
# Accessibility

- order: 8
- order: 11

The component is partially built to support accessibility, but requires additional developer manual Settings to fully support accessibility: upBtnprops and downBtnprops are set up to enable the screen reader to correctly express the specific functions of the buttons. set `aria-live` purpose is `NumberPicker` component value change, screen reader will be read.

Expand Down
6 changes: 3 additions & 3 deletions docs/number-picker/demo/bignumber.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# 大数 与 高精度小数

- order: 11
- order: 8

通过 `stringMode` 开启 大数 与 高精度小数 支持。
通过 `stringMode` 开启 大数 与 高精度小数 支持,输入输出都变为 `String` 类型


:::lang=en-us
# support big number

- order: 11
- order: 8

get big number support via `stringMode`
:::
Expand Down
4 changes: 2 additions & 2 deletions docs/number-picker/demo/mobile.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# 移动端

- order: 9
- order: 10

device=phone 下会强制设置 type=normal

:::lang=en-us
# Basic Usage

- order: 9
- order: 10

force set type=normal while device=phone

Expand Down
4 changes: 2 additions & 2 deletions docs/number-picker/demo/trigger.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# 按钮控制

- order: 11
- order: 9

控制按钮一致显示、隐藏


:::lang=en-us
# trigger controls

- order: 3
- order: 9

control button trigger show without hover or hide
:::
Expand Down
59 changes: 31 additions & 28 deletions docs/number-picker/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,38 +24,41 @@

3. 如果输入时没触发onChange,会在onBlur检测数据正确性并触发onChange

4.`1.24` 版本加入大数支持,通过 `stringMode` 开启大数或高精度小数支持,输入输出都变为 `String` 类型,具体参考[大数 与 高精度小数](#bignumber-container)

## API

### NumberPicker

| 参数 | 说明 | 类型 | 默认值 | | |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ----------------------- | --- | -------------------- |
| size | 大小<br><br>**可选值**:<br>'large', 'medium', 'small' | Enum | 'medium' | | |
| type | 设置类型(当 device 为 phone 时,NumberPicker 的类型强制为 normal,不可通过 type 修改)<br><br>**可选值**:<br>'normal'(普通)<br>'inline'(内联) | Enum | 'normal' | | |
| value | 当前值 | Number | - | | |
| defaultValue | 默认值 | Number | - | | |
| disabled | 是否禁用 | Boolean | - | | |
| step | 步长 | Number/String | 1 | | |
| precision | 保留小数点后位数 | Number | 0 | | |
| editable | 用户是否可以输入 | Boolean | true | | |
| autoFocus | 自动焦点 | Boolean | - | | |
| onChange | 数值被改变的事件<br><br>**签名**:<br>Function(value: Number, e: Event) => void<br>**参数**:<br>_value_: {Number} 数据<br>_e_: {Event} DOM事件对象 | Function | func.noop | | |
| onKeyDown | 键盘按下<br><br>**签名**:<br>Function() => void | Function | func.noop | | |
| onFocus | 焦点获得<br><br>**签名**:<br>Function() => void | Function | - | | |
| onBlur | 焦点失去<br><br>**签名**:<br>Function() => void | Function | func.noop | | |
| onCorrect | 数值订正后的回调<br><br>**签名**:<br>Function(obj: Object) => void<br>**参数**:<br>_obj_: {Object} {currentValue,oldValue:String} | Function | func.noop | | |
| max | 最大值 | Number | Number.MAX_SAFE_INTEGER | | Math.pow(2, 53) - 1 |
| min | 最小值 | Number | Number.MIN_SAFE_INTEGER | | -Math.pow(2, 53) + 1 |
| format | 格式化当前值<br><br>**签名**:<br>Function(value: Number) => String/Number<br>**参数**:<br>_value_: {Number} null<br>**返回值**:<br>{String/Number} null<br> | Function | - | | |
| upBtnProps | 增加按钮的props | Object | - | | |
| downBtnProps | 减少按钮的props | Object | - | | |
| label | 内联 label | ReactNode | - | | |
| innerAfter | inner after | ReactNode | - | | |
| isPreview | 是否为预览态 | Boolean | - | | |
| renderPreview | 预览态模式下渲染的内容<br><br>**签名**:<br>Function(value: number) => void<br>**参数**:<br>_value_: {number} 评分值 | Function | - | | |
| device | 预设屏幕宽度<br><br>**可选值**:<br>'phone', 'tablet', 'desktop' | Enum | - | | |
| hasTrigger | 是否展示点击按钮 | Boolean | true | | |
| alwaysShowTrigger | 是否一直显示点击按钮(无须hover) | Boolean | false | | |
| 参数 | 说明 | 类型 | 默认值 | 版本支持 | |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------- | ----------------------- | ---- | -------------------- |
| size | 大小<br><br>**可选值**:<br>'large', 'medium', 'small' | Enum | 'medium' | | |
| type | 设置类型(当 device 为 phone 时,NumberPicker 的类型强制为 normal,不可通过 type 修改)<br><br>**可选值**:<br>'normal'(普通)<br>'inline'(内联) | Enum | 'normal' | | |
| value | 当前值 | Number/String | - | | |
| defaultValue | 默认值 | Number/String | - | | |
| disabled | 是否禁用 | Boolean | - | | |
| step | 步长 | Number/String | 1 | | |
| precision | 保留小数点后位数 | Number | 0 | | |
| editable | 用户是否可以输入 | Boolean | true | | |
| autoFocus | 自动焦点 | Boolean | - | | |
| onChange | 数值被改变的事件<br><br>**签名**:<br>Function(value: Number/String, e: Event) => void<br>**参数**:<br>_value_: {Number/String} 数据<br>_e_: {Event} DOM事件对象 | Function | func.noop | | |
| onKeyDown | 键盘按下<br><br>**签名**:<br>Function(e: Event) => void<br>**参数**:<br>_e_: {Event} DOM事件对象 | Function | func.noop | | |
| onFocus | 焦点获得<br><br>**签名**:<br>Function(e: Event) => void<br>**参数**:<br>_e_: {Event} DOM事件对象 | Function | - | | |
| onBlur | 焦点失去<br><br>**签名**:<br>Function(e: Event) => void<br>**参数**:<br>_e_: {Event} DOM事件对象 | Function | func.noop | | |
| onCorrect | 数值订正后的回调<br><br>**签名**:<br>Function(obj: Object) => void<br>**参数**:<br>_obj_: {Object} {currentValue,oldValue:String} | Function | func.noop | | |
| max | 最大值 | Number/String | Number.MAX_SAFE_INTEGER | | Math.pow(2, 53) - 1 |
| min | 最小值 | Number/String | Number.MIN_SAFE_INTEGER | | -Math.pow(2, 53) + 1 |
| format | 格式化当前值<br><br>**签名**:<br>Function(value: Number) => String/Number<br>**参数**:<br>_value_: {Number} null<br>**返回值**:<br>{String/Number} null<br> | Function | - | | |
| upBtnProps | 增加按钮的props | Object | - | | |
| downBtnProps | 减少按钮的props | Object | - | | |
| label | 内联 左侧label | ReactNode | - | | |
| innerAfter | 内联 右侧附加内容 | ReactNode | - | | |
| isPreview | 是否为预览态 | Boolean | - | | |
| renderPreview | 预览态模式下渲染的内容<br><br>**签名**:<br>Function(value: Number/String, props: Object) => reactNode<br>**参数**:<br>_value_: {Number/String} 当前值<br>_props_: {Object} 传入的组件参数<br>**返回值**:<br>{reactNode} Element 渲染内容<br> | Function | - | | |
| device | 预设屏幕宽度<br><br>**可选值**:<br>'phone', 'tablet', 'desktop' | Enum | - | | |
| hasTrigger | 是否展示点击按钮 | Boolean | true | | |
| alwaysShowTrigger | 是否一直显示点击按钮(无须hover) | Boolean | false | | |
| stringMode | 开启大数支持,输入输出均为string类型 | Boolean | false | 1.24 | |

## 无障碍键盘操作指南

Expand Down

0 comments on commit cf3cf89

Please sign in to comment.