diff --git a/docs/range/index.en-us.md b/docs/range/index.en-us.md index 3ba6f22527..2b02cd1c1c 100644 --- a/docs/range/index.en-us.md +++ b/docs/range/index.en-us.md @@ -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<Number> | - | -| defaultValue | default value. It's in the form of `Number` when `slider` is `single` otherwise `[Number, Number]` | Number/Array<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<Number>/Object | false | | marksPosition | position for the scale

**option**:
'above', 'below' | Enum | 'above' | | disabled | disabled | Boolean | false | -| onChange | callback triggered when value changes

**signature**:
Function(value: String/number) => void
**parameter**:
_value_: {String/number} null | Function | func.noop | -| onProcess | callback triggered when slider being dragged, and used only for special need

**signature**:
Function(value: String/number) => void
**parameter**:
_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

**signature**:
Function(value: Number/String) => ReactNode
**signature**:
_value_: {Number/String} value
**returns**:
{ReactNode} content
| Function | value => value | +| tipRender | custom tip content

**signature**:
Function(value?: Number/String) => ReactNode
**signature**:
_value_: {Number/String} value
**returns**:
{ReactNode} content
| 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 | diff --git a/docs/range/index.md b/docs/range/index.md index a750d499f8..38bd76609b 100644 --- a/docs/range/index.md +++ b/docs/range/index.md @@ -28,13 +28,13 @@ | min | 最小值 | Number | 0 | | max | 最大值 | Number | 100 | | step | 步长,取值必须大于 0,并且可被 (max - min) 整除。 | Number | 1 | -| value | 设置当前取值。当 `slider` 为 `single` 时,使用 `Number`,否则用 `[Number, Number]` | Number/Array<Number> | - | -| defaultValue | 设置初始取值。当 `slider` 为 `single` 时,使用 `Number`,否则用 `[Number, Number]` | Number/Array<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<Number>/Object | false | | marksPosition | marks显示在上方('above')or下方('below')

**可选值**:
'above', 'below' | Enum | 'above' | | disabled | 值为 `true` 时,滑块为禁用状态 | Boolean | false | -| onChange | 当 Range 的值发生改变后,会触发 onChange 事件,并把改变后的值作为参数传入, 如果设置了value, 要配合此函数做受控使用

**签名**:
Function(value: String/number) => void
**参数**:
_value_: {String/number} null | Function | func.noop | -| onProcess | 滑块拖动的时候触发的事件,不建议在这里setState, 一般情况下不需要用, 滑动时有特殊需求时使用

**签名**:
Function(value: String/number) => void
**参数**:
_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 显示内容

**签名**:
Function(value: Number/String) => ReactNode
**参数**:
_value_: {Number/String} 值
**返回值**:
{ReactNode} 显示内容
| Function | value => value | | reverse | 选中态反转 | Boolean | false | diff --git a/types/range/index.d.ts b/types/range/index.d.ts index e8295a9f52..08e6945689 100644 --- a/types/range/index.d.ts +++ b/types/range/index.d.ts @@ -47,12 +47,12 @@ export interface RangeProps extends HTMLAttributesWeak, CommonProps { /** * 设置当前取值。当 `slider` 为 `single` 时,使用 `Number`,否则用 `[Number, Number]` */ - value?: number | Array; + value?: number | [number, number]; /** * 设置初始取值。当 `slider` 为 `single` 时,使用 `Number`,否则用 `[Number, Number]` */ - defaultValue?: number | Array; + defaultValue?: number | [number, number]; /** * 刻度数值显示逻辑(false 代表不显示,array 枚举显示的值,number 代表按 number 平分,object 表示按 key 划分,value 值显示) @@ -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