From d6c0f65bdf9e7d15bcd466e7a1a66bf216e0b95f Mon Sep 17 00:00:00 2001 From: Johnson Cherian Date: Fri, 22 Mar 2024 11:55:05 +0530 Subject: [PATCH] fix: diable drag on table to allow table column resize and reorder --- frontend/src/Editor/DragContainer.jsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/frontend/src/Editor/DragContainer.jsx b/frontend/src/Editor/DragContainer.jsx index 33140660d7..117f098270 100644 --- a/frontend/src/Editor/DragContainer.jsx +++ b/frontend/src/Editor/DragContainer.jsx @@ -463,9 +463,21 @@ export default function DragContainer({ }} checkInput onDragStart={(e) => { + console.log('onDragStart->', e.inputEvent.target); e?.moveable?.controlBox?.removeAttribute('data-off-screen'); const box = boxes.find((box) => box.id === e.target.id); - if (['RangeSlider', 'Container', 'BoundedBox', 'Kanban'].includes(box?.component?.component)) { + let isDragOnTable = false; + + /* Checking if the dragged elemenent is a table. If its a table drag is disabled since it will affect column resizing and reordering */ + if (box?.component?.component === 'Table') { + const tableElem = e.target.querySelector('.jet-data-table'); + isDragOnTable = tableElem.contains(e.inputEvent.target); + } + + if ( + ['RangeSlider', 'Container', 'BoundedBox', 'Kanban'].includes(box?.component?.component) || + isDragOnTable + ) { const targetElems = document.elementsFromPoint(e.clientX, e.clientY); const isHandle = targetElems.find((ele) => ele.classList.contains('handle-content')); if (!isHandle) {