From b8c34aeebb8a3abe17a6481ae153228fd4a01a67 Mon Sep 17 00:00:00 2001 From: Jindrich Susen Date: Thu, 20 Jul 2023 13:54:47 +0200 Subject: [PATCH 1/2] Last valid dropdown value was selected after pressing enter even though the current text in the input resulted in no valid values in the dropdown --- .../Editors/DropdownEditor/DropdownEditorBehavior.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend-html/src/modules/Editors/DropdownEditor/DropdownEditorBehavior.tsx b/frontend-html/src/modules/Editors/DropdownEditor/DropdownEditorBehavior.tsx index e8d1886f0f..f39dfe563b 100644 --- a/frontend-html/src/modules/Editors/DropdownEditor/DropdownEditorBehavior.tsx +++ b/frontend-html/src/modules/Editors/DropdownEditor/DropdownEditorBehavior.tsx @@ -214,8 +214,8 @@ export class DropdownEditorBehavior implements IDropdownEditorBehavior{ break; case "Enter": const wasDropped = this.isDropped; - if (this.isDropped && !this.isWorking && this.cursorRowId) { - this.data.chooseNewValue(this.cursorRowId); + if (this.isDropped && !this.isWorking) { + this.data.chooseNewValue(this.cursorRowId === "" ? null : this.cursorRowId); this.dropUp(); } if (wasDropped) { @@ -228,7 +228,7 @@ export class DropdownEditorBehavior implements IDropdownEditorBehavior{ case "Tab": if (this.isDropped) { if (this.cursorRowId) { - this.data.chooseNewValue(this.cursorRowId); + this.data.chooseNewValue(this.cursorRowId === "" ? null : this.cursorRowId); } } break; @@ -394,6 +394,9 @@ export class DropdownEditorBehavior implements IDropdownEditorBehavior{ if (this.dataTable.rows.length > 0) { this.cursorRowId = this.dataTable.getRowIdentifierByIndex(0); } + else{ + this.cursorRowId = ""; + } } @action.bound From 637b03baec3b0e0589d5175fa51332ac80e4170c Mon Sep 17 00:00:00 2001 From: Petr Hrehorovsky <83349812+washibana@users.noreply.github.com> Date: Mon, 24 Jul 2023 09:22:45 +0200 Subject: [PATCH 2/2] Code formatting. --- .../modules/Editors/DropdownEditor/DropdownEditorBehavior.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend-html/src/modules/Editors/DropdownEditor/DropdownEditorBehavior.tsx b/frontend-html/src/modules/Editors/DropdownEditor/DropdownEditorBehavior.tsx index f39dfe563b..62e647b5b1 100644 --- a/frontend-html/src/modules/Editors/DropdownEditor/DropdownEditorBehavior.tsx +++ b/frontend-html/src/modules/Editors/DropdownEditor/DropdownEditorBehavior.tsx @@ -393,8 +393,7 @@ export class DropdownEditorBehavior implements IDropdownEditorBehavior{ private trySelectFirstRow() { if (this.dataTable.rows.length > 0) { this.cursorRowId = this.dataTable.getRowIdentifierByIndex(0); - } - else{ + } else { this.cursorRowId = ""; } }