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

* docs: update docs

* docs: update demo
pull/50087/head
二货爱吃白萝卜 6 months ago committed by GitHub
parent f2ac3fcc05
commit 8c3090938f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -4,7 +4,13 @@ import { Slider } from 'antd';
const App: React.FC = () => { const App: React.FC = () => {
const [value, setValue] = React.useState([20, 80]); 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; export default App;

@ -62,6 +62,8 @@ Common props ref[Common props](/docs/react/common-props)
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| draggableTrack | Whether range track can be drag | boolean | false | - | | draggableTrack | Whether range track can be drag | boolean | false | - |
| editable | Dynamic edit nodes, can't be used with `draggableTrack` | boolean | false | 5.20.0 | | 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 ### tooltip

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

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

Loading…
Cancel
Save