From f21883401eb6ce8758633d1dc52575eaac9475e8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Jun 2026 03:49:02 +0000 Subject: [PATCH 1/4] Initial plan From 576feab3f07241c99d1d34a68378ed2fe4f1a7b3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Jun 2026 03:56:09 +0000 Subject: [PATCH 2/4] fix(input): prevent width auto causing line breaks in tag-input When autoWidth is enabled and computed width is 'auto', set width to '0px' if input has no value and no placeholder to prevent unwanted line breaks in multi-select scenarios. --- packages/components/input/hooks/useInputWidth.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/components/input/hooks/useInputWidth.ts b/packages/components/input/hooks/useInputWidth.ts index 042e41a8eb..8142cd4724 100644 --- a/packages/components/input/hooks/useInputWidth.ts +++ b/packages/components/input/hooks/useInputWidth.ts @@ -12,7 +12,13 @@ export function useInputWidth(props: TdInputProps, inputRef: Ref { if (!inputPreRef.value || !inputRef.value) return; // 使用 getComputedStyle 规避 transform 带来的影响 - inputRef.value.style.width = getComputedStyle(inputPreRef.value).width; + const computedWidth = getComputedStyle(inputPreRef.value).width; + // 当计算宽度为 auto 或无效值时,如果输入框没有内容,应设置为 0px 以避免换行 + if (computedWidth === 'auto' || !computedWidth) { + inputRef.value.style.width = !innerValue.value && !placeholder.value ? '0px' : computedWidth; + } else { + inputRef.value.style.width = computedWidth; + } }; useResizeObserver(inputPreRef, () => { From 9efcb3c13cc8bb6426e7264518059d4e31be575b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Jun 2026 03:59:57 +0000 Subject: [PATCH 3/4] fix(input): always set width to 0px when computed width is auto Simplified logic to always set width to '0px' when getComputedStyle returns 'auto', fixing line break issues in multi-select scenarios. Addresses code review feedback. --- packages/components/input/hooks/useInputWidth.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/components/input/hooks/useInputWidth.ts b/packages/components/input/hooks/useInputWidth.ts index 8142cd4724..9d638f513f 100644 --- a/packages/components/input/hooks/useInputWidth.ts +++ b/packages/components/input/hooks/useInputWidth.ts @@ -13,9 +13,10 @@ export function useInputWidth(props: TdInputProps, inputRef: Ref Date: Wed, 17 Jun 2026 04:02:56 +0000 Subject: [PATCH 4/4] fix(input): use explicit empty string check for computed width Changed condition from `!computedWidth` to `computedWidth === ''` to be more explicit and address code review feedback. --- packages/components/input/hooks/useInputWidth.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/components/input/hooks/useInputWidth.ts b/packages/components/input/hooks/useInputWidth.ts index 9d638f513f..76352cf706 100644 --- a/packages/components/input/hooks/useInputWidth.ts +++ b/packages/components/input/hooks/useInputWidth.ts @@ -13,9 +13,9 @@ export function useInputWidth(props: TdInputProps, inputRef: Ref