Skip to content

Commit d374483

Browse files
authored
feat: maxTagCount="responsive" (#578)
* feat: Support responsive * feat: Support responsive * bump rc-overflow * update snapshot
1 parent 12caa24 commit d374483

File tree

9 files changed

+828
-639
lines changed

9 files changed

+828
-639
lines changed

assets/index.less

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,20 @@
117117
}
118118
}
119119

120+
.@{select-prefix}-selection-overflow {
121+
display: flex;
122+
flex-wrap: wrap;
123+
width: 100%;
124+
125+
&-item {
126+
flex: none;
127+
max-width: 100%;
128+
}
129+
}
130+
120131
.@{select-prefix}-selection-search {
121132
position: relative;
133+
max-width: 100%;
122134

123135
&-input,
124136
&-mirror {

examples/tags.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,20 @@ for (let i = 10; i < 36; i += 1) {
1414

1515
const Test: React.FC = () => {
1616
const [disabled, setDisabled] = React.useState(false);
17-
const [value, setValue] = React.useState<string[]>(['name2', 'name3']);
18-
const [maxTagCount, setMaxTagCount] = React.useState<number>(null);
17+
const [value, setValue] = React.useState<string[]>([
18+
'name1',
19+
'name2',
20+
'name3',
21+
'name4',
22+
'name5',
23+
'a10',
24+
'b11',
25+
'c12',
26+
'd13',
27+
]);
28+
const [maxTagCount, setMaxTagCount] = React.useState<number | 'responsive'>('responsive');
1929

20-
const toggleMaxTagCount = (count: number) => {
30+
const toggleMaxTagCount = (count: number | 'responsive') => {
2131
setMaxTagCount(count);
2232
};
2333

@@ -29,7 +39,7 @@ const Test: React.FC = () => {
2939
<Select
3040
placeholder="placeholder"
3141
mode="tags"
32-
style={{ width: 500 }}
42+
style={{ width: 400 }}
3343
disabled={disabled}
3444
maxTagCount={maxTagCount}
3545
maxTagTextLength={10}
@@ -69,6 +79,9 @@ const Test: React.FC = () => {
6979
<button type="button" onClick={() => toggleMaxTagCount(null)}>
7080
toggle maxTagCount (null)
7181
</button>
82+
<button type="button" onClick={() => toggleMaxTagCount('responsive')}>
83+
toggle maxTagCount (responsive)
84+
</button>
7285
</p>
7386
<h2>tags select with open = false</h2>
7487
<div>

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,16 @@
4646
"@babel/runtime": "^7.10.1",
4747
"classnames": "2.x",
4848
"rc-motion": "^2.0.1",
49+
"rc-overflow": "^0.0.0-alpha.5",
4950
"rc-trigger": "^5.0.4",
5051
"rc-util": "^5.0.1",
51-
"rc-virtual-list": "^3.2.0",
52-
"warning": "^4.0.3"
52+
"rc-virtual-list": "^3.2.0"
5353
},
5454
"devDependencies": {
5555
"@types/enzyme": "^3.10.5",
5656
"@types/jest": "^26.0.0",
5757
"@types/react": "^16.8.19",
5858
"@types/react-dom": "^16.8.4",
59-
"@types/warning": "^3.0.0",
6059
"cross-env": "^7.0.0",
6160
"enzyme": "^3.3.0",
6261
"enzyme-to-json": "^3.4.0",

0 commit comments

Comments
 (0)