feat: Slider range.editable support minCount & maxCount (#49987)

* docs: update docs

* docs: update demo
This commit is contained in:
二货爱吃白萝卜 2024-07-20 17:51:26 +08:00 committed by GitHub
parent f2ac3fcc05
commit 8c3090938f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 18 deletions

View File

@ -4,7 +4,13 @@ import { Slider } from 'antd';
const App: React.FC = () => {
const [value, setValue] = React.useState([20, 80]);
return <Slider range={{ editable: true }} value={value} onChange={setValue} />;
return (
<Slider
range={{ editable: true, minCount: 1, maxCount: 5 }}
value={value}
onChange={setValue}
/>
);
};
export default App;

View File

@ -62,6 +62,8 @@ Common props ref[Common props](/docs/react/common-props)
| --- | --- | --- | --- | --- |
| draggableTrack | Whether range track can be drag | boolean | false | - |
| editable | Dynamic edit nodes, can't be used with `draggableTrack` | boolean | false | 5.20.0 |
| minCount | The minimum count of nodes | number | 0 | 5.20.0 |
| maxCount | The maximum count of nodes | number | - | 5.20.0 |
### tooltip

View File

@ -63,6 +63,8 @@ demo:
| -------------- | -------------------------------------------------- | ------- | ------ | ------ |
| draggableTrack | 范围刻度是否可被拖拽 | boolean | false | |
| editable | 启动动态增减节点,不能和 `draggableTrack` 一同使用 | boolean | false | 5.20.0 |
| minCount | 配置 `editable` 时,最小节点数量 | number | 0 | 5.20.0 |
| maxCount | 配置 `editable` 时,最大节点数量 | number | - | 5.20.0 |
### tooltip

View File

@ -26,20 +26,12 @@
"url": "https://opencollective.com/ant-design"
},
"license": "MIT",
"sideEffects": [
"*.css"
],
"sideEffects": ["*.css"],
"main": "lib/index.js",
"unpkg": "dist/antd.min.js",
"module": "es/index.js",
"typings": "es/index.d.ts",
"files": [
"dist",
"es",
"lib",
"locale",
"BUG_VERSIONS.json"
],
"files": ["dist", "es", "lib", "locale", "BUG_VERSIONS.json"],
"scripts": {
"api-collection": "antd-tools run api-collection",
"authors": "tsx scripts/generate-authors.ts",
@ -105,12 +97,7 @@
"tsc:old": "tsc --noEmit -p tsconfig-old-react.json",
"version": "tsx scripts/generate-version.ts"
},
"browserslist": [
"> 0.5%",
"last 2 versions",
"Firefox ESR",
"not dead"
],
"browserslist": ["> 0.5%", "last 2 versions", "Firefox ESR", "not dead"],
"dependencies": {
"@ant-design/colors": "^7.1.0",
"@ant-design/cssinjs": "^1.21.0",
@ -147,7 +134,7 @@
"rc-resize-observer": "^1.4.0",
"rc-segmented": "~2.3.0",
"rc-select": "~14.15.1",
"rc-slider": "~11.0.5",
"rc-slider": "~11.1.0",
"rc-steps": "~6.0.1",
"rc-switch": "~4.1.0",
"rc-table": "~7.45.7",