From f31ae6bbf6ba080d63cb4d896a881127a3c98db5 Mon Sep 17 00:00:00 2001 From: liangling Date: Tue, 14 Jan 2025 15:22:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20profiling=E6=94=AF=E6=8C=81=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E5=80=BC=E8=87=AA=E5=AE=9A=E4=B9=89=E8=BE=93=E5=85=A5?= =?UTF-8?q?=20#=20Reviewed,=20transaction=20id:=2029202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/profiling/src/components/condition-input.tsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/profiling/src/components/condition-input.tsx b/src/profiling/src/components/condition-input.tsx index a9c2281..61d3b00 100644 --- a/src/profiling/src/components/condition-input.tsx +++ b/src/profiling/src/components/condition-input.tsx @@ -155,9 +155,15 @@ const ConditionInput: React.FC = ({ datasource, filterList, keyList, onC onChange(param); }; - const handleValueConditionKeyDown = e => { - if (e.key === 'Enter') { - e.preventDefault(); + const handleValueConditionKeyDown = (e, index: number, list: ICommonItem[]) => { + if ( + e.key === 'Enter' && + e.target.value && + !list?.some(item => item.id === e.target.value || item.name === e.target.value) + ) { + const dimension = e.target.value; + list.push({ id: dimension, name: dimension }); + handleValueChange(e.target.value, index); } }; @@ -295,7 +301,7 @@ const ConditionInput: React.FC = ({ datasource, filterList, keyList, onC showArrow={false} tokenSeparators={[',', '|', '\n', ' ', '\r\n', '\r']} onChange={v => handleValueChange(v, index)} - onInputKeyDown={v => handleValueConditionKeyDown(v)} + onInputKeyDown={v => handleValueConditionKeyDown(v, index, dimensionValueMap[item.key!] || [])} showSearch={true} > {/* {needNUll(item.key) && (