Test select (#4611)

* 修复表单单选选中长文本时,文字溢出选择框的问题;修复表单单选下拉选项在移动端界面上触发自动换行时部分文字位于屏幕之外的问题 (#4600)

* fix: 修复表单单选选中长文本时,文字溢出选择框的问题

* fix: 修复表单单选下拉选项在移动端界面上触发自动换行时部分文字位于屏幕之外的问题

* perf: select components

---------

Co-authored-by: mmagi <magizhang@qq.com>
This commit is contained in:
Archer
2025-04-21 15:02:54 +08:00
committed by GitHub
parent 9cd6d2e81f
commit d8fe9806e6

View File

@@ -166,20 +166,14 @@ const MySelect = <T = any,>(
const isSelecting = loading || isLoading; const isSelecting = loading || isLoading;
return ( return (
<Box <Box>
css={css({
'& div': {
width: 'auto !important'
}
})}
>
<Menu <Menu
autoSelect={false} autoSelect={false}
isOpen={isOpen && !isSelecting} isOpen={isOpen && !isSelecting}
onOpen={onOpen} onOpen={onOpen}
onClose={onClose} onClose={onClose}
strategy={'fixed'} strategy={'fixed'}
matchWidth // matchWidth
> >
<MenuButton <MenuButton
as={Button} as={Button}
@@ -191,6 +185,9 @@ const MySelect = <T = any,>(
size={'md'} size={'md'}
fontSize={'sm'} fontSize={'sm'}
textAlign={'left'} textAlign={'left'}
h={'auto'}
whiteSpace={'pre-wrap'}
wordBreak={'break-word'}
_active={{ _active={{
transform: 'none' transform: 'none'
}} }}
@@ -239,7 +236,7 @@ const MySelect = <T = any,>(
<MenuList <MenuList
ref={MenuListRef} ref={MenuListRef}
className={props.className} className={props.className}
minW={(() => { w={(() => {
const w = ButtonRef.current?.clientWidth; const w = ButtonRef.current?.clientWidth;
if (w) { if (w) {
return `${w}px !important`; return `${w}px !important`;
@@ -248,7 +245,6 @@ const MySelect = <T = any,>(
? width.map((item) => `${item} !important`) ? width.map((item) => `${item} !important`)
: `${width} !important`; : `${width} !important`;
})()} })()}
w={'auto'}
px={'6px'} px={'6px'}
py={'6px'} py={'6px'}
border={'1px solid #fff'} border={'1px solid #fff'}