From 6efbb8508c3df70951f423ce72f0a08feb7d2ef4 Mon Sep 17 00:00:00 2001 From: Mikhail Chechnev Date: Tue, 14 Oct 2025 14:45:53 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A6=D0=98=D0=A2=D0=9A-979=20-=20=D0=A0=D0=B5?= =?UTF-8?q?=D0=B4=D0=B0=D0=BA=D1=82=D0=BE=D1=80=20=D1=83=D1=81=D0=BB=D0=BE?= =?UTF-8?q?=D0=B2=D0=B8=D1=8F=20=D0=B7=D0=B0=D0=BF=D1=80=D0=BE=D1=81=D0=B0?= =?UTF-8?q?=20-=20=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D1=8D=D0=BB=D0=B5=D0=BC=D0=B5=D0=BD=D1=82=D0=B0?= =?UTF-8?q?=20=D1=83=D1=81=D0=BB=D0=BE=D0=B2=D0=B8=D1=8F=20=D0=BF=D0=BE=20?= =?UTF-8?q?=D0=BC=D0=B5=D1=81=D1=82=D1=83=20=D0=BA=D1=83=D1=80=D1=81=D0=BE?= =?UTF-8?q?=D1=80=D0=B0/=D0=B2=D1=8B=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inspector_query_cond/query_cond_dialog.js | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/app/panels/query_editor/components/inspector_query_cond/query_cond_dialog.js b/app/panels/query_editor/components/inspector_query_cond/query_cond_dialog.js index fab290e..2f58d77 100644 --- a/app/panels/query_editor/components/inspector_query_cond/query_cond_dialog.js +++ b/app/panels/query_editor/components/inspector_query_cond/query_cond_dialog.js @@ -50,6 +50,19 @@ const QueryCondDialog = ({ cond, entities, args, onOk, onCancel }) => { } }; + //Добавление значения в редактор по месту курсора + const addCondValueToCursor = value => { + let newValue = conditions + value; + if (coditionInputRef.current) { + newValue = coditionInputRef.current.value; + newValue = + newValue.substring(0, coditionInputRef.current.selectionStart) + value + newValue.substring(coditionInputRef.current.selectionEnd); + coditionInputRef.current.value = newValue; + } + moveCondCursorToEnd(); + setConditions(newValue); + }; + //Нажатие на кнопку "ОК" const handleOk = () => onOk && onOk(conditions); @@ -60,16 +73,10 @@ const QueryCondDialog = ({ cond, entities, args, onOk, onCancel }) => { const handleChange = e => setConditions(e.target.value); //При выборе компонента условия - const handleComponentSelected = value => { - setConditions(pv => pv + value); - moveCondCursorToEnd(); - }; + const handleComponentSelected = value => addCondValueToCursor(value); //При нажатии на кнопку операции - const handleOperationButtonClick = value => { - setConditions(pv => pv + value); - moveCondCursorToEnd(); - }; + const handleOperationButtonClick = value => addCondValueToCursor(value); //При нажатии на кнопку очистки условий const handleClearClick = () => setConditions("");