Skip to content

Commit

Permalink
fix(Range): onProcess&onChange props type error fix #2769 (#3816)
Browse files Browse the repository at this point in the history
* fix(Range): onProcess&onChange props type error

Co-authored-by: ranrui.cwj <[email protected]>
  • Loading branch information
2 people authored and 潕量 committed Mar 25, 2022
1 parent a407931 commit 3768a0d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions docs/range/index.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ Range Component is used to select a value in a range by dragging slider. Normall
| min | minimal value | Number | 0 |
| max | maximal value | Number | 100 |
| step | step of the range, which is positive integer and (max - min) can be divided by it | Number | 1 |
| value | current value. It's in the form of `Number` when `slider` is `single` otherwise `[Number, Number]` | Number/Array&lt;Number> | - |
| defaultValue | default value. It's in the form of `Number` when `slider` is `single` otherwise `[Number, Number]` | Number/Array&lt;Number> | - |
| value | current value. It's in the form of `Number` when `slider` is `single` otherwise `[Number, Number]` | Number/[Number, Number] | - |
| defaultValue | default value. It's in the form of `Number` when `slider` is `single` otherwise `[Number, Number]` | Number/[Number, Number] | - |
| marks | way to show the scale. (`false` means nothing, `array` means enum, `number` means equal division, and `object` means `key` as the mark with `value` as the value) | Boolean/Number/Array&lt;Number>/Object | false |
| marksPosition | position for the scale<br><br>**option**:<br>'above', 'below' | Enum | 'above' |
| disabled | disabled | Boolean | false |
| onChange | callback triggered when value changes<br><br>**signature**:<br>Function(value: String/number) => void<br>**parameter**:<br>_value_: {String/number} null | Function | func.noop |
| onProcess | callback triggered when slider being dragged, and used only for special need<br><br>**signature**:<br>Function(value: String/number) => void<br>**parameter**:<br>_value_: {String/number} null | Function | func.noop |
| onChange | callback triggered when value changes | Function(value: Number/[Number, Number]) => void | func.noop |
| onProcess | callback triggered when slider being dragged, and used only for special need | Function(value: Number/[Number, Number]) => void | func.noop |
| hasTip | whether to show tip | Boolean | true |
| tipRender | custom tip content<br><br>**signature**:<br>Function(value: Number/String) => ReactNode<br>**signature**:<br>_value_: {Number/String} value<br>**returns**:<br>{ReactNode} content<br> | Function | value => value |
| tipRender | custom tip content<br><br>**signature**:<br>Function(value?: Number/String) => ReactNode<br>**signature**:<br>_value_: {Number/String} value<br>**returns**:<br>{ReactNode} content<br> | Function | value => value |
| reverse | reverse the selected part | Boolean | false |
| pure | pure render or not | Boolean | false |
| fixedWidth | drag a line with fixed width. It considers `slider` as `double`, and `defaultValue` must be a interval. | Boolean | false |
Expand Down
8 changes: 4 additions & 4 deletions docs/range/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
| min | 最小值 | Number | 0 |
| max | 最大值 | Number | 100 |
| step | 步长,取值必须大于 0,并且可被 (max - min) 整除。 | Number | 1 |
| value | 设置当前取值。当 `slider``single` 时,使用 `Number`,否则用 `[Number, Number]` | Number/Array&lt;Number> | - |
| defaultValue | 设置初始取值。当 `slider``single` 时,使用 `Number`,否则用 `[Number, Number]` | Number/Array&lt;Number> | - |
| value | 设置当前取值。当 `slider``single` 时,使用 `Number`,否则用 `[Number, Number]` | Number/[Number, Number] | - |
| defaultValue | 设置初始取值。当 `slider``single` 时,使用 `Number`,否则用 `[Number, Number]` | Number/[Number, Number] | - |
| marks | 刻度数值显示逻辑(false 代表不显示,array 枚举显示的值,number 代表按 number 平分,object 表示按 key 划分,value 值显示) | Boolean/Number/Array&lt;Number>/Object | false |
| marksPosition | marks显示在上方('above')or下方('below')<br/><br/>**可选值**:<br/>'above', 'below' | Enum | 'above' |
| disabled | 值为 `true` 时,滑块为禁用状态 | Boolean | false |
| onChange | 当 Range 的值发生改变后,会触发 onChange 事件,并把改变后的值作为参数传入, 如果设置了value, 要配合此函数做受控使用<br/><br/>**签名**:<br/>Function(value: String/number) => void<br/>**参数**:<br/>_value_: {String/number} null | Function | func.noop |
| onProcess | 滑块拖动的时候触发的事件,不建议在这里setState, 一般情况下不需要用, 滑动时有特殊需求时使用<br/><br/>**签名**:<br/>Function(value: String/number) => void<br/>**参数**:<br/>_value_: {String/number} null | Function | func.noop |
| onChange | 当 Range 的值发生改变后,会触发 onChange 事件,并把改变后的值作为参数传入, 如果设置了value, 要配合此函数做受控使用 | Function(value: Number/[Number, Number]) => void | func.noop |
| onProcess | 滑块拖动的时候触发的事件,不建议在这里setState, 一般情况下不需要用, 滑动时有特殊需求时使用 | Function(value: Number/[Number, Number]) => void | func.noop |
| hasTip | 是否显示 tip | Boolean | true |
| tipRender | 自定义 tip 显示内容<br/><br/>**签名**:<br/>Function(value: Number/String) => ReactNode<br/>**参数**:<br/>_value_: {Number/String} 值<br/>**返回值**:<br/>{ReactNode} 显示内容<br/> | Function | value => value |
| reverse | 选中态反转 | Boolean | false |
Expand Down
8 changes: 4 additions & 4 deletions types/range/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ export interface RangeProps extends HTMLAttributesWeak, CommonProps {
/**
* 设置当前取值。当 `slider` 为 `single` 时,使用 `Number`,否则用 `[Number, Number]`
*/
value?: number | Array<number>;
value?: number | [number, number];

/**
* 设置初始取值。当 `slider` 为 `single` 时,使用 `Number`,否则用 `[Number, Number]`
*/
defaultValue?: number | Array<number>;
defaultValue?: number | [number, number];

/**
* 刻度数值显示逻辑(false 代表不显示,array 枚举显示的值,number 代表按 number 平分,object 表示按 key 划分,value 值显示)
Expand All @@ -72,12 +72,12 @@ export interface RangeProps extends HTMLAttributesWeak, CommonProps {
/**
* 当 Range 的值发生改变后,会触发 onChange 事件,并把改变后的值作为参数传入, 如果设置了value, 要配合此函数做受控使用
*/
onChange?: (value: number) => void;
onChange?: (value: number | [number, number]) => void;

/**
* 滑块拖动的时候触发的事件,不建议在这里setState, 一般情况下不需要用, 滑动时有特殊需求时使用
*/
onProcess?: (value: number) => void;
onProcess?: (value: number | [number, number]) => void;

/**
* 是否显示 tip
Expand Down

0 comments on commit 3768a0d

Please sign in to comment.