primeng icon indicating copy to clipboard operation
primeng copied to clipboard

TreeNodeDrop property doesnt include enough information about drop location

Open zachsteffens opened this issue 5 months ago • 0 comments

Describe the bug

When dragging and dropping, if I'm trying to drop an item at the root level, the drop location listed in the event is the last node in the tree as opposed to undefined or null. This is insufficient for scenarios where validateDrop is used. I've created a stackblitz here that demonstrates this issue.

In this demo scenario I'm limiting drops to parents that are marked as folder:true. I am unable to drop an item at the root level below the taxes.xslx tree item because when onJobTreeNodeDrop is fired, the drop node property is taxes.xslx which is not a folder. There is no way for me to determine that the drop has taken place at the root level(no parent) as opposed to last child of the root (dropping onto a tree item instead of a drop slot). It's obvious that the control knows the difference because it adjusts the tree accordingly, but the data required for making this determination in the drop handler is not passed in via the TreeNodeDropEvent property.

Environment

Angular: 17 Primeng: 17.18.0

Reproducer

https://stackblitz.com/edit/primeng-treedragdrop-demo-jqwcvn?file=src%2Fapp%2Fapp.component.ts,src%2Fapp%2Fapp.component.html,src%2Fassets%2Ffiles.json

Angular version

17.0.9

PrimeNG version

17.18.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

20.14.0

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

zachsteffens avatar Sep 05 '24 14:09 zachsteffens