RamonSmit / Nestable2

New pickup of Nestable!
Other
322 stars 147 forks source link

while moving between two lists only first nestable maxDepth is considered #93

Open unikumspace opened 6 years ago

unikumspace commented 6 years ago

Expected behavior

Situation: having 2 lists with different maxDepth values, trying to move items from first list to second. see template

It should be impossible to move "Second item" with its children from first list to "First item" of second, because second nestable depth will be more than defined in maxDepth property.

It should be possible to move "Second item" from second list inside "First item" of first list. Resulting total depth would be 3, which is in correspondence with first nestable maxDepth property.

Actual behavior

It's possible to move "Second item" with its children from first list to "First item" of second, even though second list has a maxDepth of 2 and movable item itself has a depth of 3.

Also "Second item" from second list can't be moved inside "First item" of first list, even though first list has a maxDepth of 3 and such move should be legitimate.

It seems that only maxDepth of first nestable (which was moved from) is taken in count. If movable item has children - their depth should also be considered (total depth = movable item depth + movable item children depth). Otherwise it becomes possible to move items into other nestables, resulting in its total depth over the limit defined by maxDepth property.