-
Notifications
You must be signed in to change notification settings - Fork 451
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Select support maxCount (#1012)
* feat: Select support maxCount * fix: fix * demo: update demo * test: fix test case * docs: update docs * fix: fix * fix: fix * fix: fix * test: add test case * test: fix case
- Loading branch information
1 parent
56fd0d9
commit d8a13f3
Showing
8 changed files
with
105 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
title: multiple-with-maxCount | ||
nav: | ||
title: Demo | ||
path: /demo | ||
--- | ||
|
||
<code src="../examples/multiple-with-maxCount.tsx"></code> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* eslint-disable no-console */ | ||
import React from 'react'; | ||
import Select from 'rc-select'; | ||
import '../../assets/index.less'; | ||
|
||
const Test: React.FC = () => { | ||
const [value, setValue] = React.useState<string[]>(['1']); | ||
|
||
const onChange = (v: any) => { | ||
setValue(v); | ||
}; | ||
|
||
return ( | ||
<> | ||
<h2>Multiple with maxCount</h2> | ||
<Select | ||
maxCount={4} | ||
mode="multiple" | ||
value={value} | ||
animation="slide-up" | ||
choiceTransitionName="rc-select-selection__choice-zoom" | ||
style={{ width: 500 }} | ||
optionFilterProp="children" | ||
optionLabelProp="children" | ||
placeholder="please select" | ||
onChange={onChange} | ||
options={Array.from({ length: 20 }, (_, i) => ({ | ||
label: <span>中文{i}</span>, | ||
value: i.toString(), | ||
}))} | ||
/> | ||
</> | ||
); | ||
}; | ||
|
||
export default Test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d8a13f3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
select – ./
select-git-master-react-component.vercel.app
select.vercel.app
select-react-component.vercel.app