@@ -76,6 +76,8 @@ export default function SearchSelect(props: SearchSelectProps) {
76
76
[ selectedValue . length ] ,
77
77
) ;
78
78
const divRef = useRef < HTMLDivElement > ( null ) ;
79
+ const tagContentRef = useRef < HTMLDivElement > ( null ) ;
80
+ const [ tagClientWidth , setTagClientWidth ] = React . useState ( 180 ) ;
79
81
80
82
const valueVerify = ( value : ValueType | Array < ValueType > | undefined ) => {
81
83
return value !== undefined && value !== '' ;
@@ -221,6 +223,12 @@ export default function SearchSelect(props: SearchSelectProps) {
221
223
}
222
224
}
223
225
226
+ React . useEffect ( ( ) => {
227
+ if ( tagContentRef . current ?. clientWidth ) {
228
+ setTagClientWidth ( tagContentRef . current ?. clientWidth ) ;
229
+ }
230
+ } , [ tagContentRef . current ] ) ;
231
+
224
232
return (
225
233
< Dropdown
226
234
className = { cls }
@@ -275,6 +283,7 @@ export default function SearchSelect(props: SearchSelectProps) {
275
283
. trim ( ) }
276
284
>
277
285
< div
286
+ ref = { tagContentRef }
278
287
className = { [ `${ prefixCls } -tag-content` , disabled && `${ prefixCls } -tag-content-disabled` ]
279
288
. filter ( Boolean )
280
289
. join ( ' ' )
@@ -301,7 +310,15 @@ export default function SearchSelect(props: SearchSelectProps) {
301
310
handleItemsClick ( index , item ) ;
302
311
} }
303
312
>
304
- { item . label }
313
+ < span
314
+ style = { {
315
+ maxWidth : tagClientWidth - 48 ,
316
+ textOverflow : 'ellipsis' ,
317
+ overflow : 'auto' ,
318
+ } }
319
+ >
320
+ { item . label }
321
+ </ span >
305
322
</ Tag >
306
323
) ;
307
324
} ) }
@@ -323,14 +340,14 @@ export default function SearchSelect(props: SearchSelectProps) {
323
340
placeholder = { selectedValue . length ? '' : placeholder }
324
341
/>
325
342
</ div >
326
- { ! disabled && ( selectIconType === 'close' || ( selectIconType === 'loading' && loading ) ) && (
327
- < Icon
328
- className = { `${ prefixCls } -multiple-colse` }
329
- type = { selectIconType }
330
- spin = { loading && selectIconType === 'loading' }
331
- onClick = { resetSelectedValue }
332
- />
333
- ) }
343
+ { /* { !disabled && (selectIconType === 'close' || (selectIconType === 'loading' && loading)) && ( */ }
344
+ < Icon
345
+ className = { `${ prefixCls } -multiple-colse` }
346
+ type = { 'close' }
347
+ spin = { loading && selectIconType === 'loading' }
348
+ onClick = { resetSelectedValue }
349
+ />
350
+ { /* )} */ }
334
351
</ div >
335
352
) : (
336
353
< Input
0 commit comments