Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(design): resolve text overflow issue in Select component for long content (#2352)

白熱0ff261d8faff
diff --git a/packages/design/src/components/select/Select.stories.tsx b/packages/design/src/components/select/Select.stories.tsx
index 0bc4177ba1..cd02ae672d 100644
--- a/packages/design/src/components/select/Select.stories.tsx
+++ b/packages/design/src/components/select/Select.stories.tsx
@@ -37,7 +37,7 @@ export const SelectBasic = {
const options = [
{ label: 'Option 1', value: 'option1' },
{ label: 'Option 2', value: 'option2' },
- { label: 'Option 3', value: 'option3' },
+ { label: 'Option 3 Option 3 Option 3 Option 3 Option 3 Option 3', value: 'option3' },
];
function handleChange(value: string | number | boolean) {
@@ -55,7 +55,7 @@ export const SelectBorderless = {
const options = [
{ label: 'Option 1', value: 'option1' },
{ label: 'Option 2', value: 'option2' },
- { label: 'Option 3', value: 'option3' },
+ { label: 'Option 3 Option 3 Option 3 Option 3 Option 3 Option 3', value: 'option3' },
];
function handleChange(value: string | number | boolean) {
diff --git a/packages/design/src/components/select/index.module.less b/packages/design/src/components/select/index.module.less
index 246900fcfa..beb04dd1b4 100644
--- a/packages/design/src/components/select/index.module.less
+++ b/packages/design/src/components/select/index.module.less
@@ -90,11 +90,19 @@
pointer-events: none;
position: absolute;
- left: 10px;
+ left: 0;
height: 100%;
+ width: 100%;
+ padding: 0 18px 0 10px;
+ box-sizing: border-box;
+
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
font-size: var(--font-size-sm);
- display: inline-flex;
+ line-height: 28px;
+ display: inline-block;
align-items: center;
}
}