Browse Source

feat: slider add support for disable keyboard events (#40526)

* feat: add support disable keyboard events

* docs: add docs and types
pull/40557/head
Amumu 2 years ago
committed by GitHub
parent
commit
b84497cae2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      components/slider/index.en-US.md
  2. 1
      components/slider/index.tsx
  3. 1
      components/slider/index.zh-CN.md
  4. 2
      package.json

1
components/slider/index.en-US.md

@ -34,6 +34,7 @@ To input a value in a range.
| autoFocus | Whether get focus when component mounted | boolean | false | |
| defaultValue | The default value of slider. When `range` is false, use number, otherwise, use \[number, number] | number \| \[number, number] | 0 \| \[0, 0] | |
| disabled | If true, the slider will not be intractable | boolean | false | |
| keyboard | Support using keyboard to move handlers | boolean | true | 5.2.0+ |
| dots | Whether the thumb can drag over tick only | boolean | false | |
| included | Make effect when `marks` not null, true means containment and false means coordinative | boolean | true | |
| marks | Tick mark of Slider, type of key must be `number`, and must in closed interval \[min, max], each mark can declare its own style | object | { number: ReactNode } \| { number: { style: CSSProperties, label: ReactNode } } | |

1
components/slider/index.tsx

@ -44,6 +44,7 @@ export interface SliderBaseProps {
dots?: boolean;
included?: boolean;
disabled?: boolean;
keyboard?: boolean;
vertical?: boolean;
className?: string;
rootClassName?: string;

1
components/slider/index.zh-CN.md

@ -35,6 +35,7 @@ demo:
| allowClear | 支持清除, 单选模式有效 | boolean | false | |
| defaultValue | 设置初始取值。当 `range` 为 false 时,使用 number,否则用 \[number, number] | number \| \[number, number] | 0 \| \[0, 0] | |
| disabled | 值为 true 时,滑块为禁用状态 | boolean | false | |
| keyboard | 支持使用键盘操作 handler | boolean | true | 5.2.0+ |
| dots | 是否只能拖拽到刻度上 | boolean | false | |
| included | `marks` 不为空对象时有效,值为 true 时表示值为包含关系,false 表示并列 | boolean | true | |
| marks | 刻度标记,key 的类型必须为 `number` 且取值在闭区间 \[min, max] 内,每个标签可以单独设置样式 | object | { number: ReactNode } or { number: { style: CSSProperties, label: ReactNode } } | |

2
package.json

@ -140,7 +140,7 @@
"rc-resize-observer": "^1.2.0",
"rc-segmented": "~2.1.0",
"rc-select": "~14.2.0",
"rc-slider": "~10.0.0",
"rc-slider": "~10.1.0",
"rc-steps": "~6.0.0",
"rc-switch": "~4.0.0",
"rc-table": "~7.30.2",

Loading…
Cancel
Save