ng2-dragula icon indicating copy to clipboard operation
ng2-dragula copied to clipboard

[usage question] Infinite nesting of drag/drop zones

Open MathiasStrohkirch opened this issue 6 years ago • 2 comments

REQUIRED: Before filing a usage question

Use case description (required) I would like to have infinite nesting using dragula. I can only figure out how to achieve one layer of nesting. See stackblitz example

Can you show a demo, or a picture of what you want to achieve?

I'd like to achieve infinite nesting of components in the following example

Additional context

https://stackblitz.com/edit/angular-nq5ld2

MathiasStrohkirch avatar Jun 06 '19 17:06 MathiasStrohkirch

Hi @MathiasStrohkirch , you can go infinite using this sample:

`<div class="wrapper" dragula="COLUMNS" [(dragulaModel)]="groups"> <div class="container" *ngFor="let group of groups"> {{group.name}} <div class="container" dragula="ITEMS" [(dragulaModel)]="group.items"> <div *ngFor="let item of group.items" [innerHtml]="item.name">

export class NestedComponent {

constructor(private dragulaService: DragulaService) { this.dragulaService.createGroup("COLUMNS", { direction: 'horizontal', moves: (el, source, handle) => handle.className === "group-handle" }); }

public groups:Array = [ { name: 'Group A', items: [{name: 'Item A'}, {name: 'Item B'}, {name: 'Item C'}, {name: 'Item D'}] }, { name: 'Group B', items: [{name: 'Item 1'}, {name: 'Item 2'}, {name: 'Item 3'}, {name: 'Item 4'}] } ]; }`

allanpaza avatar Jun 10 '19 09:06 allanpaza