11<div align =" center " >
22 <h1 >@rc-component/slider</h1 >
3- <p ><sub >Ant Design 生态的一部分。</sub ></p >
4- <img alt =" Ant Design " height =" 32 " src =" https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg " />
3+ <p ><sub ><img alt =" Ant Design " height =" 14 " src =" https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg " style =" vertical-align : -0.125em ;" /> Ant Design 生态的一部分。</sub ></p >
54 <p >🎚️ React 滑动输入组件,支持范围、刻度、提示和键盘交互。</p >
65
76 <p >
1918
2019## 特性
2120
22- - 支持 single-value and range sliders with one shared component.
23- - 提供 marks, dots, keyboard interaction, reverse and vertical layouts.
24- - 支持 editable range handles and draggable tracks through ` range ` config.
25- - 暴露 semantic ` classNames ` and ` styles ` slots for tracks, rail, and handles.
21+ - 通过一个共享组件支持单值和范围滑块。
22+ - 提供标记、点、键盘交互、反向和垂直布局。
23+ - 通过 ` range ` 配置支持可编辑范围手柄和可拖动轨道。
24+ - 引入用于轨道、导轨和手柄的语义 ` classNames ` 和 ` styles ` 插槽。
2625
2726## 安装
2827
@@ -52,73 +51,73 @@ export default () => (
5251);
5352```
5453
55- Online preview: https://slider.react-component.vercel.app/
54+ 在线预览: https://slider.react-component.vercel.app/
5655
5756## API
5857
5958### Slider
6059
6160| 名称 | 类型 | 默认值 | 说明 |
6261| --- | --- | --- | --- |
63- | ` activeDotStyle ` | React.CSSProperties \| ` (dotValue: number) => React.CSSProperties ` | - | Style for active dots. |
64- | ` activeHandleRender ` | ` HandlesProps['handleRender'] ` | - | Render function for the active handle. |
65- | ` allowCross ` | boolean | true | Allow handles to cross in range mode. |
62+ | ` activeDotStyle ` | React.CSSProperties \| ` (dotValue: number) => React.CSSProperties ` | - | 激活点的样式。 |
63+ | ` activeHandleRender ` | ` HandlesProps['handleRender'] ` | - | 活动句柄的渲染函数。 |
64+ | ` allowCross ` | boolean | true | 允许手柄在范围模式下交叉。 |
6665| ` ariaLabelForHandle ` | string \| string[ ] | - | ` aria-label ` for handle elements. |
6766| ` ariaLabelledByForHandle ` | string \| string[ ] | - | ` aria-labelledby ` for handle elements. |
6867| ` ariaRequired ` | boolean | - | ` aria-required ` for handle elements. |
6968| ` ariaValueTextFormatterForHandle ` | ` ((value: number) => string) \| ((value: number) => string)[] ` | - | Formatter for ` aria-valuetext ` . |
70- | ` autoFocus ` | boolean | - | Focus the slider on mount. |
71- | ` className ` | string | - | Additional class name. |
72- | ` classNames ` | ` Partial<Record<'tracks' \| 'track' \| 'rail' \| 'handle', string>> ` | - | Semantic class names for internal slots. |
73- | ` count ` | number | - | Deprecated. Use ` range.minCount ` or ` range.maxCount ` . |
74- | ` defaultValue ` | number \| number[ ] | - | Initial value. |
75- | ` disabled ` | boolean \| boolean[ ] | false | Disable all handles or specific handles. |
76- | ` dots ` | boolean | false | Show dots at each valid step position. |
77- | ` dotStyle ` | React.CSSProperties \| ` (dotValue: number) => React.CSSProperties ` | - | Style for dots. |
78- | ` handleRender ` | ` HandlesProps['handleRender'] ` | - | Custom handle renderer. |
79- | ` handleStyle ` | React.CSSProperties \| React.CSSProperties[ ] | - | Deprecated. Use ` styles.handle ` . |
80- | ` id ` | string | - | Root id. |
81- | ` included ` | boolean | true | Whether the track is rendered as a continuous selected interval. |
82- | ` keyboard ` | boolean | true | Enable keyboard interaction. |
69+ | ` autoFocus ` | boolean | - | 将滑块聚焦在安装座上。 |
70+ | ` className ` | string | - | 附加className。 |
71+ | ` classNames ` | ` Partial<Record<'tracks' \| 'track' \| 'rail' \| 'handle', string>> ` | - | 内部插槽的语义化 className。 |
72+ | ` count ` | number | - | 已废弃。请使用 ` range.minCount ` 或 ` range.maxCount ` 。 |
73+ | ` defaultValue ` | number \| number[ ] | - | 初始值。 |
74+ | ` disabled ` | boolean \| boolean[ ] | false | 禁用全部滑块或指定滑块。 |
75+ | ` dots ` | boolean | false | 在每个有效步骤位置显示点。 |
76+ | ` dotStyle ` | React.CSSProperties \| ` (dotValue: number) => React.CSSProperties ` | - | 点的样式。 |
77+ | ` handleRender ` | ` HandlesProps['handleRender'] ` | - | 自定义句柄渲染器。 |
78+ | ` handleStyle ` | React.CSSProperties \| React.CSSProperties[ ] | - | 已废弃。请使用 ` styles.handle ` 。 |
79+ | ` id ` | string | - | 根 ID。 |
80+ | ` included ` | boolean | true | 轨道是否渲染为连续的选定间隔。 |
81+ | ` keyboard ` | boolean | true | 启用键盘交互。 |
8382| ` marks ` | ` Record<string \| number, ReactNode \| MarkObj> ` | - | Slider marks. |
84- | ` max ` | number | 100 | Maximum value. |
85- | ` min ` | number | 0 | Minimum value. |
86- | ` onAfterChange ` | ` (value) => void ` | - | Deprecated. Use ` onChangeComplete ` . |
87- | ` onBeforeChange ` | ` (value) => void ` | - | Deprecated. Use ` onChange ` . |
88- | ` onBlur ` | ` (event) => void ` | - | Blur handler. |
89- | ` onChange ` | ` (value) => void ` | - | Triggered while value changes. |
90- | ` onChangeComplete ` | ` (value) => void ` | - | Triggered when interaction completes. |
91- | ` onFocus ` | ` (event) => void ` | - | Focus handler. |
92- | ` prefixCls ` | string | ` 'rc-slider' ` | Prefix class name. |
93- | ` pushable ` | boolean \| number | false | Push adjacent handles in range mode. |
94- | ` railStyle ` | React.CSSProperties | - | Deprecated. Use ` styles.rail ` . |
95- | ` range ` | boolean \| RangeConfig | false | Enable range mode or configure editable range behavior. |
96- | ` reverse ` | boolean | false | Render in reverse direction. |
97- | ` startPoint ` | number | ` min ` | Start point for a single-value track. |
98- | ` step ` | number \| null | 1 | Step size. Use ` null ` to use marks as steps. |
99- | ` style ` | React.CSSProperties | - | Root style. |
100- | ` styles ` | ` Partial<Record<'tracks' \| 'track' \| 'rail' \| 'handle', React.CSSProperties>> ` | - | Semantic styles for internal slots. |
101- | ` tabIndex ` | number \| number[ ] | 0 | Handle tab index. |
102- | ` track ` | boolean | - | Whether to render track elements. |
103- | ` trackStyle ` | React.CSSProperties \| React.CSSProperties[ ] | - | Deprecated. Use ` styles.track ` . |
104- | ` value ` | number \| number[ ] | - | Controlled value. |
105- | ` vertical ` | boolean | false | Render vertically. |
83+ | ` max ` | number | 100 | 最大值。 |
84+ | ` min ` | number | 0 | 最小值。 |
85+ | ` onAfterChange ` | ` (value) => void ` | - | 已废弃。请使用 ` onChangeComplete ` 。 |
86+ | ` onBeforeChange ` | ` (value) => void ` | - | 已废弃。请使用 ` onChange ` 。 |
87+ | ` onBlur ` | ` (event) => void ` | - | 模糊处理程序。 |
88+ | ` onChange ` | ` (value) => void ` | - | 当值改变时触发。 |
89+ | ` onChangeComplete ` | ` (value) => void ` | - | 交互完成时触发。 |
90+ | ` onFocus ` | ` (event) => void ` | - | 焦点处理程序。 |
91+ | ` prefixCls ` | string | ` 'rc-slider' ` | 前缀className。 |
92+ | ` pushable ` | boolean \| number | false | 范围模式下推动相邻滑块。 |
93+ | ` railStyle ` | React.CSSProperties | - | 已废弃。请使用 ` styles.rail ` 。 |
94+ | ` range ` | boolean \| RangeConfig | false | 启用范围模式或配置可编辑范围行为。 |
95+ | ` reverse ` | boolean | false | 以相反方向渲染。 |
96+ | ` startPoint ` | number | ` min ` | 单值轨迹的起点。 |
97+ | ` step ` | number \| null | 1 | 步长。使用 ` null ` 时以标记作为步进。 |
98+ | ` style ` | React.CSSProperties | - | 根样式。 |
99+ | ` styles ` | ` Partial<Record<'tracks' \| 'track' \| 'rail' \| 'handle', React.CSSProperties>> ` | - | 内部插槽的语义化样式。 |
100+ | ` tabIndex ` | number \| number[ ] | 0 | 滑块的 tabIndex。 |
101+ | ` track ` | boolean | - | 是否渲染轨道元素。 |
102+ | ` trackStyle ` | React.CSSProperties \| React.CSSProperties[ ] | - | 已废弃。请使用 ` styles.track ` 。 |
103+ | ` value ` | number \| number[ ] | - | 受控值。 |
104+ | ` vertical ` | boolean | false | 垂直渲染。 |
106105
107106### RangeConfig
108107
109108| 名称 | 类型 | 默认值 | 说明 |
110109| ---------------- | ------- | ------- | ---------------------------------------- |
111- | ` draggableTrack ` | boolean | false | Allow dragging the selected range track. |
112- | ` editable ` | boolean | false | Allow adding or removing range handles. |
113- | ` maxCount ` | number | - | Maximum handle count when editable. |
114- | ` minCount ` | number | - | Minimum handle count when editable. |
110+ | ` draggableTrack ` | boolean | false | 允许拖动选定的范围轨道。 |
111+ | ` editable ` | boolean | false | 允许添加或删除范围手柄。 |
112+ | ` maxCount ` | number | - | 可编辑时的最大句柄数。 |
113+ | ` minCount ` | number | - | 可编辑时的最小句柄数。 |
115114
116115### Ref
117116
118117| 名称 | 类型 | 说明 |
119118| ------- | ------------ | ----------------- |
120- | ` blur ` | ` () => void ` | Blur the slider. |
121- | ` focus ` | ` () => void ` | Focus the slider. |
119+ | ` blur ` | ` () => void ` | 模糊滑块。 |
120+ | ` focus ` | ` () => void ` | 聚焦滑块。 |
122121
123122## 本地开发
124123
@@ -137,8 +136,8 @@ npm run build
137136npm run prepublishOnly
138137```
139138
140- The release flow is handled by ` @rc-component/np ` through the ` rc-np ` command after the package build.
139+ 包构建完成后,发布流程由 ` @rc-component/np ` 通过 ` rc-np ` 命令处理。
141140
142141## 许可证
143142
144- @rc-component/slider is released under the [ MIT] ( ./LICENSE ) license.
143+ @rc-component/slider 基于 [ MIT] ( ./LICENSE ) 许可证发布。
0 commit comments