fix: diable drag on table to allow table column resize and reorder

This commit is contained in:
Johnson Cherian 2024-03-22 11:55:05 +05:30
parent 7cf3baa4b9
commit d6c0f65bdf

View file

@ -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) {