From 9cba9bdd23537c1a00a6ef5b725534e73c03a3c3 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Wed, 18 Jun 2025 20:50:04 +0300 Subject: [PATCH] category order ui impr --- client/src/views/record/list-tree.js | 33 +++++++++++++++++++++------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/client/src/views/record/list-tree.js b/client/src/views/record/list-tree.js index e187805d3a..b1b24cf2bc 100644 --- a/client/src/views/record/list-tree.js +++ b/client/src/views/record/list-tree.js @@ -493,6 +493,20 @@ class ListTreeRecordView extends ListRecordView { continue; } + if (itemParentId) { + const parent = row.closest(`.list-group-item[data-id]`); + + if (parent) { + const childCount = parent + .querySelectorAll(':scope > .children > .list > .list-group > [data-id]') + .length + + if (childCount) { + continue; + } + } + } + isAfter = itemIsAfter; overParentId = itemParentId; overId = itemId; @@ -520,14 +534,16 @@ class ListTreeRecordView extends ListRecordView { }); draggable.on('drag:stop', async () => { - if (movedLink) { - movedLink.classList.remove('text-info'); - } + const finalize = () => { + if (movedLink) { + movedLink.classList.remove('text-info'); + } - rows.forEach(row => { - row.classList.remove('border-bottom-highlighted'); - row.classList.remove('border-top-highlighted'); - }); + rows.forEach(row => { + row.classList.remove('border-bottom-highlighted'); + row.classList.remove('border-top-highlighted'); + }); + }; rows = undefined; @@ -561,7 +577,6 @@ class ListTreeRecordView extends ListRecordView { }) .then(async () => { /** - * * @param {ListTreeRecordView} view * @param {string} movedId * @return {Promise} @@ -598,6 +613,8 @@ class ListTreeRecordView extends ListRecordView { }) .finally(() => { this.blockDraggable = false; + + finalize(); }); }